Getting object with max date property from list of objects Java 8

后端 未结 4 927
执念已碎
执念已碎 2021-02-01 01:23

I have a class called Contact that has a Date lastUpdated; variable.

I would like to pull the Contact out of a List

4条回答
  •  眼角桃花
    2021-02-01 02:14

    Use List.stream().max(Comparator).get() after you defined a suitable Comparator.

提交回复
热议问题