List<CfUserContactDO> userContacts = new ArrayList<>(); ... //(oldValue, newValue) -> oldValue) Map<Long, CfUserContactDO> dataMap = userContacts.stream().collect(Collectors.toMap(user -> user.getId(), user -> user, (user1, user2) -> user1));
List<CfUserContactDO> userContacts = new ArrayList<>(); ... //(oldValue, newValue) -> oldValue) Map<Long, CfUserContactDO> dataMap = userContacts.stream().collect(Collectors.toMap(user -> user.getId(), user -> user, (user1, user2) -> user1));