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(Comparator.reverseOrder()) .forEach(System.out::println); } }
Result:
Report an issue