Buggy code:
public class IntHashMap < V > implements Serializable , Cloneable { volatile transient Set < Integer > keySet = null ; volatile transient Collection < V > values = null ; static final int DEFAULT_INITIAL_CAPACITY = 16 ; static final int MAXIMUM_CAPACITY = 1 << 30 ; static final float DEFAULT_LOAD_FACTOR = 0.75F ; transient IntHashMap . Entry < V > [ ] table ; transient int size ; int threshold ; final float loadFactor ; volatile transient int modCount ; @ SuppressWarnings ( "unchecked" ) public IntHashMap ( int initialCapacity , float loadFactor ) { } public IntHashMap ( int initialCapacity ) { } @ SuppressWarnings ( "unchecked" ) public IntHashMap ( ) { } void init ( ) { } static int indexFor ( int h , int length ) { } public int size ( ) { } public boolean isEmpty ( ) { } public V get ( int key ) { } public boolean containsKey ( int key ) { } IntHashMap . Entry < V > getEntry ( int key ) { } public V put ( int key , V value ) { } private void putForCreate ( int key , V value ) { } void putAllForCreate ( IntHashMap < V > m ) { } @ SuppressWarnings ( "unchecked" ) void resize ( int newCapacity ) { } void transfer ( IntHashMap . Entry < V > [ ] newTable ) { } public void putAll ( IntHashMap < V > m ) { } public V remove ( int key ) { } IntHashMap . Entry < V > removeEntryForKey ( int key ) { } @ SuppressWarnings ( "unchecked" ) IntHashMap . Entry < V > removeMapping ( Object o ) { } public void clear ( ) { } public boolean containsValue ( Object value ) { } private boolean containsNullValue ( ) { } @ SuppressWarnings ( "unchecked" ) @ Override public Object clone ( ) throws CloneNotSupportedException { } public static class Entry < V > { final int key ; V value ; IntHashMap . Entry < V > next ; Entry ( int k , V v , IntHashMap . Entry < V > n ) { } public int getKey ( ) { } public V getValue ( ) { } public V setValue ( V newValue ) { } @ SuppressWarnings ( "unchecked" ) @ Override public boolean equals ( Object o ) { } @ Override public int hashCode ( ) { } @ Override public String toString ( ) { } } void addEntry ( int key , V value , int bucketIndex ) { } void createEntry ( int key , V value , int bucketIndex ) { } private abstract class HashIterator < H > implements Iterator < H > { IntHashMap . Entry < V > next ; int expectedModCount ; int index ; IntHashMap . Entry < V > current ; HashIterator ( ) { } public boolean hasNext ( ) { } IntHashMap . Entry < V > nextEntry ( ) { } public void remove ( ) { } } private class ValueIterator extends IntHashMap < V > . HashIterator < V > { public V next ( ) { return nextEntry ( ) . value ; } } private class KeyIterator extends IntHashMap < V > . HashIterator < Integer > { public Integer next ( ) { <START_BUG> return new Integer ( nextEntry ( ) . getKey ( ) ) ; <END_BUG> } } private class EntryIterator extends IntHashMap < V > . HashIterator < IntHashMap . Entry < V > > { public IntHashMap . Entry < V > next ( ) { IntHashMap . Entry < V > nextEntry = nextEntry ( ) ; return nextEntry ; } } Iterator < Integer > newKeyIterator ( ) { } Iterator < V > newValueIterator ( ) { } Iterator < IntHashMap . Entry < V > > newEntryIterator ( ) { } private transient Set < IntHashMap . Entry < V > > entrySet = null ; public Set < Integer > keySet ( ) { } private class KeySet extends AbstractSet < Integer > { @ Override public Iterator < Integer > iterator ( ) { } @ Override public int size ( ) { } @ Override public boolean contains ( Object o ) { } @ Override public boolean remove ( Object o ) { } @ Override public void clear ( ) { } } public Collection < V > values ( ) { } private class Values extends AbstractCollection < V > { @ Override public Iterator < V > iterator ( ) { } @ Override public int size ( ) { } @ Override public boolean contains ( Object o ) { } @ Override public void clear ( ) { } } public Set < IntHashMap . Entry < V > > entrySet ( ) { } private class EntrySet extends AbstractSet < IntHashMap . Entry < V > > { @ Override public Iterator < IntHashMap . Entry < V > > iterator ( ) { } @ SuppressWarnings ( "unchecked" ) @ Override public boolean contains ( Object o ) { } @ Override public boolean remove ( Object o ) { } @ Override public int size ( ) { } @ Override public void clear ( ) { } } private void writeObject ( ObjectOutputStream s ) throws IOException { } private static final long serialVersionUID = 362498820763181265L ; @ SuppressWarnings ( "unchecked" ) private void readObject ( ObjectInputStream s ) throws IOException , ClassNotFoundException { } int capacity ( ) { } float loadFactor ( ) { } }

Fix:
return nextEntry ( ) . getKey ( ) ;