package com.winterbe.java8;

import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * @author Benjamin Winterberg
 */
public class Lambda1 {

    public static void main(String[] args) {
        List<String> names = Arrays.asList("peter", "anna", "mike", "xenia");

        Collections.sort(names, new Comparator<String>() {
            @Override
            public int compare(String a, String b) {
                return b.compareTo(a);
            }
        });

        Collections.sort(names, (String a, String b) -> {
            return b.compareTo(a);
        });

        Collections.sort(names, (String a, String b) -> b.compareTo(a));

        Collections.sort(names, (a, b) -> b.compareTo(a));

        System.out.println(names);
    }

}
@@ -791,16 +791,285 @@
 (names);
+%0A%0A        names.sort(Collections.reverseOrder());%0A%0A        System.out.println(names);%0A%0A        List%3CString%3E names2 = Arrays.asList(%22peter%22, null, %22anna%22, %22mike%22, %22xenia%22);%0A        names2.sort(Comparator.nullsLast(String::compareTo));%0A        System.out.println(names2);
 %0A    %7D%0A%0A

add more comparator samples as discussed on reddit: http://redd.it/20ng6r