I have a list of objects. I need to find the minimum amount from a list of objects. But if there is a tie, then need to find the one with minimum Age. How to accomplish it using java 8?
class TestObject{
private Double amount;
private int age;
}
List<TestObject> objectList = getAllItems();
TestObject obj = objectList.stream()
.min(Comparator
.comparing(TestObject::getAmount))
.get();