Assuming I have the following classes:
class A {
int id;
List<B> b;
}
class B {
int id;
}
I want to create a map between A.id to the list of B.id (Map<Integer, List<Integer>> , where key = A.id, and List<Integer> corresponds to the list of B.id fields for each A ). I tried various combinations of Collectors.groupingBy and Collectors.mapping, but to no effect. Can somebody help me out ?