[Java] Stream Sort
Sream<Employee> emps = ...; emps.sorted( Comparator.comparingInt(Employee::getSalary) .reversed() ).limit(10) .map(Employee::getName) .forEachOrdered(System.out::println);
ParalleSteam with unordered() to improve efficiency:
List<Integer> list = ...; long n = list.parallelStream() .unordered() .distinct() count();