Class HashMap<K,V>
java.lang.Object
com.github.andrewoma.dexx.collection.internal.base.AbstractTraversable<Pair<K,V>>
com.github.andrewoma.dexx.collection.internal.base.AbstractIterable<Pair<K,V>>
com.github.andrewoma.dexx.collection.internal.base.AbstractMap<K,V>
com.github.andrewoma.dexx.collection.HashMap<K,V>
- All Implemented Interfaces:
Iterable<Pair<K,,V>> Map<K,,V> Traversable<Pair<K,,V>> Iterable<Pair<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.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CompactHashMap<K, Pair<K, V>> private static final HashMapprivate static final KeyFunction -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(K key) Returns true if this map contains the specified key.static <K,V> @NotNull HashMap <K, V> empty()static <K,V> @NotNull BuilderFactory <Pair<K, V>, HashMap<K, V>> factory()<U> voidAll collection methods can be built upon thisforEachdefinition.Returns the value associated with the key ornullif the no value exists with the key specified.iterator()private KeyFunction<K, Pair<K, V>> Returns a map with the value specified associated to the key specified.Returns a map with the value associated with the key removed if it exists.intsize()Returns the size of the collection.Methods inherited from class com.github.andrewoma.dexx.collection.internal.base.AbstractMap
asMap, equals, hashCode, keys, valuesMethods inherited from class com.github.andrewoma.dexx.collection.internal.base.AbstractTraversable
isEmpty, makeString, makeString, to, toArray, toArray, toIndexedList, toSet, toSortedSet, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface com.github.andrewoma.dexx.collection.Traversable
isEmpty, makeString, makeString, to, toArray, toArray, toIndexedList, toSet, toSortedSet
-
Field Details
-
EMPTY
-
keyFunction
-
compactHashMap
-
-
Constructor Details
-
HashMap
public HashMap() -
HashMap
-
-
Method Details
-
empty
-
factory
-
keyFunction
-
containsKey
Description copied from interface:MapReturns true if this map contains the specified key. -
put
Description copied from interface:MapReturns a map with the value specified associated to the key specified.If value already exists for the key, it will be replaced.
-
get
Description copied from interface:MapReturns the value associated with the key ornullif the no value exists with the key specified. -
remove
Description copied from interface:MapReturns a map with the value associated with the key removed if it exists. -
size
public int size()Description copied from interface:TraversableReturns the size of the collection.Warning: infinite collections are possible, as are collections that require traversal to calculate the size.
- Specified by:
sizein interfaceTraversable<K>- Overrides:
sizein classAbstractTraversable<Pair<K,V>>
-
forEach
Description copied from interface:TraversableAll collection methods can be built upon thisforEachdefinition.- Specified by:
forEachin interfaceTraversable<K>- Overrides:
forEachin classAbstractIterable<Pair<K,V>>
-
iterator
-