Java中stream的使用

String集合转Long类型后,需要boxed,再转集合

1
2
3
4
5
List<Long> dictValues = sysDictDatas.stream()
.map(SysDictData::getDictValue)
.mapToLong(Long::parseLong)
.boxed() # 将 LongStream 转换为 Stream<Long>
.collect(Collectors.toList());

百度