The type HashMap is not generic; it cannot be parameterized with arguments <String, Integer>
Check you are actually using java.util.HashMap and java.util.Map in your imports.
I have also gone through the same error but it was resolved just by changing some properties of the project:
- Right-click on your project
- Click on
Properties
- Select
Java Build Path
from right-hand side panel - Select
Order and Export
tab - Click on your
JRE System Library or JDK Library
- Click on
Up
button and move it to first position - Click
Ok
- Clean & build your project.
Do repeat this for all other dependents project as well, if you have dependencies.
It resolved my issue because previously the Java files were picking other libraries and packages not from JRE package as it was ordered set in last priority.
I'm sure that you are importing the wrong HashMap
. You have to use the java.util
packages for the code you presented there.
We can't help you any further without seeing your import statements.
The type HashMap is not generic; it cannot be parameterized with arguments <String, Integer>
If this type of error occur than first check your file name and class name Beause by mistake you save file name as HashMap.java Than try other ways