Merge pull request #63 from honeykakkar/patch-1

Update lambda expression used for comparator
This commit is contained in:
javadevjournal
2022-10-09 12:17:51 -07:00
committed by GitHub

View File

@@ -47,7 +47,7 @@ public class CustomerService {
customers.sort(Comparator.comparingInt(Customer::getAge));
//pure lambda expression
Collections.sort(customers, (c1, c2) -> c1.getAge() - c1.getAge()); //we careful when using this as it can cause overflow
Collections.sort(customers, (c1, c2) -> c1.getAge() - c2.getAge()); //we careful when using this as it can cause overflow
}
private static List<Customer> getCustomers(){