I have array of objects person (int age; String name;).
person (int age; String name;)
How can I sort this array alphabetically by name and then by age?
Which algorithm would
You can use Java 8 Lambda approach to achieve this. Like this:
persons.sort(Comparator.comparing(Person::getName).thenComparing(Person::getAge));