Avoiding Returning Wildcard Types
问题 I have a class with a collection of Wildcard Types that is a singleton, something like: public ObliviousClass{ private static final ObliviousClass INSTANCE = new ObliviousClass(); private Map<Key, Type<?>> map = new HashMap<Key, Type<?>>(); public void putType(Key key, Type<?> type){ map.put(type); } // returns the singleton public static ObliviousClass getInstance(){ return INSTANCE; } } I'd like to be able to add different Parameterized types to this collection in client code: void