java.lang.IllegalStateException: Duplicate key ex-qixuie002
map中存在key值相同的数据
Map<String, String> collect = oList.stream().collect( Collectors.toMap(OcmCustomerIdDO::getOcmCustId, info -> info.getUmId() == null ? "" : info.getUmId())); System.out.println(collect);
根据业务逻辑选择,是前者覆盖后者重复,还是后者覆盖前者重复
Map<String, String> collect = oList.stream().collect( Collectors.toMap(OcmCustomerIdDO::getOcmCustId, OcmCustomerIdDO::getUmId, (key1, key2) -> key2));//后者覆盖前者