@Test public void testContainsValue(){ Assert.assertFalse(shortMap.containsValue("Example0", false)); Assert.assertFalse(shortMap.containsValue("Example34", false)); Assert.assertFalse(shortMap.containsValue("NewExample123", false)); Assert.assertFalse(shortMap.containsValue("ThisValueShouldNotBePresent", false)); testAdd(); Assert.assertTrue(shortMap.containsValue("Example0", false)); Assert.assertTrue(shortMap.containsValue("Example34", false)); Assert.assertTrue(shortMap.containsValue("NewExample123", false)); Assert.assertFalse(shortMap.containsValue("ThisValueShouldNotBePresent", false)); shortMap.clear(); Assert.assertFalse(shortMap.containsKey((short) 0)); Assert.assertFalse(shortMap.containsKey((short) 34)); Assert.assertFalse(shortMap.containsKey((short) 123)); Assert.assertFalse(shortMap.containsKey((short) 200)); }
public boolean containsValue (Object value, boolean identity) { V[] valueTable = this.valueTable; if (value == null) { if (hasZeroValue && zeroValue == null) return true; short[] keyTable = this.keyTable; for (int i = capacity + stashSize; i-- > 0;) if (keyTable[i] != EMPTY && valueTable[i] == null) return true; } else if (identity) { if (value == zeroValue) return true; for (int i = capacity + stashSize; i-- > 0;) if (valueTable[i] == value) return true; } else { if (hasZeroValue && value.equals(zeroValue)) return true; for (int i = capacity + stashSize; i-- > 0;) if (value.equals(valueTable[i])) return true; } return false; }
ShortMap implements Iterable<ShortMap.Entry<V>> { public boolean containsValue (Object value, boolean identity) { V[] valueTable = this.valueTable; if (value == null) { if (hasZeroValue && zeroValue == null) return true; short[] keyTable = this.keyTable; for (int i = capacity + stashSize; i-- > 0;) if (keyTable[i] != EMPTY && valueTable[i] == null) return true; } else if (identity) { if (value == zeroValue) return true; for (int i = capacity + stashSize; i-- > 0;) if (valueTable[i] == value) return true; } else { if (hasZeroValue && value.equals(zeroValue)) return true; for (int i = capacity + stashSize; i-- > 0;) if (value.equals(valueTable[i])) return true; } return false; } }
ShortMap implements Iterable<ShortMap.Entry<V>> { public boolean containsValue (Object value, boolean identity) { V[] valueTable = this.valueTable; if (value == null) { if (hasZeroValue && zeroValue == null) return true; short[] keyTable = this.keyTable; for (int i = capacity + stashSize; i-- > 0;) if (keyTable[i] != EMPTY && valueTable[i] == null) return true; } else if (identity) { if (value == zeroValue) return true; for (int i = capacity + stashSize; i-- > 0;) if (valueTable[i] == value) return true; } else { if (hasZeroValue && value.equals(zeroValue)) return true; for (int i = capacity + stashSize; i-- > 0;) if (value.equals(valueTable[i])) return true; } return false; } ShortMap();  ShortMap(int initialCapacity);  ShortMap(int initialCapacity, float loadFactor);  ShortMap(ShortMap<? extends V> map); }
ShortMap implements Iterable<ShortMap.Entry<V>> { public boolean containsValue (Object value, boolean identity) { V[] valueTable = this.valueTable; if (value == null) { if (hasZeroValue && zeroValue == null) return true; short[] keyTable = this.keyTable; for (int i = capacity + stashSize; i-- > 0;) if (keyTable[i] != EMPTY && valueTable[i] == null) return true; } else if (identity) { if (value == zeroValue) return true; for (int i = capacity + stashSize; i-- > 0;) if (valueTable[i] == value) return true; } else { if (hasZeroValue && value.equals(zeroValue)) return true; for (int i = capacity + stashSize; i-- > 0;) if (value.equals(valueTable[i])) return true; } return false; } ShortMap();  ShortMap(int initialCapacity);  ShortMap(int initialCapacity, float loadFactor);  ShortMap(ShortMap<? extends V> map); V put(short key, V value); void putAll(ShortMap<V> map); V get(short key); V get(short key, V defaultValue); V remove(short key); void shrink(int maximumCapacity); void clear(int maximumCapacity); void clear(); boolean containsValue(Object value, boolean identity); boolean containsKey(short key); short findKey(Object value, boolean identity, short notFound); void ensureCapacity(int additionalCapacity); int hashCode(); boolean equals(Object obj); String toString(); Iterator<Entry<V>> iterator(); Entries<V> entries(); Values<V> values(); Keys keys(); }
ShortMap implements Iterable<ShortMap.Entry<V>> { public boolean containsValue (Object value, boolean identity) { V[] valueTable = this.valueTable; if (value == null) { if (hasZeroValue && zeroValue == null) return true; short[] keyTable = this.keyTable; for (int i = capacity + stashSize; i-- > 0;) if (keyTable[i] != EMPTY && valueTable[i] == null) return true; } else if (identity) { if (value == zeroValue) return true; for (int i = capacity + stashSize; i-- > 0;) if (valueTable[i] == value) return true; } else { if (hasZeroValue && value.equals(zeroValue)) return true; for (int i = capacity + stashSize; i-- > 0;) if (value.equals(valueTable[i])) return true; } return false; } ShortMap();  ShortMap(int initialCapacity);  ShortMap(int initialCapacity, float loadFactor);  ShortMap(ShortMap<? extends V> map); V put(short key, V value); void putAll(ShortMap<V> map); V get(short key); V get(short key, V defaultValue); V remove(short key); void shrink(int maximumCapacity); void clear(int maximumCapacity); void clear(); boolean containsValue(Object value, boolean identity); boolean containsKey(short key); short findKey(Object value, boolean identity, short notFound); void ensureCapacity(int additionalCapacity); int hashCode(); boolean equals(Object obj); String toString(); Iterator<Entry<V>> iterator(); Entries<V> entries(); Values<V> values(); Keys keys(); public int size; }