Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        Integer[] numbers = { 1, 2, 3 };

        // reverse with lambda
        reverseWithLambda(numbers);
        System.out.println(Arrays.toString(numbers));
    }

    private static void reverseWithLambda(Integer[] numbers) {
        Arrays.sort(numbers, (Integer i1, Integer i2) -> {
            return (i2 - i1);
        });
    }

}