Try
Iterator<? extends Entry<?, V>> it = map.entrySet().iterator();
The reason your attempt is not working is a little hard to see, especially because Iterator<T> does not consume any T (i.e. it does not have a method that takes T as a parameter).
You cannot assign Iterator<Entry<capture#5-of ?,V>> to Iterator<Entry<?, V>> for the same reason that you cannot assign Iterator<Entry<Integer, String>> to Iterator<Entry<?, V>> . capture#5 just a name used to differentiate a specific ? found in your method parameter from other individual instances of wildcards. It can be as easy as a particular type.
The reason this does not work is clearer if, instead of Iterator you consider a class like List .
List<Entry<Integer, String>> entries = new ArrayList<>(); //this is a compile error, but assume it is possible List<Entry<?, String>> wildcardEntries = entries; //then since this is already possible wilcardEntries.add(new Entry<String, String>("a", "b")); Entry<Integer, String> entry1 = entries.get(0); //this would result in a type error (ClassCastException) Integer i = entry1.getKey();
Using ? extends Entry<?, V> ? extends Entry<?, V> , you are not exposing yourself to this, since you are not claiming to know anything about the type of Entry that your Iterator can use, only what it can produce.
Edit
Although Jiman deleted his answer, he had a good point of view that using a for-each loop is a much cleaner approach (assuming you're just trying to iterate over entries), which would completely eliminate this problem. This should work:
for ( Entry<?, V> entry : map.entrySet() ) {