public class HashImpl<K,V> extends java.lang.Object implements MutableHash<K,V>
| Modifier | Constructor and Description |
|---|---|
protected |
HashImpl() |
protected |
HashImpl(java.util.Map<? extends K,? extends V> m) |
| 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 k)
Returns true if this hash contains a mapping for the specified
key.
|
boolean |
containsValue(V v) |
Seq<java.util.Map.Entry<K,V>> |
entrySeq()
Returns a
Seq view of the mappings contained in this hash. |
MutableHash<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.
|
MutableHash<K,V> |
filterInPlace(java.util.function.BiPredicate<K,V> condition) |
V |
get(K k) |
MutableHash<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.
|
MutableHash<K,V> |
merge(Hash<? extends K,? extends V> another)
Returns a new hash containing the mappings of the specified hash and this hash itself.
|
MutableHash<K,V> |
mergeInPlace(Hash<? extends K,? extends V> another) |
MutableHash<K,V> |
put(K k,
V v) |
MutableHash<K,V> |
putIfAbsent(K k,
V v) |
MutableHash<K,V> |
putIfAbsentInPlace(K k,
V v) |
MutableHash<K,V> |
putInPlace(K k,
V v) |
MutableHash<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.
|
MutableHash<K,V> |
rejectInPlace(java.util.function.BiPredicate<K,V> condition) |
MutableHash<K,V> |
remove(K k)
Removes the mapping for a key from this map if it is present
(optional operation).
|
MutableHash<K,V> |
removeInPlace(K k) |
int |
size() |
Seq<V> |
values()
Returns a
Seq view of the values contained in this hash. |
public boolean containsAny(java.util.function.BiPredicate<K,V> condition)
HashcontainsAny in interface Hash<K,V>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.public boolean containsKey(K k)
HashcontainsKey in interface Hash<K,V>k - key whose presence in this hash is to be testedpublic boolean containsValue(V v)
containsValue in interface Hash<K,V>public Seq<V> values()
HashSeq view of the values contained in this hash.public Seq<K> keys()
HashSeq view of the keys contained in this hash.public Seq<java.util.Map.Entry<K,V>> entrySeq()
HashSeq view of the mappings contained in this hash.public MutableHash<K,V> put(K k, V v)
public MutableHash<K,V> putIfAbsent(K k, V v)
putIfAbsent in interface Hash<K,V>putIfAbsent in interface MutableHash<K,V>public MutableHash<K,V> filter(java.util.function.BiPredicate<K,V> condition)
Hashfilter in interface Hash<K,V>filter in interface MutableHash<K,V>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.public MutableHash<K,V> reject(java.util.function.BiPredicate<K,V> condition)
Hashreject in interface Hash<K,V>reject in interface MutableHash<K,V>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.public MutableHash<V,K> invert()
Hashpublic MutableHash<K,V> merge(Hash<? extends K,? extends V> another)
Hashpublic MutableHash<K,V> remove(K k)
Hash(key==null ? k==null : key.equals(k)), that mapping
is removed. (The map can contain at most one such mapping.)public MutableHash<K,V> filterInPlace(java.util.function.BiPredicate<K,V> condition)
filterInPlace in interface MutableHash<K,V>public MutableHash<K,V> rejectInPlace(java.util.function.BiPredicate<K,V> condition)
rejectInPlace in interface MutableHash<K,V>public MutableHash<K,V> mergeInPlace(Hash<? extends K,? extends V> another)
mergeInPlace in interface MutableHash<K,V>public MutableHash<K,V> putInPlace(K k, V v)
putInPlace in interface MutableHash<K,V>public MutableHash<K,V> putIfAbsentInPlace(K k, V v)
putIfAbsentInPlace in interface MutableHash<K,V>public MutableHash<K,V> removeInPlace(K k)
removeInPlace in interface MutableHash<K,V>