Solved

Complete the Code to Sort the Employees Collection by Salary

Question 45

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

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents