Lamda 表达式

从List<User> 中获取 age最大的对象 

Optional<User> optional= list.stream().max(Comparator.comparing(User ::getAge));
User maxEndCount = optional.get();

posted @ 2020-04-29 15:47  打代码的小超人  阅读(305)  评论(0)    收藏  举报