Complete the code to sort the employees collection by title and within title by salary using a Comparator.Assume the method getSalary that returns an employee's salary as an integer and the method getTitle that returns an employee's title as a String.
Collections.sort(employees, Comparator___________________________) ;
A) .comparing(Employee::getSalary) .thenComparing(Employee::getTitle)
B) .comparing(Employee::getTitle) .thenComparing(Employee::getSalary)
C) .thenComparing(Employee::getSalary) .comparing(Employee::getTitle)
D) .thenComparing(Employee::getTitle) .comparing(Employee::getSalary)
Correct Answer:
Verified
Q52: Which of the following statements related to
Q53: Which of the following is NOT a
Q54: Consider the following pseudocode that returns an
Q55: Which Java interface is NOT a functional
Q56: Which of the following statements does NOT
Q58: Which lambda expression represents a function that
Q59: Complete the following code snippet, assuming that
Q60: Consider the following pseudocode that returns an
Q61: Complete the following statement that uses streams
Q62: Which of the following terminal operations on
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents