HCOLL-81 make it clear that mapForKey is read only as it uses a Function and updateForKey is read/write and takes a mutator.

This commit is contained in:
Peter Lawrey
2014-11-15 12:56:37 +00:00
parent 80ba83a669
commit 3750bc4f8e
7 changed files with 120 additions and 35 deletions
@@ -193,5 +193,16 @@ public interface ChronicleMap<K, V> extends ConcurrentMap<K, V>, ChronicleHash {
*/
<R> R mapForKey(K key, @NotNull Function<? super V, R> function);
/**
* Apply a mutator to the value for a key and return a result.
* A write lock is assumed.
*
* @param key to apply the mapping to
* @param mutator to alter the value and calculate a result
* @param <R> return type.
* @return the result of the function.
*/
<R> R updateForKey(K key, @NotNull Mutator<? super V, R> mutator);
}