使用steam流优化下面代码public ListInteger findIdentitiesfinal String empCode final ListInteger roles = ListsnewArrayList; if activityAppraiseeServiceexistByEmpCodeempCode rolesaddUse
使用Steam流优化后的代码如下:
public List
private boolean userTypeExistByEmpCode(UserTypeEnum userType, String empCode) { if (userType == UserTypeEnum.APPRAISEE) { return activityAppraiseeService.existByEmpCode(empCode); } else if (userType == UserTypeEnum.EXAMINER) { return activityExaminerService.existByEmpCode(empCode); } return false;
原文地址: http://www.cveoy.top/t/topic/hCp5 著作权归作者所有。请勿转载和采集!