Lines Matching refs:key

37  * <tt>null</tt> values and the <tt>null</tt> key.  (The <tt>HashMap</tt>
48 * of key-value mappings). Thus, it's very important not to set the initial
83 * associated with a key that an instance already contains is not a
162 * The number of key-value mappings contained in this map.
311 * Returns the number of key-value mappings in this map.
313 * @return the number of key-value mappings in this map
320 * Returns <tt>true</tt> if this map contains no key-value mappings.
322 * @return <tt>true</tt> if this map contains no key-value mappings
329 * Returns the value to which the specified key is mapped,
330 * or {@code null} if this map contains no mapping for the key.
332 * <p>More formally, if this map contains a mapping from a key
333 * {@code k} to a value {@code v} such that {@code (key==null ? k==null :
334 * key.equals(k))}, then this method returns {@code v}; otherwise
338 * indicate that the map contains no mapping for the key; it's also
339 * possible that the map explicitly maps the key to {@code null}.
345 public V get(Object key) {
346 if (key == null)
348 Entry<K,V> entry = getEntry(key);
365 if (e.key == null)
373 * specified key.
375 * @param key The key whose presence in this map is to be tested
377 * key.
379 public boolean containsKey(Object key) {
380 return getEntry(key) != null;
384 * Returns the entry associated with the specified key in the
386 * for the key.
388 final Entry<K,V> getEntry(Object key) {
393 int hash = (key == null) ? 0 : sun.misc.Hashing.singleWordWangJenkinsHash(key);
399 ((k = e.key) == key || (key != null && key.equals(k))))
406 * Associates the specified value with the specified key in this map.
407 * If the map previously contained a mapping for the key, the old
410 * @param key key with which the specified value is to be associated
411 * @param value value to be associated with the specified key
412 * @return the previous value associated with <tt>key</tt>, or
413 * <tt>null</tt> if there was no mapping for <tt>key</tt>.
415 * previously associated <tt>null</tt> with <tt>key</tt>.)
417 public V put(K key, V value) {
421 if (key == null)
423 int hash = sun.misc.Hashing.singleWordWangJenkinsHash(key);
427 if (e.hash == hash && ((k = e.key) == key || key.equals(k))) {
436 addEntry(hash, key, value, i);
445 if (e.key == null) {
463 private void putForCreate(K key, V value) {
464 int hash = null == key ? 0 : sun.misc.Hashing.singleWordWangJenkinsHash(key);
468 * Look for preexisting entry for key. This will never happen for
475 ((k = e.key) == key || (key != null && key.equals(k)))) {
481 createEntry(hash, key, value, i);
575 * Removes the mapping for the specified key from this map if present.
577 * @param key key whose mapping is to be removed from the map
578 * @return the previous value associated with <tt>key</tt>, or
579 * <tt>null</tt> if there was no mapping for <tt>key</tt>.
581 * previously associated <tt>null</tt> with <tt>key</tt>.)
583 public V remove(Object key) {
584 Entry<K,V> e = removeEntryForKey(key);
589 * Removes and returns the entry associated with the specified key
591 * for this key.
593 final Entry<K,V> removeEntryForKey(Object key) {
597 int hash = (key == null) ? 0 : sun.misc.Hashing.singleWordWangJenkinsHash(key);
606 ((k = e.key) == key || (key != null && key.equals(k)))) {
632 Object key = entry.getKey();
633 int hash = (key == null) ? 0 : sun.misc.Hashing.singleWordWangJenkinsHash(key);
731 final K key;
742 key = k;
747 return key;
785 * overwritten by an invocation of put(k,v) for a key k that's already
800 * Adds a new entry with the specified key, value and hash code to
806 void addEntry(int hash, K key, V value, int bucketIndex) {
809 hash = (null != key) ? sun.misc.Hashing.singleWordWangJenkinsHash(key) : 0;
813 createEntry(hash, key, value, bucketIndex);
824 void createEntry(int hash, K key, V value, int bucketIndex) {
826 table[bucketIndex] = new HashMapEntry<>(hash, key, value, e);
870 Object k = current.key;
969 action.accept(p.key);
988 K k = current.key;
1213 action.accept(e.key);
1359 action.accept(e.key, e.value);
1379 e.value = function.apply(e.key, e.value);
1393 * <i>size</i> (an int, the number of key-value
1394 * mappings), followed by the key (Object) and value (Object)
1395 * for each key-value mapping. The key-value mappings are
1468 K key = (K) s.readObject();
1470 putForCreate(key, value);
1475 public boolean replace(K key, V oldValue, V newValue) {
1477 if ((e = (HashMapEntry)getEntry(key)) != null &&