当前位置: 代码迷 >> 综合 >> jdk8获取最大时间的对象
  详细解决方案

jdk8获取最大时间的对象

热度:12   发布时间:2024-02-28 04:56:12.0

有时候我们需要知道最大最小对应的这个对象,我们可以通过如下方法获取

Comparator<LeasingBusinessContract> comparator = Comparator.comparing(LeasingBusinessContract::getLeaseEndDate);
LeasingBusinessContract maxObject = leasingBusinessContractList.stream().max(comparator).get();