K - V - public class TypedHashMap<K,V> extends HashMap<K,V>
HashMap that throws UnsupportedOperationException
for calls to HashMap.get(Object), HashMap.remove(Object),
HashMap.containsKey(Object) and HashMap.containsValue(Object).
This class offers versions of these four methods but requiring typed arguments.AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
TypedHashMap() |
TypedHashMap(int initialCapacity) |
TypedHashMap(int initialCapacity,
float loadFactor) |
TypedHashMap(Map<? extends K,? extends V> map) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
V |
get(Object key) |
V |
getValue(K key)
Typed version of
HashMap.get(Object). |
boolean |
hasKey(K key)
Typed version of
HashMap.containsKey(Object). |
boolean |
hasValue(V value)
Typed version of
HashMap.containsValue(Object). |
V |
remove(Object key) |
V |
removeEntry(K key)
Typed version of
HashMap.remove(Object). |
clear, clone, compute, computeIfAbsent, computeIfPresent, entrySet, forEach, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, replace, replace, replaceAll, size, valuesequals, hashCode, toStringpublic TypedHashMap()
public TypedHashMap(int initialCapacity)
public TypedHashMap(int initialCapacity,
float loadFactor)
public V getValue(K key)
HashMap.get(Object).public V removeEntry(K key)
HashMap.remove(Object).public boolean hasKey(K key)
HashMap.containsKey(Object).public boolean containsKey(Object key)
containsKey in interface Map<K,V>containsKey in class HashMap<K,V>UnsupportedOperationExceptionpublic boolean hasValue(V value)
HashMap.containsValue(Object).public boolean containsValue(Object value)
containsValue in interface Map<K,V>containsValue in class HashMap<K,V>UnsupportedOperationExceptionCopyright © 2015–2021 Fiji. All rights reserved.