Solved

Complete the Code to Sort the Employees Collection by Salary

Question 25

Multiple Choice

Complete the code to sort the employees collection by salary using a Comparator.Assume the method getSalary that returns an employee's salary as an integer.
Collections.sort(employees, _____________________________________) ;


A) Comparator.comparing(Employee::getSalary)
B) Comparator.comparing(Employee::getSalary() )
C) Comparator.thenComparing(Employee::getSalary)
D) Comparator.comparing(e -> e.getSalary)

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions