Java8の構文では、エンティティリストをキーを指定してマップに変換することができ、キーの値が重複する場合はIllegalStateException: Duplicate key
「 」という例外が報告されます。
解決:
//b覆盖
allEmployees.stream()
.collect(Collectors.toMap(CompanyEntity::getEmployeeId,
Function.identity(), (a,b) -> b))
//保存a,不覆盖
return this.fsRepo.getDosIdsWithDcs(dosIds).
stream().collect
(Collectors.toMap(YourModelDosClass::getDosId, v->v,
(v1,v2) -> v1));