List<Long> driverIds = drivers.stream().map(DriverCMDParamBO::getId).collect(Collectors.toList());
List<Long> driverIds2 = drivers.stream().mapToLong(DriverCMDParamBO::getId).boxed().collect(Collectors.toList());
List<Long> driverIds3 = drivers.stream().mapToLong(DriverCMDParamBO::getId)
.collect(() -> new ArrayList<Long>(), List::add, List::addAll);
List<Long> driverIds4 = drivers.stream().mapToLong(DriverCMDParamBO::getId)
.collect((Supplier<ArrayList<Long>>) ArrayList::new, List::add, List::addAll);
特化流的集合几种处理方式
List<Long> driverIds = drivers.stream().map(DriverCMDParamBO::getId).collect(Collectors.toList());
List<Long> driverIds2 = drivers.stream().mapToLong(DriverCMDParamBO::getId).boxed().collect(Collectors.toList());
List<Long> driverIds3 = drivers.stream().mapToLong(DriverCMDParamBO::getId)
.collect(() -> new ArrayList<Long>(), List::add, List::addAll);
List<Long> driverIds4 = drivers.stream().mapToLong(DriverCMDParamBO::getId)
.collect((Supplier<ArrayList<Long>>) ArrayList::new, List::add, List::addAll);