equal
deleted
inserted
replaced
761 * |
761 * |
762 * Subclass overrides this to alter the behavior of put method. |
762 * Subclass overrides this to alter the behavior of put method. |
763 */ |
763 */ |
764 void addEntry(int hash, K key, V value, int bucketIndex) { |
764 void addEntry(int hash, K key, V value, int bucketIndex) { |
765 Entry<K,V> e = table[bucketIndex]; |
765 Entry<K,V> e = table[bucketIndex]; |
766 table[bucketIndex] = new Entry<K,V>(hash, key, value, e); |
766 table[bucketIndex] = new Entry<>(hash, key, value, e); |
767 if (size++ >= threshold) |
767 if (size++ >= threshold) |
768 resize(2 * table.length); |
768 resize(2 * table.length); |
769 } |
769 } |
770 |
770 |
771 /** |
771 /** |
776 * Subclass overrides this to alter the behavior of HashMap(Map), |
776 * Subclass overrides this to alter the behavior of HashMap(Map), |
777 * clone, and readObject. |
777 * clone, and readObject. |
778 */ |
778 */ |
779 void createEntry(int hash, K key, V value, int bucketIndex) { |
779 void createEntry(int hash, K key, V value, int bucketIndex) { |
780 Entry<K,V> e = table[bucketIndex]; |
780 Entry<K,V> e = table[bucketIndex]; |
781 table[bucketIndex] = new Entry<K,V>(hash, key, value, e); |
781 table[bucketIndex] = new Entry<>(hash, key, value, e); |
782 size++; |
782 size++; |
783 } |
783 } |
784 |
784 |
785 private abstract class HashIterator<E> implements Iterator<E> { |
785 private abstract class HashIterator<E> implements Iterator<E> { |
786 Entry<K,V> next; // next entry to return |
786 Entry<K,V> next; // next entry to return |