Optional对null值进行处理
Map collect = studentDTOS.stream().collect(Collectors
.toMap(StudentDTO::getStudentId,
studentDTO -> Optional.ofNullable(studentDTO.getStudentName())));
for(Map.Entry entry:collect.entrySet()){
System.out.println(entry.getKey()+"="+entry.getValue().orElse(""));
}