从list列表中获取某字段列表
List<User> userList = new ArrayList<>(); //list集合中获取code集合 List<String> codeList = userList.stream().map(i -> i.getCode()).collect(Collectors.toList()); //或 List<String> codeList = userList.stream().map(User::getCode).collect(Collectors.toList()); //或 List<String> codeList = new ArrayList<>(); for (User user : userList) { codeList.add(user.getCode()); }
下班记得打卡