Question: Sorting with Lambda Comparators Implement the three sorting methods, sortByName, sortByAge, and sortByAge ThenName in the Person class according to their respective Javadoc comments. Important:

Sorting with Lambda Comparators Implement the three sorting methods, sortByName, sortByAge, and sortByAge ThenName in the Person class according to their respective Javadoc comments. Important: You must use lambda expressions to sort the lists of people. Hint: It is recommended you use sort () in the List interface to sort each list. Other useful methods include compareTo() in the String class and Integer. compare(). 1 package lambdacomparator; 3 import java.util.List; 4 5 public class Person { 6 private String name; private int age; 8 9 public Person (String name, int age) { 10 this.name = name; 11 this. age = age; 12 } 13 14 public String getName() { return name; } 15 public int getAge() { return age; } 16 @Override 17 public String toString() { return name \" : + age; } 18 19 20 * Sorts the given list of people alphabetically (lexicographically) by 21 * their name. 22 23 * @param people list of people to sort 24 * @return sorted list of people 25 * 26 public static List Person) sortByName (List)>)>)>)>)>

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!