Here is the gone-wrone code
Set<Map.Entry> entrySet = new HashMap<Object,Object>().entrySet();
it comes up with a compile error
cannot convert from Set<Map.Entry<Object,Object>> to Set<Map.Entry>
But there should be just a warning from not using generic type in the case Map.Entry
from Map.Entry<Object,Object>
But why here come out a compile error?
then I've suspected that the whole Set<Map.Entry>
may be the reason,that is maybe Set<Map.Entry>
≠ set<Map.Entry<Object,Object>
but since Map.Entry
≈ Map.Entry<Object,Object>
why not Set<Map.Entry>
≈ set<Map.Entry<Object,Object>
I've find the relavent questions,but my question is this case is something different.
To be more spacific,why when I use Set<Map.Entry>
,I can't event get through compile and get an error but not just a warning?
But in another case,for exampleArrayList li = new ArrayList<String>();
I can get through compile and just get a warning "ArrayList is a raw type. References to generic type ArrayList should be
parameterized"