Database is returning CompanyEntity which contains duplicate employeeID
Map<String, CompanyEntity> pp = allEmployees.stream().collect(Collectors.toMap(CompanyEntity::getEmployeeId, Function.identity()));
Exception we are getting is:
IllegalStateException: Duplicate key
Is there tweak to prevent this in Java 8 without swapping key or shall i use old way of Java 6 where i check contains and update Map?