Lines Matching refs:key

60  * <tt>null</tt> values and the <tt>null</tt> key.  This class makes no
71 * number of key-value mappings that the map is expected to hold. Internally,
76 * <p>If the size of the map (the number of key-value mappings) sufficiently
90 * associated with a key that an instance already contains is not a
172 * The number of key-value mappings contained in this identity hash map.
194 * Use NULL_KEY for key if it is null.
196 private static Object maskNull(Object key) {
197 return (key == null ? NULL_KEY : key);
201 * Returns internal representation of null key back to caller as null.
203 private static Object unmaskNull(Object key) {
204 return (key == NULL_KEY ? null : key);
217 * Putting more than the expected number of key-value mappings into
283 * Returns the number of key-value mappings in this identity hash map.
285 * @return the number of key-value mappings in this map
292 * Returns <tt>true</tt> if this identity hash map contains no key-value
295 * @return <tt>true</tt> if this identity hash map contains no key-value
319 * Returns the value to which the specified key is mapped,
320 * or {@code null} if this map contains no mapping for the key.
322 * <p>More formally, if this map contains a mapping from a key
323 * {@code k} to a value {@code v} such that {@code (key == k)},
328 * indicate that the map contains no mapping for the key; it's also
329 * possible that the map explicitly maps the key to {@code null}.
336 public V get(Object key) {
337 Object k = maskNull(key);
352 * Tests whether the specified object reference is a key in this identity
355 * @param key possible key
356 * @return <code>true</code> if the specified object reference is a key
360 public boolean containsKey(Object key) {
361 Object k = maskNull(key);
394 * Tests if the specified key-value mapping is in the map.
396 * @param key possible key
398 * @return <code>true</code> if and only if the specified key-value
401 private boolean containsMapping(Object key, Object value) {
402 Object k = maskNull(key);
417 * Associates the specified value with the specified key in this identity
418 * hash map. If the map previously contained a mapping for the key, the
421 * @param key the key with which the specified value is to be associated
422 * @param value the value to be associated with the specified key
423 * @return the previous value associated with <tt>key</tt>, or
424 * <tt>null</tt> if there was no mapping for <tt>key</tt>.
426 * previously associated <tt>null</tt> with <tt>key</tt>.)
431 public V put(K key, V value) {
432 Object k = maskNull(key);
480 Object key = oldTable[j];
481 if (key != null) {
485 int i = hash(key, newLength);
488 newTable[i] = key;
515 * Removes the mapping for this key from this map if present.
517 * @param key key whose mapping is to be removed from the map
518 * @return the previous value associated with <tt>key</tt>, or
519 * <tt>null</tt> if there was no mapping for <tt>key</tt>.
521 * previously associated <tt>null</tt> with <tt>key</tt>.)
523 public V remove(Object key) {
524 Object k = maskNull(key);
549 * Removes the specified key-value mapping from the map if it is present.
551 * @param key possible key
553 * @return <code>true</code> if and only if the specified key-value
556 private boolean removeMapping(Object key, Object value) {
557 Object k = maskNull(key);
691 Object key = tab[i];
692 if (key != null) {
693 Object k = unmaskNull(key);
728 Object key = tab[i];
729 if (key != null) {
779 Object key = tab[d];
786 IdentityHashMap.this.remove(key);
1015 for (K key : this)
1016 result += System.identityHashCode(key);
1031 Object key;
1032 if ((key = tab[si]) != null) { // key present ?
1037 a[ti++] = (T) unmaskNull(key); // unmask key
1118 if (tab[si] != null) { // key present ?
1156 * returned by this method define key and value equality as
1240 Object key;
1241 if ((key = tab[si]) != null) { // key present ?
1246 a[ti++] = (T) new AbstractMap.SimpleEntry<>(unmaskNull(key), tab[si + 1]);
1272 * @serialData The <i>size</i> of the HashMap (the number of key-value
1273 * mappings) (<tt>int</tt>), followed by the key (Object) and
1274 * value (Object) for each key-value mapping represented by the
1275 * IdentityHashMap. The key-value mappings are emitted in no
1289 Object key = tab[i];
1290 if (key != null) {
1291 s.writeObject(unmaskNull(key));
1315 K key = (K) s.readObject();
1318 putForCreate(key, value);
1326 private void putForCreate(K key, V value)
1329 Object k = maskNull(key);
1437 int i, hi, mc; Object key;
1442 if ((key = a[i]) != null)
1443 action.accept((K)unmaskNull(key));
1458 Object key = a[index];
1460 if (key != null) {
1461 action.accept((K)unmaskNull(key));
1515 Object key = a[index];
1518 if (key != null) {
1557 Object key = a[i];
1558 if (key != null) {
1560 (K)unmaskNull(key);
1579 Object key = a[index];
1582 if (key != null) {
1584 (K)unmaskNull(key);