问题 I hava a list of Class A like class A { private Integer keyA; private Integer keyB; private String text; } I want to transfer aList to nested Map mapped by keyA and keyB So I create below code. Map<Integer, Map<Integer,List<A>>> aMappedByKeyAAndKeyB = aList.stream() .collect(Collectors.collectingAndThen(Collectors.groupingBy(A::getKeyA), result -> { Map<Integer, Map<Integer, List<A>>> nestedMap = new HashMap<Integer, Map<Integer, List<A>>>(); result.entrySet().stream().forEach(e -> {nestedMap