java8中使用Lambda表达式

List regionCounts = new ArrayList<>();
        Map map = regionCounts.stream().collect(Collectors.toMap(p->p.getRegionCode(),p->p));

List list = new ArrayList<>();
Map map = list.stream().collect(Collectors.toMap(Entity::getId, Entity::getType));

List regionCounts = deviceRepository.countGroupByRegion();
        Map 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()));

 

你可能感兴趣的:(jdk)