This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Class definition ommitted */ | |
public void run(){ | |
List<Integer> list = Arrays.asList(5, 9, -1, 60, 10, 2, 9); | |
// region <lambdas> ---------------------------------------------------------------------------┐ | |
list.sort ((a, b) -> b - a); | |
list.forEach(i -> System.out.print(i + " ")); // output: 60 10 9 9 5 2 -1 | |
// ┌-----------> Note the empty parenthesis, this lambda has no input |