标签:use java nbsp user 去重 font lis mapping bsp
取出list的里面userId的那一列
List<String> userList = list.stream().map(userInfo ->userInfo.getDnUserId()) .collect(Collectors.toList())
将list按照DataItem分组
Map<String,List<DeviceDataVo>> map=list.stream().collect(Collectors.groupingBy(DeviceDataVo::getDataItem,
Collectors.mapping(a->a,Collectors.toList())));
将list按照年龄从小到大排序
List<User> collect2 = list.stream().sorted((s1, s2) -> s1.getAge() - s2.getAge()).collect(Collectors.toList());
collect2.forEach(x->{
System.out.print(x.getAge());
});
取出年龄的最大值
Optional<User> collect1 = list.stream().collect(Collectors.maxBy((s1, s2) -> s1.getAge() - s2.getAge()));
summingInt、summingLong、summingDouble取出总和
averageInt、averageLong、averageDouble取出平均值
Counting是计数 distinct去重
遍历map集合
for (Map.Entry<String,List<DeviceDataVo>>
entry:map.entrySet()){
List<DeviceDataVo> dataList=entry.getValue();
}
将xData的内容去重
xData=xData.stream().distinct().collect(Collectors.toList());
取出符合条件的数据
List<DeviceDataVo> inDatas=dataList.stream().filter(x->x.getKey().equals(in)).collect(Collectors.toList());
标签:use java nbsp user 去重 font lis mapping bsp
原文地址:https://www.cnblogs.com/yxj808/p/13253350.html