I'm creating a system that has a parameterized class "TypeModule<T>". Now, I have another class that has the following member;
private LinkedHashMap<Class, ArrayList<TypeModule>> m_modules = ...
Here's my dilemma. I need something more like the following;
private LinkedHashMap<Class<?>, ArrayList<TypeModule<?>>> m_modules = ...
The only thing is, I need the '?'s to match types. I can't use a 'T' in place of the '?' because there's going to be different 'T's in the same map. I just want to tell the compiler that the '?'s are going to match. For example, this might be the contents of the map in a specific instance...
String.class -> ArrayList<TypeModule<String>>
Integer.class -> ArrayList<TypeModule<Integer>>
My problem is giving me warnings when I compile the program, although it runs correctly (the code actually ensures that the Class<?> and TypeModule<?> are of the same type), so I can scrape by if there isn't a nice solution to the problem. But, of course, if there is a solution, it would be greatly appreciated!
Thanks in advance!