This is a strange error I am getting today when I try to implement a Map
as below.
Map<String, Integer> cache = new HashMap<String, Integer>();
I am using JDK 1.7 and not sure why this error has been coming. Changing the above line by adding a cast removes the error. I looked at the related posts on stackoverflow before posting this question. Seems to be a strange issue.
Map<String, Integer> cache = (Map<String, Integer>) new HashMap();
Check you are actually using java.util.HashMap and java.util.Map in your imports.