/** * Put a value into the map. Any previous mapping is discarded silently. * * @param key the key * @param value the value to store */ public void put(T key, int value) { final Object[] keys = this.keys; final int mask = keys.length - 1; final int[] values = this.values; Object v; int hc = System.identityHashCode(key) & mask; for (int idx = hc;; idx = hc++ & mask) { v = keys[idx]; if (v == null) { keys[idx] = key; values[idx] = value; if (++count > resizeCount) { resize(); } return; } if (v == key) { values[idx] = value; return; } } }
/** * Put a value into the map. Any previous mapping is discarded silently. * * @param key the key * @param value the value to store */ public void put(T key, int value) { final Object[] keys = this.keys; final int mask = keys.length - 1; final int[] values = this.values; Object v; int hc = System.identityHashCode(key) & mask; for (int idx = hc;; idx = hc++ & mask) { v = keys[idx]; if (v == null) { keys[idx] = key; values[idx] = value; if (++count > resizeCount) { resize(); } return; } if (v == key) { values[idx] = value; return; } } }
/** * Put a value into the map. Any previous mapping is discarded silently. * * @param key the key * @param value the value to store */ public void put(T key, int value) { final Object[] keys = this.keys; final int mask = keys.length - 1; final int[] values = this.values; Object v; int hc = System.identityHashCode(key) & mask; for (int idx = hc;; idx = hc++ & mask) { v = keys[idx]; if (v == null) { keys[idx] = key; values[idx] = value; if (++count > resizeCount) { resize(); } return; } if (v == key) { values[idx] = value; return; } } }