java中list根据两个属性进行分组

Map>> collect = subsZingerList.stream().collect(Collectors.groupingBy(SubsZinger::getPrintInId, Collectors.groupingBy(SubsZinger::getUid)));
collect.forEach((key,value)->{
    System.out.println("外键"+key+"外部值"+value);
    value.forEach((key2,value2)->{
        System.out.println("内键"+key2+"内部值"+value2);
    });
});
 
  
 
 

你可能感兴趣的:(java)