2020
09-28
09-28
Java8进行多个字段分组统计的实例代码
Java8进行多个字段分组统计实现代码如下://分组统计Map<String,Long>countMap=records.stream().collect(Collectors.groupingBy(o->o.getProductType()+"_"+o.getCountry(),Collectors.counting()));List<Record>countRecords=countMap.keySet().stream().map(key->{String[]temp=key.split("_");StringproductType=temp[0];Stringcountry=temp[1];Recordrecord=newRecord();record....
继续阅读 >