List<T>转Map<S,T>
Map<String,DemoEntity> map = stats.stream().collect(Collectors.toMap(DemoEntity::getKey,
c -> c));
List<T>转Map<S,T>(过滤重复key
)
Map<String,DemoEntity> result = items.stream().collect(Collectors.toMap(DemoEntity::getKey,
c -> c,(e1,e2) -> e1));
List<T>转Map<S,S>
Map<String,String> map = stats.stream().collect(Collectors.toMap(DemoEntity::getKey,
DemoEntity::getStringValue));
List<T>转Map<S,List<T>>
Map<String,List<DemoEntity>> map = vars.stream().collect(Collectors.groupingBy(DemoEntity::getKey));
doc
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。