public interface Hash<K,V>
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsAny(java.util.function.BiPredicate<K,V> condition)
Check whether this hash contains any key-value pair that satisfies the condition.
|
boolean |
containsKey(K key)
Returns true if this hash contains a mapping for the specified
key.
|
boolean |
containsValue(V value) |
int |
count(V value)
Returns the number of the specified value in this hash.
|
int |
countIf(java.util.function.BiPredicate<K,V> condition)
Returns the number of entries which satisfy the condition.
|
Seq<java.util.Map.Entry<K,V>> |
entrySeq()
Returns a
Seq view of the mappings contained in this hash. |
Hash<K,V> |
filter(java.util.function.BiPredicate<K,V> condition)
Return a new hash with the key-value pairs of the original Hash which satisfy the condition.
|
V |
get(K k) |
Hash<V,K> |
invert()
Returns a new hash created by using hash’s values as keys, and the keys as values.
|
boolean |
isEmpty() |
Seq<K> |
keys()
Returns a
Seq view of the keys contained in this hash. |
Seq<K> |
keysOf(V value)
Returns a Seq of keys of the given value.
|
Hash<K,V> |
merge(Hash<? extends K,? extends V> another)
Returns a new hash containing the mappings of the specified hash and this hash itself.
|
Hash<K,V> |
put(K k,
V v) |
Hash<K,V> |
putIfAbsent(K k,
V v) |
Hash<K,V> |
reject(java.util.function.BiPredicate<K,V> condition)
Return a new hash with the key-value pairs of the original Hash which don't satisfy the condition.
|
Hash<K,V> |
remove(K key)
Removes the mapping for a key from this map if it is present
(optional operation).
|
Hash<K,V> |
remove(K key,
V value)
Removes the entry for the specified key only if it is currently
mapped to the specified value.
|
Hash<K,V> |
replace(K key,
V value)
Replaces the entry for the specified key only if it is
currently mapped to some value.
|
Hash<K,V> |
replace(K key,
V oldValue,
V newValue)
Replaces the entry for the specified key only if currently
mapped to the specified value.
|
Hash<K,V> |
replaceAll(java.util.function.BiFunction<? super K,? super V,? extends V> function)
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.
|
int |
size() |
Seq<V> |
values()
Returns a
Seq view of the values contained in this hash. |
boolean containsAny(java.util.function.BiPredicate<K,V> condition)
condition - the condition used to filter key-value pairs by passing the key and value of the pair,
returns true if the key-value pair satisfies the condition, otherwise returns false.java.lang.NullPointerException - if condition is nullboolean containsKey(K key)
key - key whose presence in this hash is to be testedjava.lang.ClassCastException - if the key is of an inappropriate type for
this mapjava.lang.NullPointerException - if the specified key is null and this map
does not permit null keysboolean containsValue(V value)
boolean isEmpty()
int size()
Seq<V> values()
Seq view of the values contained in this hash.Seq<K> keys()
Seq view of the keys contained in this hash.Seq<java.util.Map.Entry<K,V>> entrySeq()
Seq view of the mappings contained in this hash.Hash<K,V> filter(java.util.function.BiPredicate<K,V> condition)
condition - the condition used to filter key-value pairs by passing the key and value of the pair,
returns true if the key-value pair satisfies the condition, otherwise returns false.java.lang.NullPointerException - if condition is nullHash<K,V> reject(java.util.function.BiPredicate<K,V> condition)
condition - the condition used to filter key-value pairs by passing the key and value of the pair,
returns true if the key-value pair satisfies the condition, otherwise returns false.java.lang.NullPointerException - if condition is nullHash<V,K> invert()
Hash<K,V> merge(Hash<? extends K,? extends V> another)
another - the specified hash to be mergedHash<K,V> remove(K key)
(key==null ? k==null : key.equals(k)), that mapping
is removed. (The map can contain at most one such mapping.)key - key whose mapping is to be removed from the mapjava.lang.UnsupportedOperationException - if the remove operation
is not supported by this hashjava.lang.ClassCastException - if the key is of an inappropriate type for
this hashjava.lang.NullPointerException - if the specified key is null and this
hash does not permit null keysHash<K,V> remove(K key, V value)
key - key with which the specified value is associatedvalue - value expected to be associated with the specified keyjava.lang.UnsupportedOperationException - if the remove operation
is not supported by this hashjava.lang.ClassCastException - if the key or value is of an inappropriate
type for this hashjava.lang.NullPointerException - if the specified key or value is null,
and this map does not permit null keys or valuesSeq<K> keysOf(V value)
value - the valueHash<K,V> replace(K key, V value)
key - key with which the specified value is associatedvalue - value to be associated with the specified keyjava.lang.ClassCastException - if the class of the specified key or value
prevents it from being stored in this hashjava.lang.NullPointerException - if the specified key or value is null,
and this hash does not permit null keys or valuesjava.lang.IllegalArgumentException - if some property of the specified key
or value prevents it from being stored in this hashHash<K,V> replace(K key, V oldValue, V newValue)
key - key with which the specified value is associatedoldValue - value expected to be associated with the specified keynewValue - value to be associated with the specified keyjava.lang.UnsupportedOperationException - if the put operation
is not supported by this hashjava.lang.ClassCastException - if the class of a specified key or value
prevents it from being stored in this hashjava.lang.NullPointerException - if a specified key or newValue is null,
and this hash does not permit null keys or valuesjava.lang.NullPointerException - if oldValue is null and this hash does not
permit null valuesjava.lang.IllegalArgumentException - if some property of a specified key
or value prevents it from being stored in this hashHash<K,V> replaceAll(java.util.function.BiFunction<? super K,? super V,? extends V> function)
function - the function to apply to each entryjava.lang.UnsupportedOperationException - if the set operation
is not supported by this hash's entry set iterator.java.lang.ClassCastException - if the class of a replacement value
prevents it from being stored in this hashjava.lang.NullPointerException - if the specified function is null, or the
specified replacement value is null, and this hash does not permit null
valuesjava.lang.ClassCastException - if a replacement value is of an inappropriate
type for this hashjava.lang.NullPointerException - if function or a replacement value is null,
and this hash does not permit null keys or valuesjava.lang.IllegalArgumentException - if some property of a replacement value
prevents it from being stored in this hashjava.util.ConcurrentModificationException - if an entry is found to be
removed during iterationint count(V value)
value - the value to countint countIf(java.util.function.BiPredicate<K,V> condition)
condition - the condition used to filter entries by passing the key and the value,
returns true if the entry satisfies the condition, otherwise returns false.java.lang.NullPointerException - if condition is null