public class HashMap<K,V> extends AbstractMap<K,V>
HashMap is an implementation of Map based on a hash trie.
The underlying implementation is a port of Scala's HashMap which is an implementation of a hash array mapped trie.
| Constructor and Description |
|---|
HashMap() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(K key)
Returns true if this map contains the specified key.
|
static <K,V> HashMap<K,V> |
empty() |
static <K,V> BuilderFactory<Pair<K,V>,HashMap<K,V>> |
factory() |
<U> void |
forEach(Function<Pair<K,V>,U> f)
All collection methods can be built upon this
forEach definition. |
V |
get(K key)
Returns the value associated with the key or
null if the no value exists with the key specified. |
java.util.Iterator<Pair<K,V>> |
iterator() |
HashMap<K,V> |
put(K key,
V value)
Returns a map with the value specified associated to the key specified.
|
HashMap<K,V> |
remove(K key)
Returns a map with the value associated with the key removed if it exists.
|
int |
size()
Returns the size of the collection.
|
asMap, equals, hashCode, keys, valuesisEmpty, makeString, makeString, to, toArray, toArray, toIndexedList, toSet, toSortedSet, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitisEmpty, makeString, makeString, to, toArray, toArray, toIndexedList, toSet, toSortedSet@NotNull public static <K,V> HashMap<K,V> empty()
@NotNull public static <K,V> BuilderFactory<Pair<K,V>,HashMap<K,V>> factory()
public boolean containsKey(@NotNull
K key)
Map@NotNull public HashMap<K,V> put(@NotNull K key, V value)
MapIf value already exists for the key, it will be replaced.
@Nullable public V get(@NotNull K key)
Mapnull if the no value exists with the key specified.@NotNull public HashMap<K,V> remove(@NotNull K key)
Mappublic int size()
TraversableWarning: infinite collections are possible, as are collections that require traversal to calculate the size.
size in interface Traversable<Pair<K,V>>size in class AbstractTraversable<Pair<K,V>>public <U> void forEach(@NotNull
Function<Pair<K,V>,U> f)
TraversableforEach definition.forEach in interface Traversable<Pair<K,V>>forEach in class AbstractIterable<Pair<K,V>>