We would like to know how to use type inferences to avoid the need to define Integer.
import java.util.Arrays; /*ww w . j a v a 2 s . co m*/ public class Main { public static void main(String[] args) { Integer[] numbers = {1, 2, 3}; Arrays.sort(numbers, (i1, i2) -> { return (i2 - i1); }); System.out.println(Arrays.toString(numbers)); } }
The code above generates the following result.