I have following situation. (pseudocode)
class A {
id;
List<B> bs;
}
class B {}
I wonder how to convert List os As -> Map of Bs
List<A> as;
// the Map key is A.id (Map<A.id, List<B>>)
Map<Integer, List<B>> bs = as.stream()
.map(a ->a.getBs())
.collect(// I dont know what to add here ???);