域1->
(ContractTerms)
private BigDecimal id;
private ProgramDetails programDetails;领域2->
(ProgramDetails)
private BigDecimal id;
private ProcessType processTypeId;我希望通过processTypeId,使用detachedcriteria对其进行分组,我正在从DB中获取我的列表,但现在我希望它被processTypeId分组
termValueForExtention.stream().collect(grouppingBy(ContractTerms::getProgramDetails));发布于 2022-07-15 13:35:09
,
Map<BigDecimal, List<ContractTerms>>,BigDecimal是ProcessTypeId
然后,要访问嵌套在另一个属性中的属性,需要用以下lambda表达式替换代码中的方法引用
List<ContractTerms> termValueForExtention = // initializing the list of ContractTerms
Map<BigDecimal, List<ContractTerms>> result = termValueForExtention.stream()
.collect(Collectors.groupingBy(
contractTerms -> contractTerms.getProgramDetails().getProcessTypeId()
));https://stackoverflow.com/questions/72992964
复制相似问题