I have the following classes:
class A {
String id;
List<B> b;
}
class B {
String id;
}
And I have a list of a's that I would like to convert to a map with the following logic:
List<A> aList;
Map<String, String> map;
for (A a:aList)
{
for (B b:aList.b)
{
map.put(b.id, a.id)
}
}
What is the best way to do it in one line of stream method?
Thanks Elad