Map of Map in JavaIn Java, Map is an interface that maps keys to values. Sometimes it is required to implement Map of Map (nested Map). Nested Map is used in many cases, such as storing students' names with their Ids of different courses. In this case, we create a Map having a key, i.e., course name and value, i.e., another Map having a key, i.e., Id and value, i.e., the student's name. We should use the following steps to create a Map of Map in Java:
Let's implement the logic for creating Map of Map to store data. MapOfMapExample.java Output: ![]()
Next TopicPrint Pencil Shape Pattern in Java
|