I have an inheritance chain in which Superclass have 3 immediate subclasses, Subclass1, Subclass2, Subclass3.
I have a:
HashMap<Integer, HashMap<Integer, HashSet<Superclass>>> map = new HashMap<>();
I want map to contain 3 hashmaps at integer values 1, 2 and 3. These 3 hashmaps will each have values of HashSet that contain only one subclass of Superclass.
For instance map.get(1) should refer to
HashMap<Integer, HashSet<Subclass1>>
But I'm not allowed to add the above HashMap to map, because of a compiler error:
(actual argument HashMap<Integer, HashSet<Subclass1>> cannot be converted to
HashMap<String, HashSet<Superclass>> by method invocation conversion)