Geekific
What will be the output of the following code?--------------------public static void main(String[] args) { List<Integer> list = Arrays.asList(1, 2, 3, 4, 5); list.sort((a, b) -> b - a); System.out.println(list);}
1 month ago | [YT] | 21
@troykaplan5533
Where is the a and b coming from? Is that some lambda specific stuff? Seems like a and b need to be defined in order for this to work?
1 month ago (edited) | 0
Geekific
What will be the output of the following code?
--------------------
public static void main(String[] args) {
List<Integer> list = Arrays.asList(1, 2, 3, 4, 5);
list.sort((a, b) -> b - a);
System.out.println(list);
}
1 month ago | [YT] | 21