I have 2 Maps
Map<A, B> mapA
Map<B, List<C>> mapB
I want to join these maps on the values in mapA & keys in mapB the result should be
Map<A,List<C>> mapC
I am willing to know how can I do it using streams in Java8.
A,B,C for simplicty, all of these are strings in my case.
map.entrySet().stream().collect(Collectors.toMap(Entry::getKey, e -> mapB.get(e.getValue())))addAllis inCollectioninterface.MaphasputAllinstead. (2) You are trying to add allMap<A, B>toMap<A,List<C>>, which won't work!