K
- The type of the keyV
- The type of the valuepublic interface ImmutableMapValue<K,V> extends ImmutableValue<Map<K,V>>
ImmutableValue
that is different
from an ImmutableCollectionValue
such that the "elements" are
Map.Entry
. Usually, this type of value is used to represent
a particular "type" of "key" that is associated to a particular "value".Modifier and Type | Method and Description |
---|---|
MapValue<K,V> |
asMutable()
Creates a mutable
Value for this ImmutableValue . |
boolean |
containsKey(K key)
Checks if the provided key is contained within this map.
|
boolean |
containsValue(V value)
Checks if the provided value is contained within this map.
|
ImmutableSet<Map.Entry<K,V>> |
entrySet()
Retrieves an
ImmutableSet of the Map.Entry s contained
within this map value. |
ImmutableSet<K> |
keySet()
Gets an
ImmutableSet of all keys contained in this map value. |
int |
size()
Gets the size of this map.
|
ImmutableMapValue<K,V> |
transform(Function<Map<K,V>,Map<K,V>> function)
Retrieves the underlying value for this
ImmutableValue and
applies the given Function onto that value, after which, the
product is sent to a new ImmutableValue replacing this one. |
ImmutableCollection<V> |
values()
Retrieves an
ImmutableCollection of all available values within
this map. |
ImmutableMapValue<K,V> |
with(K key,
V value)
Associates the provided key to the provided value in the new map.
|
ImmutableMapValue<K,V> |
with(Map<K,V> value)
Creates a new
ImmutableValue with the given E typed
value, such that if the owning ValueContainer is immutable, the
ValueContainer too is recreated as a new instance with the new
ImmutableValue . |
ImmutableMapValue<K,V> |
withAll(Map<K,V> map)
Associates all provided
Map.Entry along with all pre-existing
map entries in a new ImmutableMapValue . |
ImmutableMapValue<K,V> |
without(K key)
Creates a new
ImmutableMapValue without the provided key and the
associated value. |
ImmutableMapValue<K,V> |
withoutAll(Iterable<K> keys)
Creates a new
ImmutableMapValue without the provided keys and
their associated values. |
ImmutableMapValue<K,V> |
withoutAll(Predicate<Map.Entry<K,V>> predicate)
Creates a new
ImmutableMapValue such that all entries are
filtered by the provided Predicate , any that return
true are retained in the new value. |
int size()
ImmutableMapValue<K,V> with(K key, V value)
key
- The key to associate to the valuevalue
- The value associated with the keyImmutableMapValue<K,V> with(Map<K,V> value)
ImmutableValue
ImmutableValue
with the given E
typed
value, such that if the owning ValueContainer
is immutable, the
ValueContainer
too is recreated as a new instance with the new
ImmutableValue
.with
in interface ImmutableValue<Map<K,V>>
value
- The value to replaceValueContainer
, a new instance if it too is
immutableImmutableMapValue<K,V> withAll(Map<K,V> map)
Map.Entry
along with all pre-existing
map entries in a new ImmutableMapValue
.map
- The map of key values to setImmutableMapValue<K,V> without(K key)
ImmutableMapValue
without the provided key and the
associated value.key
- The key to exclude the associationImmutableMapValue<K,V> withoutAll(Iterable<K> keys)
ImmutableMapValue
without the provided keys and
their associated values.keys
- The keys to excludeImmutableMapValue<K,V> withoutAll(Predicate<Map.Entry<K,V>> predicate)
ImmutableMapValue
such that all entries are
filtered by the provided Predicate
, any that return
true
are retained in the new value. Elements that return
true
from Predicate.test(Object)
are kept, and
those that return false
are excluded.predicate
- The predicate to filterboolean containsKey(K key)
key
- The key to checkboolean containsValue(V value)
value
- The value to checkImmutableSet<K> keySet()
ImmutableSet
of all keys contained in this map value.ImmutableSet<Map.Entry<K,V>> entrySet()
ImmutableSet
of the Map.Entry
s contained
within this map value.ImmutableCollection<V> values()
ImmutableCollection
of all available values within
this map.ImmutableMapValue<K,V> transform(Function<Map<K,V>,Map<K,V>> function)
ImmutableValue
ImmutableValue
and
applies the given Function
onto that value, after which, the
product is sent to a new ImmutableValue
replacing this one.
If the ValueContainer
too is immutable, a new instance of
the ValueContainer
may be created. If the ValueContainer
is mutable, the same instance of the ValueContainer
is retained.
transform
in interface ImmutableValue<Map<K,V>>
function
- The function to apply onto the existing valueValueContainer
, a new instance if it too is
immutableMapValue<K,V> asMutable()
ImmutableValue
Value
for this ImmutableValue
.asMutable
in interface ImmutableValue<Map<K,V>>