Source Code:
(back to article)
import java.util.*; public class Main { public static void main(String[] args) { List<Integer> numbers = Arrays.asList(4, 5, 3, 1 , 2); numbers.stream() .sorted((a, b) -> b - a) .forEach(System.out::println); } }
Result:
Report an issue