jdk/src/share/classes/java/util/WeakHashMap.java
changeset 23746 ce60f7b62312
parent 22078 bdec5d53e98c
equal deleted inserted replaced
23745:7898c52fcfb4 23746:ce60f7b62312
   757         }
   757         }
   758     }
   758     }
   759 
   759 
   760     private abstract class HashIterator<T> implements Iterator<T> {
   760     private abstract class HashIterator<T> implements Iterator<T> {
   761         private int index;
   761         private int index;
   762         private Entry<K,V> entry = null;
   762         private Entry<K,V> entry;
   763         private Entry<K,V> lastReturned = null;
   763         private Entry<K,V> lastReturned;
   764         private int expectedModCount = modCount;
   764         private int expectedModCount = modCount;
   765 
   765 
   766         /**
   766         /**
   767          * Strong reference needed to avoid disappearance of key
   767          * Strong reference needed to avoid disappearance of key
   768          * between hasNext and next
   768          * between hasNext and next
   769          */
   769          */
   770         private Object nextKey = null;
   770         private Object nextKey;
   771 
   771 
   772         /**
   772         /**
   773          * Strong reference needed to avoid disappearance of key
   773          * Strong reference needed to avoid disappearance of key
   774          * between nextEntry() and any use of the entry
   774          * between nextEntry() and any use of the entry
   775          */
   775          */
   776         private Object currentKey = null;
   776         private Object currentKey;
   777 
   777 
   778         HashIterator() {
   778         HashIterator() {
   779             index = isEmpty() ? 0 : table.length;
   779             index = isEmpty() ? 0 : table.length;
   780         }
   780         }
   781 
   781 
   846         }
   846         }
   847     }
   847     }
   848 
   848 
   849     // Views
   849     // Views
   850 
   850 
   851     private transient Set<Map.Entry<K,V>> entrySet = null;
   851     private transient Set<Map.Entry<K,V>> entrySet;
   852 
   852 
   853     /**
   853     /**
   854      * Returns a {@link Set} view of the keys contained in this map.
   854      * Returns a {@link Set} view of the keys contained in this map.
   855      * The set is backed by the map, so changes to the map are
   855      * The set is backed by the map, so changes to the map are
   856      * reflected in the set, and vice-versa.  If the map is modified
   856      * reflected in the set, and vice-versa.  If the map is modified