class Person {

public String name;

public int age;

}

List < Person > persons = new ArrayList <>(); // TODO we should add some persons to this list

Collections .sort(persons, (p1, p2) -> p1 .name .compare To (p2 .name ));

Collections .sort(persons, new Comparator < Person >() {

public int compare( Person p1, Person p2) {

return p1 .name .compare To (p2 .name );

}

});