import java.util.Comparator; import java.util.Arrays; import java.util.Collections; import java.util.List; public class StudentSorter { public static void main(String[] args) { List list = Arrays.asList( new Student("Minnie", "Mouse"), new Student("Mickey", "Gouse"), new Student("Marry", "Poppins"), new Student("Peter", "Pan") ); System.out.println(list); Collections.sort(list, (a,b) -> a.getLastName().compareTo(b.getLastName()) ); System.out.println(list); } }