分组: 必须对Record类的 hashcode方法和equals方法重写. Map<Record, List> collect = recordService.stream().collect(Collectors.groupingBy( record -> new Record(record.getPartnerId(), record.getPaymentItemId())));