I have a class named Myclass, which is just a wrapper of a HashMap, I want to be able to store the possible key/value pair listed below: KEY_A -> MyClassA KEY_LIST_B -> List<MyClassB> KEY_C -> List<MyClassC> Here is my code : How can I design (signature of these methods) the get() and set() methods of MyClass to be able to
Tag: unchecked-cast
Unchecked Cast warning – shows up for Type parameters but not for Concrete types?
Consider the following snippet: From what I understand – whenever we convert Supertype -> Subtype Unchecked cast is flagged as the compiler does not know until the runtime if the type represented by the Supertype will ever match the SubType. Then over here – why is (Double) (Number)a not being flagged as the Unchecked Cast? Answer Unchecked cast is flagged