List<RegionCountBo> regionCounts = new ArrayList<>();
Map<String, RegionCountBo> map = regionCounts.stream().collect(Collectors.toMap(p->p.getRegionCode(),p->p));
List<Entity> list = new ArrayList<>();
Map<Integer, String> map = list.stream().collect(Collectors.toMap(Entity::getId, Entity::getType));
List<Object[]> regionCounts = deviceRepository.countGroupByRegion();
Map<String, RegionCountBo> regionCountsMap = regionCounts.stream().collect(Collectors.toMap(p->(String)p[1],
p->new RegionCountBo((String)p[1],null,Integer.parseInt(p[0].toString()),null,null)));
regionCountBos.sort((RegionCountBo h1, RegionCountBo h2) -> h2.getOnlineRate().compareTo(h1.getOnlineRate()));
java8中使用Lambda表达式
猜你喜欢
转载自blog.csdn.net/feicongcong/article/details/102632685
今日推荐
周排行