Java tutorial
import java.util.Arrays; import java.util.Comparator; import java.util.List; public class Main { public static void main(final String[] args) { List<String> names2 = Arrays.asList("peter", null, "anna", "mike", "xenia"); names2.sort(Comparator.nullsLast(String::compareTo)); System.out.println(names2); } }