标签:stream col cto names name lambda表达式 etag list() ping
List<Person> personList = xxx;
集合过滤
personList.stream.filter(x->x.getAge()>20).collect(Collectors.toList());
对象取字段
List<String> names = personList.stream.map(Person::getName()).collect(Collectors.toList());
分组
groupingBy()
List转Map
Map<String,Person> personMap = personList.stream.toMap(x->getId(),x);
标签:stream col cto names name lambda表达式 etag list() ping
原文地址:https://www.cnblogs.com/qlsty/p/12142625.html