Java tutorial
import java.util.Arrays; import java.util.Comparator; import java.util.List; public class Main { public static void main(String[] args) { List<String> friends = Arrays.asList("CSS", "HTML", "Oracle", "Dart"); //same but reverse System.out.println("\nsort reverse:"); Comparator<String> comp = (aName, bName) -> aName.compareTo(bName); friends.stream().sorted(comp.reversed()).forEach(System.out::println); } }