jdk 8 list 转map Duplicate key WmSoDetail


根据状态分组

//原来写法
Map<String, WmSoDetail> upDetailMap = upWmSoDetailList.stream().collect(Collectors.toMap(WmSoDetail::getStatus, item -> item));

//正确写法

Map<String, WmSoDetail> upDetailMap = upWmSoDetailList.stream().collect(Collectors.toMap(WmSoDetail::getStatus, item -> item,(k1, k2) -> k1));

 

jdk 8 list 转map Duplicate key WmSoDetail

上一篇:ElasticSearch基本操作


下一篇:POJO解释