由于项目需要,需要获取集合对象中最小和最大时间。
使用
获取list中日期最大的对象
Optional<User> max = collect.stream().max(Comparator.comparing(User::getBirthday));
User user = max.get();
获取list中日期最小的对象
Optional<User> max = collect.stream().min(Comparator.comparing(User::getBirthday));
User user = max.get();
END