Package org.midheaven.collections
Interface EditableAssociation<K,V>
- Type Parameters:
K- the type of the keyV- the type of the value
- All Superinterfaces:
Association<K,,V> Assortment<Association.Entry<K,,V>> Countable,Enumerable<Association.Entry<K,,V>> Iterable<Association.Entry<K,V>>
- All Known Subinterfaces:
ResizableAssociation<K,V>
An
Association that permits changing the values for the present keys, but does not allow
to add more keys or change the ones already associated.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.midheaven.collections.Association
Association.Entry<K,V> -
Method Summary
Modifier and TypeMethodDescriptionvoidcomputeValue(K key, BiFunction<K, V, V> computation) Recomputed the value of a given key delegation to a givencomputation.booleanChanges the value associated with the key.default Association<K, V> Returns an unmodifiable view of thisEditableAssociationMethods inherited from interface org.midheaven.collections.Association
computeValueIfAbsent, containsKey, containsValue, getValue, intersection, keys, toCollection, union, valuesMethods inherited from interface org.midheaven.collections.Assortment
contains, containsAll, count, isEmptyMethods inherited from interface org.midheaven.collections.Enumerable
allMatch, any, anyMatch, as, associate, associate, cast, collect, concat, distinct, enumerator, filter, first, flatMap, groupBy, iterator, limit, map, maximum, minimum, ofType, peek, reduce, reduce, skip, sorted, toArray, toArray, toArray, toDistinctAssortment, toSequence, toSequence, with, zipMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
toUnmodifiable
Returns an unmodifiable view of thisEditableAssociation- Returns:
- an unmodifiable view of this
EditableAssociation
-
setValue
Changes the value associated with the key. If the key is not present, nothing happens.- Parameters:
key-value-- Returns:
trueif the key is present,falseotherwise.
-
computeValue
Recomputed the value of a given key delegation to a givencomputation. If the key is not present, nothing happens.- Parameters:
key- the value keycomputation- a function that receives the key, the old value and returns the new value
-