Saturday, 7 September 2013

The type parameter Entry is hiding the type Map.Entry (WTF?)

The type parameter Entry is hiding the type Map.Entry (WTF?)

Eclipse complains about this code with "The type parameter Entry is hiding
the type Map.Entry":
import java.util.Map.Entry;
public class Test {
static abstract class EntryIterator<Entry<K, V>> implements
Iterator<K, V> {
}
}
I don't quite understand what the problem is here - the type in question
is java.util.Map.Entry. How can that shadow itself? How the heck am I
supposed to declare the inner class to make it compile?

No comments:

Post a Comment