staticinthash(inth){// This function ensures that hashCodes that differ only by// constant multiples at each bit position have a bounded// number of collisions (approximately 8 at default load factor).h^=(h>>>20)^(h>>>12);returnh^(h>>>7)^(h>>>4);}
privateabstractclassHashIterator<E>implementsIterator<E>{Entry<K,V>next;// next entry to returnintexpectedModCount;// For fast-failintindex;// current slotEntry<K,V>current;// current entryHashIterator(){expectedModCount=modCount;if(size>0){// advance to first entryEntry[]t=table;while(index<t.length&&(next=t[index++])==null);}}publicfinalbooleanhasNext(){returnnext!=null;}finalEntry<K,V>nextEntry(){if(modCount!=expectedModCount)thrownewConcurrentModificationException();Entry<K,V>e=next;if(e==null)thrownewNoSuchElementException();if((next=e.next)==null){Entry[]t=table;while(index<t.length&&(next=t[index++])==null);}current=e;returne;}publicvoidremove(){if(current==null)thrownewIllegalStateException();if(modCount!=expectedModCount)thrownewConcurrentModificationException();Objectk=current.key;current=null;HashMap.this.removeEntryForKey(k);expectedModCount=modCount;}}