将对象集合中的某一项抽离出来形成新的集合 List<Long> idList = users.stream().map(User::getId).collect(Collectors.toList()); 其他用法参见 https://blog.csdn.net/qq_37253891/article/details/108488919