I have three Objects as below :
public class A {
private int a;
private ...
private B b;
//getters setters for B
}
public class B {
private String name;
private ...
private C c;
//getters setters for C
}
public class C {
private Long id;
private ...
}
I'm having a List<A>
with B'
s Object in every A
and C
's Object In every B
.
I want to group A list by C.id in a map Map<C,List<A>>
How do I achieve this using groupingBy
method of Stream
?