We would like to know how to use implied return type.
import java.util.Arrays; /*from ww w. j a va2s. c om*/ public class Main { public static void main(String[] args) { Integer[] numbers = {1, 2, 3}; // watch return types, it is implied, no return keyword is necessary Arrays.sort(numbers, (i1, i2) -> i2 - i1); System.out.println(Arrays.toString(numbers)); } }
The code above generates the following result.