1、遍历list
for(int i=0;i<list.size();i++){
if(list.get(i).equals("del"))
list.remove(i);
}
2、遍历PageResult返回的数据(转成list模式)
PageResult<ForkliftVo> result = new PageResult<ForkliftVo>();
result = forkliftService.showTemplateForkliftList(forkliftVo, getCurrentPage(), getMaxResults());
List<ForkliftVo> listVo = result.getRows();
int size = listVo.size();
for (int i = 0; i < size; i++) {
listVo.get(i).setCheck(1);
}
3、遍历Map返回的数据
Map<String,List<InspectStatisticsVo>> map = list.stream().collect(Collectors.groupingBy(InspectStatisticsVo::getRecordTime));
List<InspectStatisticsVo> inspectStatisticsVos = new ArrayList<>();
for(Map.Entry<String, List<InspectStatisticsVo>> entry : map.entrySet()){
String mapKey = entry.getKey();
List<InspectStatisticsVo> inspectList = entry.getValue();
if(inspectList.size()==1){
InspectStatisticsVo vo = new InspectStatisticsVo();
vo.setRecordTime(inspectList.get(0).getRecordTime());
vo.setForkliftSum(inspectList.get(0).getForkliftSum());
vo.setCheckedSum(1);
vo.setAbnormalSum(5);
inspectStatisticsVos.add(vo);
}else{
InspectStatisticsVo vo = new InspectStatisticsVo();
vo.setRecordTime(inspectList.get(0).getRecordTime());
vo.setForkliftSum(inspectList.get(0).getForkliftSum());
vo.setCheckedSum(121);
vo.setAbnormalSum(51);
inspectStatisticsVos.add(vo);
}
}