关于java8 对象转map时重复key Duplicate key xxxx问题

重复时采用后面的value 覆盖前面的value

Map<String, String> map = list.stream().collect(Collectors.toMap(Student :: getClassName, Student :: getStudentName, 
    (value1, value2 )->{ 
            return value2; 
    }));

评论

暂无评论