HashMap implementation based on a
Hash array mapped trie (HAMT).
| Modifier and Type | Field and Description |
|---|---|
| private static final HashMap | |
| private static final long | |
| private final HashArrayMappedTrie |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public <K2, V2> HashMap | bimap(Function<? super K, ? extends K2>
a keyMapper, Function<? super V, ? extends V2> Function that maps the keys of type K to keys of type K2a valueMapper)Function that the values of type V to values of type V2Implements io. Maps this |
| public static < The key type K, The value type V> Collector | Returns: AHashMap Collector.Returns a |
| public static < The key type K, The value type V, Initial T extends V> Collectorjava. elements type | Returns: AHashMap Collector.The key mapper keyMapper)Returns a |
| public static < The key type K, The value type V, Initial T> Collectorjava. elements type | Returns: AHashMap Collector.The key mapper keyMapper, Function<? super T, ? extends V> The value mapper valueMapper)Returns a |
| public Tuple2 | computeIfAbsent(K
key whose presence in this map is to be tested key, Function<? super K, ? extends V> mapping function mappingFunction)Implements io. If the specified key is not already associated with a value, attempts to compute its value using the given mapping function and enters it into this map. |
| public Tuple2 | computeIfPresent(K
key whose presence in this map is to be tested key, BiFunction<? super K, ? super V, ? extends V> remapping function remappingFunction)Implements io. If the value for the specified key is present, attempts to compute a new mapping given the key and its current mapped value. |
| public boolean | containsKey(K
key whose presence in this map is to be tested key)Implements io. Returns |
| private HashMap | |
| public HashMap | distinct()
Implements io. Returns a new version of this which contains no duplicates. |
| public HashMap | distinctBy(Comparator<? super Tuple2<K, V>>
A comparator comparator)Implements io. Returns a new version of this which contains no duplicates. |
| public <U> HashMap | distinctBy(Function<? super Tuple2<K, V>, ? extends U>
A key extractor keyExtractor)Implements io. Returns a new version of this which contains no duplicates. |
| public HashMap | drop(int
The number of elements to drop. n)Implements io. Drops the first n elements of this or all elements, if this length < n. |
| public HashMap | dropRight(int
The number of elements to drop. n)Implements io. Drops the last n elements of this or all elements, if this length < n. |
| public HashMap | dropUntil(Predicate<? super Tuple2<K, V>>
A condition tested subsequently for this elements. predicate)Implements io. Drops elements until the predicate holds for the current element. |
| public HashMap | dropWhile(Predicate<? super Tuple2<K, V>>
A condition tested subsequently for this elements. predicate)Implements io. Drops elements while the predicate holds for the current element. |
| public static <K, V> HashMap | |
| public boolean | equals(Object
an object, may be null o)Overrides java. Implements io. In Vavr there are four basic classes of collections:
|
| public static < The key type K, The value type V> HashMap | Returns: An HashMap of sizen, where each element contains the result supplied by s.The number of elements in the HashMap n, Supplier<? extends Tuple2<? extends K, ? extends V>> The Supplier computing element values s)Returns a HashMap containing tuples returned by |
| public HashMap | filter(BiPredicate<? super K, ? super V>
the predicate used to test elements predicate)Implements io. Returns a new Map consisting of all elements which satisfy the given predicate. |
| public HashMap | filter(Predicate<? super Tuple2<K, V>>
A predicate predicate)Implements io. Returns a new traversable consisting of all elements which satisfy the given predicate. |
| public HashMap | filterKeys(Predicate<? super K>
the predicate used to test keys of elements predicate)Implements io. Returns a new Map consisting of all elements with keys which satisfy the given predicate. |
| public HashMap | filterValues(Predicate<? super V>
the predicate used to test values of elements predicate)Implements io. Returns a new Map consisting of all elements with values which satisfy the given predicate. |
| public <K2, V2> HashMap | flatMap(BiFunction<? super K, ? super V, ? extends Iterable<Tuple2<K2, V2>>>
A mapper mapper)Implements io. FlatMaps this |
| public Option | get(K
the key whose associated value is to be returned key)Implements io. Returns the |
| public V | getOrElse(K
the key key, V a default value defaultValue)Implements io. Returns the value associated with a key, or a default value if the key is not contained in the map. |
| public <C> Map | groupBy(Function<? super Tuple2<K, V>, ? extends C>
A function which classifies elements into classes classifier)Implements io. Groups this elements by classifying the elements. |
| public Iterator | grouped(int
a positive block size size)Implements io. Groups this |
| public int | hashCode()
Overrides java. Implements io. Returns the hash code of this collection. |
| public Tuple2 | head()
Implements io. Returns the first element of a non-empty Traversable. |
| public HashMap | init()
Implements io. Dual of tail(), returning all elements except the last. |
| public Option | initOption()
Implements io. Dual of tailOption(), returning all elements except the last as |
| public boolean | |
| public boolean | isEmpty()
Overrides default io. Checks if this Traversable is empty. |
| public boolean | |
| public Iterator | |
| public Set | |
| public Iterator | keysIterator()
Overrides default io. Returns the keys contained in this map as an iterator. |
| public Tuple2 | |
| public <K2, V2> HashMap | map(BiFunction<? super K, ? super V, Tuple2<K2, V2>>
a mapper)Function that maps entries of type (K, V) to entries of type (K2, V2)Implements io. Maps the entries of this |
| public <K2> HashMap | mapKeys(Function<? super K, ? extends K2>
a keyMapper)Function that maps keys of type V to keys of type V2Implements io. Maps the keys of this |
| public <K2> HashMap | mapKeys(Function<? super K, ? extends K2>
a keyMapper, BiFunction<? super V, ? super V, ? extends V> Function that maps keys of type V to keys of type V2a valueMerge)BiFunction that merges valuesImplements io. Maps the keys of this |
| public <V2> HashMap | mapValues(Function<? super V, ? extends V2>
a valueMapper)Function that maps values of type V to values of type V2Implements io. Maps the values of this |
| public HashMap | merge(Map<? extends K, ? extends V>
the other map that)Implements io. Creates a new map which by merging the entries of |
| public <U extends V> HashMap | merge(Map<? extends K, U>
the other map that, BiFunction<? super V, ? super U, ? extends V> the collision resolution function collisionResolution)Implements io. Creates a new map which by merging the entries of |
| public static < Key type K, Value type V> HashMap | |
| public static < The key type K, The value type V> HashMap | |
| public static < The key type K, The value type V> HashMap | Returns: A new Map containing the given entryA singleton map key. key, V A singleton map value. value)Returns a singleton |
| public static < The key type K, The value type V> HashMap | Returns: A new Map containing the given entriesa key for the map k1, V the value for k1 v1, K a key for the map k2, V the value for k2 v2)Creates a HashMap of the given list of key-value pairs. |
| public static < The key type K, The value type V> HashMap | Returns: A new Map containing the given entriesa key for the map k1, V the value for k1 v1, K a key for the map k2, V the value for k2 v2, K a key for the map k3, V the value for k3 v3)Creates a HashMap of the given list of key-value pairs. |
| public static < The key type K, The value type V> HashMap | Returns: A new Map containing the given entriesa key for the map k1, V the value for k1 v1, K a key for the map k2, V the value for k2 v2, K a key for the map k3, V the value for k3 v3, K a key for the map k4, V the value for k4 v4)Creates a HashMap of the given list of key-value pairs. |
| public static < The key type K, The value type V> HashMap | Returns: A new Map containing the given entriesa key for the map k1, V the value for k1 v1, K a key for the map k2, V the value for k2 v2, K a key for the map k3, V the value for k3 v3, K a key for the map k4, V the value for k4 v4, K a key for the map k5, V the value for k5 v5)Creates a HashMap of the given list of key-value pairs. |
| public static < The key type K, The value type V> HashMap | Returns: A new Map containing the given entriesa key for the map k1, V the value for k1 v1, K a key for the map k2, V the value for k2 v2, K a key for the map k3, V the value for k3 v3, K a key for the map k4, V the value for k4 v4, K a key for the map k5, V the value for k5 v5, K a key for the map k6, V the value for k6 v6)Creates a HashMap of the given list of key-value pairs. |
| public static < The key type K, The value type V> HashMap | Returns: A new Map containing the given entriesa key for the map k1, V the value for k1 v1, K a key for the map k2, V the value for k2 v2, K a key for the map k3, V the value for k3 v3, K a key for the map k4, V the value for k4 v4, K a key for the map k5, V the value for k5 v5, K a key for the map k6, V the value for k6 v6, K a key for the map k7, V the value for k7 v7)Creates a HashMap of the given list of key-value pairs. |
| public static < The key type K, The value type V> HashMap | Returns: A new Map containing the given entriesa key for the map k1, V the value for k1 v1, K a key for the map k2, V the value for k2 v2, K a key for the map k3, V the value for k3 v3, K a key for the map k4, V the value for k4 v4, K a key for the map k5, V the value for k5 v5, K a key for the map k6, V the value for k6 v6, K a key for the map k7, V the value for k7 v7, K a key for the map k8, V the value for k8 v8)Creates a HashMap of the given list of key-value pairs. |
| public static < The key type K, The value type V> HashMap | Returns: A new Map containing the given entriesa key for the map k1, V the value for k1 v1, K a key for the map k2, V the value for k2 v2, K a key for the map k3, V the value for k3 v3, K a key for the map k4, V the value for k4 v4, K a key for the map k5, V the value for k5 v5, K a key for the map k6, V the value for k6 v6, K a key for the map k7, V the value for k7 v7, K a key for the map k8, V the value for k8 v8, K a key for the map k9, V the value for k9 v9)Creates a HashMap of the given list of key-value pairs. |
| public static < The key type K, The value type V> HashMap | Returns: A new Map containing the given entriesa key for the map k1, V the value for k1 v1, K a key for the map k2, V the value for k2 v2, K a key for the map k3, V the value for k3 v3, K a key for the map k4, V the value for k4 v4, K a key for the map k5, V the value for k5 v5, K a key for the map k6, V the value for k6 v6, K a key for the map k7, V the value for k7 v7, K a key for the map k8, V the value for k8 v8, K a key for the map k9, V the value for k9 v9, K a key for the map k10, V the value for k10 v10)Creates a HashMap of the given list of key-value pairs. |
| public static < The key type K, The value type V> HashMap | |
| public static < The stream element type T, The key type K, The value type V> HashMap | |
| public static < The stream element type T, The key type K, The value type V> HashMap | |
| public static < The key type K, The value type V> HashMap | |
| public static < The key type K, The value type V> HashMap | |
| public static < The key type K, The value type V> HashMap | |
| public HashMap | orElse(Iterable<? extends Tuple2<K, V>>
An alternative other)TraversableImplements io. Returns this |
| public HashMap | orElse(Supplier<? extends Iterable<? extends Tuple2<K, V>>>
An alternative supplier)Traversable supplierImplements io. Returns this |
| public Tuple2 | partition(Predicate<? super Tuple2<K, V>>
A predicate which classifies an element if it is in the first or the second traversable. predicate)Implements io. Creates a partition of this |
| public HashMap | peek(Consumer<? super Tuple2<K, V>>
The action that will be performed on the element(s). action)Implements io. Performs the given |
| public <U extends V> HashMap | put(K
key with which the specified value is to be associated key, U value to be associated with the specified key value, BiFunction<? super V, ? super U, ? extends V> function taking the old and new values and merging them. merge)Implements io. Associates the specified value with the specified key in this map. |
| public HashMap | put(K
key with which the specified value is to be associated key, V value to be associated with the specified key value)Implements io. Associates the specified value with the specified key in this map. |
| public HashMap | put(Tuple2<? extends K, ? extends V>
A Tuple2 containing the key and value entry)Implements io. Convenience method for |
| public <U extends V> HashMap | put(Tuple2<? extends K, U>
A Tuple2 containing the key and value entry, BiFunction<? super V, ? super U, ? extends V> function taking the old and new values and merging them. merge)Implements io. Convenience method for |
| private Object | |
| public HashMap | reject(BiPredicate<? super K, ? super V>
the predicate used to test elements predicate)Implements io. Returns a new Map consisting of all elements which do not satisfy the given predicate. |
| public HashMap | reject(Predicate<? super Tuple2<K, V>>
A predicate predicate)Implements io. Returns a new traversable consisting of all elements which do not satisfy the given predicate. |
| public HashMap | rejectKeys(Predicate<? super K>
the predicate used to test keys of elements predicate)Implements io. Returns a new Map consisting of all elements with keys which do not satisfy the given predicate. |
| public HashMap | rejectValues(Predicate<? super V>
the predicate used to test values of elements predicate)Implements io. Returns a new Map consisting of all elements with values which do not satisfy the given predicate. |
| public HashMap | remove(K
key whose mapping is to be removed from the map key)Implements io. Removes the mapping for a key from this map if it is present. |
| public HashMap | removeAll(BiPredicate<? super K, ? super V>
the predicate used to test elements predicate)Implements io.
Deprecated
Returns a new Map consisting of all elements which do not satisfy the given predicate. |
| public HashMap | removeAll(Iterable<? extends K>
keys are to be removed from the map keys)Implements io. Removes the mapping for a key from this map if it is present. |
| public HashMap | removeKeys(Predicate<? super K>
the predicate used to test keys of elements predicate)Implements io.
Deprecated
Returns a new Map consisting of all elements with keys which do not satisfy the given predicate. |
| public HashMap | removeValues(Predicate<? super V>
the predicate used to test values of elements predicate)Implements io.
Deprecated
Returns a new Map consisting of all elements with values which do not satisfy the given predicate. |
| public HashMap | replace(Tuple2<K, V>
An element to be substituted. currentElement, Tuple2<K, V> A replacement for currentElement. newElement)Implements io. Replaces the first occurrence (if exists) of the given currentElement with newElement. |
| public HashMap | replace(K
the key of the element to be substituted. key, V the expected current value that the key is currently mapped to oldValue, V the new value to be associated with the key newValue)Implements io. Replaces the entry for the specified key only if currently mapped to the specified value. |
| public HashMap | replaceAll(Tuple2<K, V>
An element to be substituted. currentElement, Tuple2<K, V> A replacement for currentElement. newElement)Implements io. Replaces all occurrences of the given currentElement with newElement. |
| public HashMap | replaceAll(BiFunction<? super K, ? super V, ? extends V>
function transforming key and current value to a new value function)Implements io. Replaces each entry's value with the result of invoking the given function on that entry until all entries have been processed or the function throws an exception. |
| public HashMap | replaceValue(K
the key of the element to be substituted. key, V the new value to be associated with the key value)Implements io. Replaces the entry for the specified key only if it is currently mapped to some value. |
| public HashMap | retainAll(Iterable<? extends Tuple2<K, V>>
Elements to be kept. elements)Implements io. Keeps all occurrences of the given elements from this. |
| public HashMap | scan(Tuple2<K, V>
neutral element for the operator op zero, BiFunction<? super Tuple2<K, V>, ? super Tuple2<K, V>, ? extends Tuple2<K, V>> the associative operator for the scan operation)Implements io. Computes a prefix scan of the elements of the collection. |
| public int | |
| public Iterator | slideBy(Function<? super Tuple2<K, V>, ?>
A function which classifies elements into classes classifier)Implements io. Slides a non-overlapping window of a variable size over this |
| public Iterator | sliding(int
a positive window size size)Implements io. Slides a window of a specific |
| public Iterator | sliding(int
a positive window size size, int a positive step size step)Implements io. Slides a window of a specific |
| public Tuple2 | span(Predicate<? super Tuple2<K, V>>
A predicate. predicate)Implements io. Returns a tuple where the first element is the longest prefix of elements that satisfy the given
|
| public String | stringPrefix()
Implements io. Returns the name of this Value type, which is used by toString(). |
| public static < The key type K, The value type V> HashMap | Returns: An HashMap consisting of elementsf(0),f(1), ..., f(n - 1)The number of elements in the HashMap n, Function<? super Integer, ? extends Tuple2<? extends K, ? extends V>> The Function computing element values f)Returns an HashMap containing |
| public HashMap | |
| public Option | tailOption()
Implements io. Drops the first element of a non-empty Traversable and returns an |
| public HashMap | take(int
The number of elements to take. n)Implements io. Takes the first n elements of this or all elements, if this length < n. |
| public HashMap | takeRight(int
The number of elements to take. n)Implements io. Takes the last n elements of this or all elements, if this length < n. |
| public HashMap | takeUntil(Predicate<? super Tuple2<K, V>>
A condition tested subsequently for this elements. predicate)Implements io. Takes elements until the predicate holds for the current element. |
| public HashMap | takeWhile(Predicate<? super Tuple2<K, V>>
A condition tested subsequently for the contained elements. predicate)Implements io. Takes elements while the predicate holds for the current element. |
| public HashMap | toJavaMap()
Implements io. Converts this Vavr |
| public String | toString()
Overrides java. Implements io. Clarifies that values have a proper toString() method implemented. |
| public Stream | values()
Implements io. Returns a new |
| public Iterator | valuesIterator()
Overrides default io. Returns the values in this map. |
| private static <K, V> HashMap |