Lets you understand the concept of Erasure. With RUNTIME, the HashMap<String, String>() and HashMap() are the same as the HashMap.
The process of converting a HashMap<String,String> to a HashMap (Raw Type) is called Erasure.
Without using Generics, you should throw, say, a value in Map, in String Explicitly every time.
Using generics makes you eliminate the roll.
If you are not using Generics, there is a high chance that a future developer may insert another type of object that will ClassCastException
source share