stream流代码:
List<User> UserList = userMapper.selectAllUser();
List<String> userIdList = UserList.stream().map(User::getId).collect(Collectors.toList());
转化常规代码:
List<User> UserList = userMapper.selectAllUser();
List<String> userIdList = new ArrayList<>();
for(User user : UserList){
userIdList.add(user.getId());
}