/** * Associates the specified value with the specified key in this map. * If the map previously contained a mapping for this key, the old * value is replaced. * * @param key key with which the specified value is to be associated. * @param value value to be associated with the specified key. * @return previous value associated with specified key, or <tt>null</tt> * if there was no mapping for key. A <tt>null</tt> return can * also indicate that the HashMap previously associated * <tt>null</tt> with the specified key. */ @Override public V put(final K key, final V value) { final K k = maskNull(key); final int hash = keyComparatorHash(k); final int i = indexFor(hash, table.length); for (Entry<K, V> e = table[i]; e != null; e = e.next) { if (e.hash == hash && keyComparatorEq(k, e.key)) { final V oldValue = e.value; e.value = value; e.recordAccess(this); return oldValue; } } modCount++; addEntry(hash, k, value, i); return null; }
/** * Associates the specified value with the specified key in this map. * If the map previously contained a mapping for this key, the old * value is replaced. * * @param key key with which the specified value is to be associated. * @param value value to be associated with the specified key. * @return previous value associated with specified key, or <tt>null</tt> * if there was no mapping for key. A <tt>null</tt> return can * also indicate that the HashMap previously associated * <tt>null</tt> with the specified key. */ @Override public V put(final K key, final V value) { final K k = maskNull(key); final int hash = keyComparatorHash(k); final int i = indexFor(hash, table.length); for (Entry<K, V> e = table[i]; e != null; e = e.next) { if (e.hash == hash && keyComparatorEq(k, e.key)) { final V oldValue = e.value; e.value = value; e.recordAccess(this); return oldValue; } } modCount++; addEntry(hash, k, value, i); return null; }
/** * Associates the specified value with the specified key in this map. * If the map previously contained a mapping for this key, the old * value is replaced. * * @param key key with which the specified value is to be associated. * @param value value to be associated with the specified key. * @return previous value associated with specified key, or <tt>null</tt> * if there was no mapping for key. A <tt>null</tt> return can * also indicate that the HashMap previously associated * <tt>null</tt> with the specified key. */ @Override public V put(final K key, final V value) { final K k = maskNull(key); final int hash = keyComparatorHash(k); final int i = indexFor(hash, table.length); for (Entry<K, V> e = table[i]; e != null; e = e.next) { if (e.hash == hash && keyComparatorEq(k, e.key)) { final V oldValue = e.value; e.value = value; e.recordAccess(this); return oldValue; } } modCount++; addEntry(hash, k, value, i); return null; }
/** * Associates the specified value with the specified key in this map. * If the map previously contained a mapping for this key, the old * value is replaced. * * @param key key with which the specified value is to be associated. * @param value value to be associated with the specified key. * @return previous value associated with specified key, or <tt>null</tt> * if there was no mapping for key. A <tt>null</tt> return can * also indicate that the HashMap previously associated * <tt>null</tt> with the specified key. */ @Override public V put(final K key, final V value) { final K k = maskNull(key); final int hash = keyComparatorHash(k); final int i = indexFor(hash, table.length); for (Entry<K, V> e = table[i]; e != null; e = e.next) { if (e.hash == hash && keyComparatorEq(k, e.key)) { final V oldValue = e.value; e.value = value; e.recordAccess(this); return oldValue; } } modCount++; addEntry(hash, k, value, i); return null; }
/** * Associates the specified value with the specified key in this map. * If the map previously contained a mapping for this key, the old * value is replaced. * * @param key key with which the specified value is to be associated. * @param value value to be associated with the specified key. * @return previous value associated with specified key, or <tt>null</tt> * if there was no mapping for key. A <tt>null</tt> return can * also indicate that the HashMap previously associated * <tt>null</tt> with the specified key. */ @Override public V put(final K key, final V value) { final K k = maskNull(key); final int hash = keyComparatorHash(k); final int i = indexFor(hash, table.length); for (Entry<K, V> e = table[i]; e != null; e = e.next) { if (e.hash == hash && keyComparatorEq(k, e.key)) { final V oldValue = e.value; e.value = value; e.recordAccess(this); return oldValue; } } modCount++; addEntry(hash, k, value, i); return null; }
/** * Associates the specified value with the specified key in this map. * If the map previously contained a mapping for this key, the old * value is replaced. * * @param key key with which the specified value is to be associated. * @param value value to be associated with the specified key. * @return previous value associated with specified key, or <tt>null</tt> * if there was no mapping for key. A <tt>null</tt> return can * also indicate that the HashMap previously associated * <tt>null</tt> with the specified key. */ @Override public V put(final K key, final V value) { final K k = maskNull(key); final int hash = keyComparatorHash(k); final int i = indexFor(hash, table.length); for (Entry<K, V> e = table[i]; e != null; e = e.next) { if (e.hash == hash && keyComparatorEq(k, e.key)) { final V oldValue = e.value; e.value = value; e.recordAccess(this); return oldValue; } } modCount++; addEntry(hash, k, value, i); return null; }
/** * Associates the specified value with the specified key in this map. * If the map previously contained a mapping for this key, the old * value is replaced. * * @param key key with which the specified value is to be associated. * @param value value to be associated with the specified key. * @return previous value associated with specified key, or <tt>null</tt> * if there was no mapping for key. A <tt>null</tt> return can * also indicate that the HashMap previously associated * <tt>null</tt> with the specified key. */ @Override public V put(final K key, final V value) { final K k = maskNull(key); final int hash = keyComparatorHash(k); final int i = indexFor(hash, table.length); for (Entry<K, V> e = table[i]; e != null; e = e.next) { if (e.hash == hash && keyComparatorEq(k, e.key)) { final V oldValue = e.value; e.value = value; e.recordAccess(this); return oldValue; } } modCount++; addEntry(hash, k, value, i); return null; }