java.io.Serializable
, java.lang.Cloneable
, java.lang.Iterable<K>
, java.util.concurrent.ConcurrentMap<K,V>
, java.util.Map<K,V>
, InternalIterable<K>
, ConcurrentMutableMap<K,V>
, MapIterable<K,V>
, MutableMap<K,V>
, MutableMapIterable<K,V>
, UnsortedMapIterable<K,V>
, RichIterable<K>
@Deprecated public final class ConcurrentMutableHashMap<K,V> extends AbstractMutableMap<K,V> implements ConcurrentMutableMap<K,V>, java.io.Serializable
ConcurrentHashMap
,
Serialized FormConstructor | Description |
---|---|
ConcurrentMutableHashMap(java.util.concurrent.ConcurrentMap<K,V> delegate) |
Deprecated.
|
Modifier and Type | Method | Description |
---|---|---|
void |
clear() |
Deprecated.
|
MutableMap<K,V> |
clone() |
Deprecated.
|
<E> MutableMap<K,V> |
collectKeysAndValues(java.lang.Iterable<E> iterable,
Function<? super E,? extends K> keyFunction,
Function<? super E,? extends V> valueFunction) |
Deprecated.
Adds all the entries derived from
iterable to this . |
boolean |
containsKey(java.lang.Object key) |
Deprecated.
|
boolean |
containsValue(java.lang.Object value) |
Deprecated.
|
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet() |
Deprecated.
|
boolean |
equals(java.lang.Object o) |
Deprecated.
Follows the same general contract as
Map.equals(Object) . |
void |
forEachKey(Procedure<? super K> procedure) |
Deprecated.
Calls the
procedure with each key of the map. |
void |
forEachKeyValue(Procedure2<? super K,? super V> procedure) |
Deprecated.
Calls the
procedure with each key-value pair of the map. |
void |
forEachValue(Procedure<? super V> procedure) |
Deprecated.
Calls the procedure with each value of the map.
|
<P> void |
forEachWith(Procedure2<? super V,? super P> procedure,
P parameter) |
Deprecated.
The procedure2 is evaluated for each element in the iterable with the specified parameter provided
as the second argument.
|
void |
forEachWithIndex(ObjectIntProcedure<? super V> objectIntProcedure) |
Deprecated.
Iterates over the iterable passing each element and the current relative int index to the specified instance of
ObjectIntProcedure.
|
V |
get(java.lang.Object key) |
Deprecated.
|
V |
getIfAbsent(K key,
Function0<? extends V> function) |
Deprecated.
Return the value in the Map that corresponds to the specified key, or if there is no value at the key, return the
result of evaluating the specified Function0.
|
V |
getIfAbsentPut(K key,
Function<? super K,? extends V> factory) |
Deprecated.
|
V |
getIfAbsentPut(K key,
Function0<? extends V> function) |
Deprecated.
Get and return the value in the Map at the specified key.
|
V |
getIfAbsentPut(K key,
V value) |
Deprecated.
Get and return the value in the Map at the specified key.
|
<P> V |
getIfAbsentPutWith(K key,
Function<? super P,? extends V> function,
P parameter) |
Deprecated.
Get and return the value in the Map at the specified key.
|
V |
getIfAbsentValue(K key,
V value) |
Deprecated.
Return the value in the Map that corresponds to the specified key, or if there is no value at the key, return
value . |
<P> V |
getIfAbsentWith(K key,
Function<? super P,? extends V> function,
P parameter) |
Deprecated.
Return the value in the Map that corresponds to the specified key, or if there is no value at the key, return the
result of evaluating the specified function and parameter.
|
int |
hashCode() |
Deprecated.
Follows the same general contract as
Map.hashCode() . |
<A> A |
ifPresentApply(K key,
Function<? super V,? extends A> function) |
Deprecated.
If there is a value in the Map that corresponds to the specified key return the result of applying the specified
Function on the value, otherwise return null.
|
boolean |
isEmpty() |
Deprecated.
Returns true if this iterable has zero items.
|
java.util.Iterator<V> |
iterator() |
Deprecated.
|
java.util.Set<K> |
keySet() |
Deprecated.
|
MutableMap<K,V> |
newEmpty() |
Deprecated.
Creates a new instance of the same type, using the default capacity and growth parameters.
|
<K,V> MutableMap<K,V> |
newEmpty(int capacity) |
Deprecated.
Creates a new instance of the same type, using the given capacity and the default growth parameters.
|
static <NK,NV> ConcurrentMutableHashMap<NK,NV> |
newMap() |
Deprecated.
|
static <NK,NV> ConcurrentMutableHashMap<NK,NV> |
newMap(int initialCapacity) |
Deprecated.
|
static <NK,NV> ConcurrentMutableHashMap<NK,NV> |
newMap(int initialCapacity,
float loadFactor,
int concurrencyLevel) |
Deprecated.
|
static <NK,NV> ConcurrentMutableHashMap<NK,NV> |
newMap(java.util.Map<NK,NV> map) |
Deprecated.
|
boolean |
notEmpty() |
Deprecated.
The English equivalent of !this.isEmpty()
|
V |
put(K key,
V value) |
Deprecated.
|
void |
putAll(java.util.Map<? extends K,? extends V> map) |
Deprecated.
|
V |
putIfAbsent(K key,
V value) |
Deprecated.
|
V |
remove(java.lang.Object key) |
Deprecated.
|
boolean |
remove(java.lang.Object key,
java.lang.Object value) |
Deprecated.
|
V |
removeKey(K key) |
Deprecated.
Remove an entry from the map at the specified
key . |
V |
replace(K key,
V value) |
Deprecated.
|
boolean |
replace(K key,
V oldValue,
V newValue) |
Deprecated.
|
int |
size() |
Deprecated.
Returns the number of items in this iterable.
|
ConcurrentMutableMap<K,V> |
tap(Procedure<? super V> procedure) |
Deprecated.
Executes the Procedure for each value of the map and returns
this . |
ImmutableMap<K,V> |
toImmutable() |
Deprecated.
Returns an immutable copy of this map.
|
java.lang.String |
toString() |
Deprecated.
Returns a string with the elements of the iterable separated by commas with spaces and
enclosed in square brackets.
|
V |
updateValue(K key,
Function0<? extends V> factory,
Function<? super V,? extends V> function) |
Deprecated.
Looks up the value associated with
key , applies the function to it, and replaces the value. |
<P> V |
updateValueWith(K key,
Function0<? extends V> factory,
Function2<? super V,? super P,? extends V> function,
P parameter) |
Deprecated.
Same as
MutableMapIterable.updateValue(Object, Function0, Function) with a Function2 and specified parameter which is
passed to the function. |
java.util.Collection<V> |
values() |
Deprecated.
|
ConcurrentMutableHashMap<K,V> |
withAllKeyValueArguments(Pair<? extends K,? extends V>... keyValues) |
Deprecated.
Convenience var-args version of withAllKeyValues
|
ConcurrentMutableHashMap<K,V> |
withAllKeyValues(java.lang.Iterable<? extends Pair<? extends K,? extends V>> keyValues) |
Deprecated.
This method allows mutable, fixed size, and immutable maps the ability to add elements to their existing
elements.
|
ConcurrentMutableHashMap<K,V> |
withKeyValue(K key,
V value) |
Deprecated.
This method allows mutable, fixed size, and immutable maps the ability to add elements to their existing
elements.
|
ConcurrentMutableHashMap<K,V> |
withoutAllKeys(java.lang.Iterable<? extends K> keys) |
Deprecated.
This method allows mutable, fixed size, and immutable maps the ability to remove elements from their existing
elements.
|
ConcurrentMutableHashMap<K,V> |
withoutKey(K key) |
Deprecated.
This method allows mutable, fixed size, and immutable maps the ability to remove elements from their existing
elements.
|
allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, asLazy, chunk, contains, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, getFirst, getLast, getOnly, noneSatisfy, noneSatisfyWith, toArray, toArray
asSynchronized, asUnmodifiable, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectValues, collectWith, flatCollect, flip, groupBy, groupByEach, groupByUniqueKey, partition, partitionWith, reject, reject, rejectWith, select, select, selectInstancesOf, selectWith, zip, zipWithIndex
aggregateBy, aggregateInPlaceBy, collect, countBy, countByWith, detect, detectOptional, flipUniqueValues, getIfAbsentPutWithKey, keysView, keyValuesView, sumByDouble, sumByFloat, sumByInt, sumByLong, valuesView
appendString, appendString, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, containsAll, containsAllArguments, containsAllIterable, count, countWith, flatCollect, forEach, groupBy, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, into, max, max, maxBy, min, min, minBy, reject, rejectWith, select, selectWith, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toBag, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedListBy, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toSortedSetBy, zip, zipWithIndex
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
forEach, forEach
compute, computeIfAbsent, computeIfPresent, entry, forEach, getOrDefault, merge, of, of, of, of, of, of, of, of, of, of, of, ofEntries, replaceAll
detect, detectOptional, keysView, keyValuesView, parallelStream, spliterator, stream, valuesView
aggregateBy, aggregateInPlaceBy, asSynchronized, asUnmodifiable, collect, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectValues, collectWith, flatCollect, flip, flipUniqueValues, groupBy, groupByEach, groupByUniqueKey, partition, partitionWith, reject, reject, rejectWith, select, select, selectInstancesOf, selectWith, zip, zipWithIndex
add, countBy, countByWith, getIfAbsentPutWithKey, putPair, sumByDouble, sumByFloat, sumByInt, sumByLong
allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, count, countBy, countByWith, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, flatCollect, getFirst, getLast, getOnly, groupBy, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, into, makeString, makeString, makeString, max, max, maxBy, maxByOptional, maxOptional, maxOptional, min, min, minBy, minByOptional, minOptional, minOptional, noneSatisfy, noneSatisfyWith, reduce, reduceInPlace, reduceInPlace, reject, rejectWith, select, selectWith, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toSortedSetBy, zip, zipWithIndex
public static <NK,NV> ConcurrentMutableHashMap<NK,NV> newMap()
public static <NK,NV> ConcurrentMutableHashMap<NK,NV> newMap(int initialCapacity)
public static <NK,NV> ConcurrentMutableHashMap<NK,NV> newMap(int initialCapacity, float loadFactor, int concurrencyLevel)
public static <NK,NV> ConcurrentMutableHashMap<NK,NV> newMap(java.util.Map<NK,NV> map)
public ConcurrentMutableHashMap<K,V> withKeyValue(K key, V value)
MutableMapIterable
map = map.withKeyValue("new key", "new value");In the case of FixedSizeMap, a new instance will be returned by withKeyValue, and any variables that previously referenced the original map will need to be redirected to reference the new instance. In the case of a FastMap or UnifiedMap, you will be replacing the reference to map with map, since FastMap and UnifiedMap will both return "this" after calling put on themselves.
withKeyValue
in interface MutableMap<K,V>
withKeyValue
in interface MutableMapIterable<K,V>
withKeyValue
in class AbstractMutableMap<K,V>
Map.put(Object, Object)
public ConcurrentMutableHashMap<K,V> withAllKeyValues(java.lang.Iterable<? extends Pair<? extends K,? extends V>> keyValues)
MutableMapIterable
map = map.withAllKeyValues(FastList.newListWith(PairImpl.of("new key", "new value")));In the case of FixedSizeMap, a new instance will be returned by withAllKeyValues, and any variables that previously referenced the original map will need to be redirected to reference the new instance. In the case of a FastMap or UnifiedMap, you will be replacing the reference to map with map, since FastMap and UnifiedMap will both return "this" after calling put on themselves.
withAllKeyValues
in interface MutableMap<K,V>
withAllKeyValues
in interface MutableMapIterable<K,V>
withAllKeyValues
in class AbstractMutableMap<K,V>
Map.put(Object, Object)
public ConcurrentMutableHashMap<K,V> withAllKeyValueArguments(Pair<? extends K,? extends V>... keyValues)
MutableMapIterable
withAllKeyValueArguments
in interface MutableMap<K,V>
withAllKeyValueArguments
in interface MutableMapIterable<K,V>
withAllKeyValueArguments
in class AbstractMutableMap<K,V>
MutableMapIterable.withAllKeyValues(Iterable)
public ConcurrentMutableHashMap<K,V> withoutKey(K key)
MutableMapIterable
map = map.withoutKey("key");In the case of FixedSizeMap, a new instance will be returned by withoutKey, and any variables that previously referenced the original map will need to be redirected to reference the new instance. In the case of a FastMap or UnifiedMap, you will be replacing the reference to map with map, since FastMap and UnifiedMap will both return "this" after calling remove on themselves.
withoutKey
in interface MutableMap<K,V>
withoutKey
in interface MutableMapIterable<K,V>
withoutKey
in class AbstractMutableMap<K,V>
Map.remove(Object)
public ConcurrentMutableHashMap<K,V> withoutAllKeys(java.lang.Iterable<? extends K> keys)
MutableMapIterable
map = map.withoutAllKeys(FastList.newListWith("key1", "key2"));In the case of FixedSizeMap, a new instance will be returned by withoutAllKeys, and any variables that previously referenced the original map will need to be redirected to reference the new instance. In the case of a FastMap or UnifiedMap, you will be replacing the reference to map with map, since FastMap and UnifiedMap will both return "this" after calling remove on themselves.
withoutAllKeys
in interface MutableMap<K,V>
withoutAllKeys
in interface MutableMapIterable<K,V>
withoutAllKeys
in class AbstractMutableMap<K,V>
Map.remove(Object)
public java.lang.String toString()
AbstractRichIterable
Assert.assertEquals("[]", Lists.mutable.empty().toString()); Assert.assertEquals("[1]", Lists.mutable.with(1).toString()); Assert.assertEquals("[1, 2, 3]", Lists.mutable.with(1, 2, 3).toString());
toString
in interface MapIterable<K,V>
toString
in interface RichIterable<K>
toString
in class AbstractRichIterable<V>
AbstractCollection.toString()
public MutableMap<K,V> clone()
clone
in interface MutableMap<K,V>
clone
in class AbstractMutableMap<K,V>
public <K,V> MutableMap<K,V> newEmpty(int capacity)
AbstractMutableMap
newEmpty
in class AbstractMutableMap<K,V>
public boolean notEmpty()
RichIterable
notEmpty
in interface RichIterable<K>
public void forEachWithIndex(ObjectIntProcedure<? super V> objectIntProcedure)
InternalIterable
Example using a Java 8 lambda:
people.forEachWithIndex((Person person, int index) -> LOGGER.info("Index: " + index + " person: " + person.getName()));
Example using an anonymous inner class:
people.forEachWithIndex(new ObjectIntProcedure<Person>() { public void value(Person person, int index) { LOGGER.info("Index: " + index + " person: " + person.getName()); } });
forEachWithIndex
in interface InternalIterable<K>
forEachWithIndex
in class AbstractMapIterable<K,V>
public int size()
RichIterable
size
in interface java.util.Map<K,V>
size
in interface RichIterable<K>
public boolean isEmpty()
RichIterable
isEmpty
in interface java.util.Map<K,V>
isEmpty
in interface RichIterable<K>
isEmpty
in class AbstractRichIterable<V>
public java.util.Iterator<V> iterator()
iterator
in interface java.lang.Iterable<K>
iterator
in class AbstractMutableMapIterable<K,V>
public V remove(java.lang.Object key)
public java.util.Set<K> keySet()
public java.util.Collection<V> values()
public MutableMap<K,V> newEmpty()
MutableMapIterable
newEmpty
in interface MutableMap<K,V>
newEmpty
in interface MutableMapIterable<K,V>
public ConcurrentMutableMap<K,V> tap(Procedure<? super V> procedure)
MapIterable
this
.
return peopleByCity.tap(person -> LOGGER.info(person.getName()));
tap
in interface ConcurrentMutableMap<K,V>
tap
in interface MapIterable<K,V>
tap
in interface MutableMap<K,V>
tap
in interface MutableMapIterable<K,V>
tap
in interface RichIterable<K>
tap
in interface UnsortedMapIterable<K,V>
tap
in class AbstractMutableMap<K,V>
InternalIterable.forEach(Procedure)
public void forEachValue(Procedure<? super V> procedure)
MapIterable
Set<String> result = UnifiedSet.newSet(); MutableMap<Integer, String> map = this.newMapWithKeysValues(1, "One", 2, "Two", 3, "Three", 4, "Four"); map.forEachValue(new CollectionAddProcedure<String>(result)); Verify.assertSetsEqual(UnifiedSet.newSetWith("One", "Two", "Three", "Four"), result);
forEachValue
in interface MapIterable<K,V>
forEachValue
in class AbstractMapIterable<K,V>
public void forEachKey(Procedure<? super K> procedure)
MapIterable
procedure
with each key of the map.
final Collection<Integer> result = new ArrayList<Integer>(); MutableMap<Integer, String> map = this.newMapWithKeysValues(1, "1", 2, "2", 3, "3"); map.forEachKey(new CollectionAddProcedure<Integer>(result)); Verify.assertContainsAll(result, 1, 2, 3);
forEachKey
in interface MapIterable<K,V>
forEachKey
in class AbstractMapIterable<K,V>
public void forEachKeyValue(Procedure2<? super K,? super V> procedure)
MapIterable
procedure
with each key-value pair of the map.
final Collection<String> collection = new ArrayList<String>(); MutableMap<Integer, String> map = this.newMapWithKeysValues(1, "One", 2, "Two", 3, "Three"); map.forEachKeyValue((Integer key, String value) -> collection.add(String.valueOf(key) + value)); Verify.assertContainsAll(collection, "1One", "2Two", "3Three");
forEachKeyValue
in interface MapIterable<K,V>
public V get(java.lang.Object key)
public <E> MutableMap<K,V> collectKeysAndValues(java.lang.Iterable<E> iterable, Function<? super E,? extends K> keyFunction, Function<? super E,? extends V> valueFunction)
MutableMap
iterable
to this
. The key and value for each entry
is determined by applying the keyFunction
and valueFunction
to each item in
collection
. Any entry in map
that has the same key as an entry in this
will have its value replaced by that in map
.collectKeysAndValues
in interface MutableMap<K,V>
public V removeKey(K key)
MutableMapIterable
key
.removeKey
in interface MutableMapIterable<K,V>
Map.remove(Object)
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<K,V>
containsKey
in interface MapIterable<K,V>
Map.containsKey(Object)
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map<K,V>
containsValue
in interface MapIterable<K,V>
Map.containsValue(Object)
public V getIfAbsentPut(K key, Function0<? extends V> function)
MutableMapIterable
getIfAbsentPut
in interface MutableMapIterable<K,V>
getIfAbsentPut
in class AbstractMutableMapIterable<K,V>
public V getIfAbsentPut(K key, V value)
MutableMapIterable
getIfAbsentPut
in interface MutableMapIterable<K,V>
getIfAbsentPut
in class AbstractMutableMapIterable<K,V>
public <P> V getIfAbsentPutWith(K key, Function<? super P,? extends V> function, P parameter)
MutableMapIterable
getIfAbsentPutWith
in interface MutableMapIterable<K,V>
getIfAbsentPutWith
in class AbstractMutableMapIterable<K,V>
public V getIfAbsent(K key, Function0<? extends V> function)
MapIterable
getIfAbsent
in interface MapIterable<K,V>
getIfAbsent
in class AbstractMapIterable<K,V>
public V getIfAbsentValue(K key, V value)
MapIterable
value
.getIfAbsentValue
in interface MapIterable<K,V>
getIfAbsentValue
in class AbstractMapIterable<K,V>
public <P> V getIfAbsentWith(K key, Function<? super P,? extends V> function, P parameter)
MapIterable
getIfAbsentWith
in interface MapIterable<K,V>
getIfAbsentWith
in class AbstractMapIterable<K,V>
public <A> A ifPresentApply(K key, Function<? super V,? extends A> function)
MapIterable
ifPresentApply
in interface MapIterable<K,V>
ifPresentApply
in class AbstractMapIterable<K,V>
public boolean equals(java.lang.Object o)
MapIterable
Map.equals(Object)
.public int hashCode()
MapIterable
Map.hashCode()
.public <P> void forEachWith(Procedure2<? super V,? super P> procedure, P parameter)
InternalIterable
Example using a Java 8 lambda:
people.forEachWith((Person person, Person other) -> { if (person.isRelatedTo(other)) { LOGGER.info(person.getName()); } }, fred);
Example using an anonymous inner class:
people.forEachWith(new Procedure2<Person, Person>() { public void value(Person person, Person other) { if (person.isRelatedTo(other)) { LOGGER.info(person.getName()); } } }, fred);
forEachWith
in interface InternalIterable<K>
forEachWith
in class AbstractMapIterable<K,V>
public boolean remove(java.lang.Object key, java.lang.Object value)
public V updateValue(K key, Function0<? extends V> factory, Function<? super V,? extends V> function)
MutableMapIterable
key
, applies the function
to it, and replaces the value. If there
is no value associated with key
, starts it off with a value supplied by factory
.updateValue
in interface MutableMapIterable<K,V>
updateValue
in class AbstractMutableMapIterable<K,V>
public <P> V updateValueWith(K key, Function0<? extends V> factory, Function2<? super V,? super P,? extends V> function, P parameter)
MutableMapIterable
MutableMapIterable.updateValue(Object, Function0, Function)
with a Function2 and specified parameter which is
passed to the function.updateValueWith
in interface MutableMapIterable<K,V>
updateValueWith
in class AbstractMutableMapIterable<K,V>
public ImmutableMap<K,V> toImmutable()
MutableMapIterable
toImmutable
in interface MapIterable<K,V>
toImmutable
in interface MutableMapIterable<K,V>
toImmutable
in interface UnsortedMapIterable<K,V>
toImmutable
in class AbstractMutableMap<K,V>
Copyright © 2004–2018. All rights reserved.