stream流分组

   List credentials = SqlUtil.getMapToList(entityManager, stringBuilder.toString(), Credential.class);
        List> groupList = new ArrayList<>();
        credentials.stream().collect(Collectors.groupingBy(Credential::getPaymentMethod, Collectors.toList()))
                .forEach((paymentMethod, fooListByName) -> groupList.add(fooListByName));

 

你可能感兴趣的:(java8,stream)