工作中看到同事写的代码,不是很理解,特意学习后记录于此
public FunctionResult<Map<String,Date>>getWeekStartTimeMap(String academicYear){
Map<String,Date> schoolYearWeekStartTimeMap = new HashMap<>();
List<ViewDzpSchoolYearDO> yearDOS = viewDzpSchoolYearDOMapper.list(academicYear);
if(yearDOS.isEmpty()){
return new FunctionResult(ErrorCode.SchoolYearNotExist);
}
Map<Integer,ViewDzpSchoolYearDO> termTypeMap = yearDOS.stream().collect(Collectors.toMap(ViewDzpSchoolYearDO::getTermTypeId, a -> a));
待补充
新特性
https://blog.csdn.net/lidai352710967/article/details/81461119
https://blog.csdn.net/lidai352710967/article/details/82496783
网友评论