排序
1 | seriesMap.keySet().stream(). |
分组
1 | list.stream().collect(Collectors.groupingBy(DutyTurns::getOrderno)) |
根据id
1 | Map<String,DutyClasses>classMap=classList.stream().collect(Collectors.toMap(DutyClasses::getUuid,DutyClasses->DutyClasses)); |
取集合一条数据
1 | DutyLogdutyLog=dutyLogMapper.selectDutyLogList(null).stream().reduce((first,second)->second).get(); |
集合去重
1 | inetAddresses.stream().map(InetAddress::getHostAddress).distinct().map(String::toLowerCase).collect(Collectors.toList()); |
取平局值
1 | list.stream().mapToDouble(TagValue::getValue).average().getAsDouble() |
前5条数据
1 | noticeService.selectNoticeList(notice).stream().limit(5l).collect(Collectors.toList()); |
筛选
1 | historicProcessInstances=historicProcessInstances.stream().filter(historic->historic.getProcessDefinitionName().indexOf(flowTaskVo.getProcDefName())<0).collect(Collectors.toList()); |
集合
1 | List<DictEntity> dictEntityList = dictService.findByType(6); |
取出属性为集合
1 | List<String> stateNameList = dictEntityList.stream().map(DictEntity::getName).collect(Collectors.toList()); |
取出属性为数组
1 | Long[] ids = dictEntityList.stream().map(DictEntity::getId).toArray(Long[]::new); |
集合去重
1 | dictEntityList.stream().distinct().collect(Collectors.toList()); |