Given a class
public class MyClass {
public int langId;
public int sectionId;
}
If I have a map that maps a LangId to all the instances of MyClass that have that LangId:
Map<Integer, List<MyClass>> mapLangIdToListOfMyClass = new HashMap<>();
Using Java 8 streams, would there be a simple way to consume the previous Map and create a new Map that maps SectionId to all the instances of MyClass that has that SectionId:
Map<Integer, List<MyClass>> mapSectionIdToListOfMyClass = new HashMap<>();