I hava a list of Class A like
A
class A { private Integer keyA; private Integer keyB; private String text; }
I want to transfer <
Seems that you just need a cascaded groupingBy:
groupingBy
Map<Integer, Map<Integer,List<A>>> aMappedByKeyAAndKeyB = aList.stream() .collect(Collectors.groupingBy(A::getKeyA, Collectors.groupingBy(A::getKeyB)));