Class ConcurrentMutableHashMap<K,V>
- java.lang.Object
-
- org.eclipse.collections.impl.AbstractRichIterable<V>
-
- org.eclipse.collections.impl.map.AbstractMapIterable<K,V>
-
- org.eclipse.collections.impl.map.mutable.AbstractMutableMapIterable<K,V>
-
- org.eclipse.collections.impl.map.mutable.AbstractMutableMap<K,V>
-
- org.eclipse.collections.impl.map.mutable.ConcurrentMutableHashMap<K,V>
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<V>
,java.util.concurrent.ConcurrentMap<K,V>
,java.util.Map<K,V>
,InternalIterable<V>
,ConcurrentMutableMap<K,V>
,MapIterable<K,V>
,MutableMap<K,V>
,MutableMapIterable<K,V>
,UnsortedMapIterable<K,V>
,RichIterable<V>
@Deprecated public final class ConcurrentMutableHashMap<K,V> extends AbstractMutableMap<K,V> implements ConcurrentMutableMap<K,V>, java.io.Serializable
Deprecated.since 2.0A simple concurrent implementation of MutableMap which uses java.util.concurrent.ConcurrentHashMap for its underlying concurrent Map implementation.- See Also:
ConcurrentHashMap
, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.collections.impl.map.mutable.AbstractMutableMap
AbstractMutableMap.ValuesCollectionCommon<V>
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.ConcurrentMap<K,V>
delegate
Deprecated.private static long
serialVersionUID
Deprecated.
-
Constructor Summary
Constructors Modifier Constructor Description private
ConcurrentMutableHashMap()
Deprecated.ConcurrentMutableHashMap(java.util.concurrent.ConcurrentMap<K,V> delegate)
Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 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 fromiterable
tothis
.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 asMap.equals(Object)
.void
forEachKey(Procedure<? super K> procedure)
Deprecated.Calls theprocedure
with each key of the map.void
forEachKeyValue(Procedure2<? super K,? super V> procedure)
Deprecated.Calls theprocedure
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, returnvalue
.<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 asMap.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 specifiedkey
.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 returnsthis
.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 withkey
, applies thefunction
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 asMutableMapIterable.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 withAllKeyValuesConcurrentMutableHashMap<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.-
Methods inherited from class org.eclipse.collections.impl.map.mutable.AbstractMutableMap
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
-
Methods inherited from class org.eclipse.collections.impl.map.mutable.AbstractMutableMapIterable
aggregateBy, collect, countBy, countByEach, countByWith, detect, detectOptional, flipUniqueValues, getIfAbsentPutWithKey, keysView, keyValuesView, sumByDouble, sumByFloat, sumByInt, sumByLong, valuesView
-
Methods inherited from class org.eclipse.collections.impl.map.AbstractMapIterable
allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, asLazy, chunk, contains, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, getFirst, getLast, getOnly, getOrDefault, isAbsent, keyAndValueEquals, keyAndValueHashCode, noneSatisfy, noneSatisfyWith, toArray, toArray
-
Methods inherited from class org.eclipse.collections.impl.AbstractRichIterable
appendString, appendString, collect, collectIf, 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, toBiMap, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, zip, zipWithIndex
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.concurrent.ConcurrentMap
compute, computeIfAbsent, computeIfPresent, forEach, merge, replaceAll
-
Methods inherited from interface org.eclipse.collections.api.map.ConcurrentMutableMap
getOrDefault, withMap, withMapIterable
-
Methods inherited from interface org.eclipse.collections.api.InternalIterable
forEach
-
Methods inherited from interface org.eclipse.collections.api.map.MapIterable
detect, detectOptional, injectIntoKeyValue, keysView, keyValuesView, parallelStream, spliterator, stream, valuesView
-
Methods inherited from interface org.eclipse.collections.api.map.MutableMap
aggregateBy, aggregateBy, aggregateInPlaceBy, asSynchronized, asUnmodifiable, collect, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectValues, collectWith, flatCollect, flatCollectWith, flip, flipUniqueValues, groupBy, groupByEach, groupByUniqueKey, partition, partitionWith, reject, reject, rejectWith, select, select, selectInstancesOf, selectWith, zip, zipWithIndex
-
Methods inherited from interface org.eclipse.collections.api.map.MutableMapIterable
add, countBy, countByEach, countByWith, getIfAbsentPutWithKey, putAllMapIterable, putPair, removeAllKeys, removeIf, sumByDouble, sumByFloat, sumByInt, sumByLong
-
Methods inherited from interface org.eclipse.collections.api.RichIterable
aggregateBy, allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, containsAny, containsAnyIterable, containsBy, containsNone, containsNoneIterable, count, countBy, countByEach, countByWith, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, forEach, getAny, getFirst, getLast, getOnly, groupBy, groupByAndCollect, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, into, makeString, 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, toBiMap, toImmutableBag, toImmutableBiMap, toImmutableList, toImmutableMap, toImmutableSet, toImmutableSortedBag, toImmutableSortedBag, toImmutableSortedBagBy, toImmutableSortedList, toImmutableSortedList, toImmutableSortedListBy, toImmutableSortedSet, toImmutableSortedSet, toImmutableSortedSetBy, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, zip, zipWithIndex
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Deprecated.- See Also:
- Constant Field Values
-
-
Method Detail
-
newMap
public static <NK,NV> ConcurrentMutableHashMap<NK,NV> newMap()
Deprecated.
-
newMap
public static <NK,NV> ConcurrentMutableHashMap<NK,NV> newMap(int initialCapacity)
Deprecated.
-
newMap
public static <NK,NV> ConcurrentMutableHashMap<NK,NV> newMap(int initialCapacity, float loadFactor, int concurrencyLevel)
Deprecated.
-
newMap
public static <NK,NV> ConcurrentMutableHashMap<NK,NV> newMap(java.util.Map<NK,NV> map)
Deprecated.
-
withKeyValue
public ConcurrentMutableHashMap<K,V> withKeyValue(K key, V value)
Deprecated.Description copied from interface:MutableMapIterable
This method allows mutable, fixed size, and immutable maps the ability to add elements to their existing elements. In order to support fixed size maps, a new instance of a map would have to be returned including the keys and values of the original plus the additional key and value. In the case of mutable maps, the original map is modified and then returned. In order to use this method properly with mutable and fixed size maps the following approach must be taken: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.- Specified by:
withKeyValue
in interfaceMutableMap<K,V>
- Specified by:
withKeyValue
in interfaceMutableMapIterable<K,V>
- Overrides:
withKeyValue
in classAbstractMutableMap<K,V>
- See Also:
Map.put(Object, Object)
-
withAllKeyValues
public ConcurrentMutableHashMap<K,V> withAllKeyValues(java.lang.Iterable<? extends Pair<? extends K,? extends V>> keyValues)
Deprecated.Description copied from interface:MutableMapIterable
This method allows mutable, fixed size, and immutable maps the ability to add elements to their existing elements. In order to support fixed size maps, a new instance of a map would have to be returned including the keys and values of the original plus all the additional keys and values. In the case of mutable maps, the original map is modified and then returned. In order to use this method properly with mutable and fixed size maps the following approach must be taken: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.- Specified by:
withAllKeyValues
in interfaceMutableMap<K,V>
- Specified by:
withAllKeyValues
in interfaceMutableMapIterable<K,V>
- Overrides:
withAllKeyValues
in classAbstractMutableMap<K,V>
- See Also:
Map.put(Object, Object)
-
withAllKeyValueArguments
public ConcurrentMutableHashMap<K,V> withAllKeyValueArguments(Pair<? extends K,? extends V>... keyValues)
Deprecated.Description copied from interface:MutableMapIterable
Convenience var-args version of withAllKeyValues- Specified by:
withAllKeyValueArguments
in interfaceMutableMap<K,V>
- Specified by:
withAllKeyValueArguments
in interfaceMutableMapIterable<K,V>
- Overrides:
withAllKeyValueArguments
in classAbstractMutableMap<K,V>
- See Also:
MutableMapIterable.withAllKeyValues(Iterable)
-
withoutKey
public ConcurrentMutableHashMap<K,V> withoutKey(K key)
Deprecated.Description copied from interface:MutableMapIterable
This method allows mutable, fixed size, and immutable maps the ability to remove elements from their existing elements. In order to support fixed size maps, a new instance of a map would have to be returned including the keys and values of the original minus the key and value to be removed. In the case of mutable maps, the original map is modified and then returned. In order to use this method properly with mutable and fixed size maps the following approach must be taken: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.- Specified by:
withoutKey
in interfaceMutableMap<K,V>
- Specified by:
withoutKey
in interfaceMutableMapIterable<K,V>
- Overrides:
withoutKey
in classAbstractMutableMap<K,V>
- See Also:
Map.remove(Object)
-
withoutAllKeys
public ConcurrentMutableHashMap<K,V> withoutAllKeys(java.lang.Iterable<? extends K> keys)
Deprecated.Description copied from interface:MutableMapIterable
This method allows mutable, fixed size, and immutable maps the ability to remove elements from their existing elements. In order to support fixed size maps, a new instance of a map would have to be returned including the keys and values of the original minus all the keys and values to be removed. In the case of mutable maps, the original map is modified and then returned. In order to use this method properly with mutable and fixed size maps the following approach must be taken: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.- Specified by:
withoutAllKeys
in interfaceMutableMap<K,V>
- Specified by:
withoutAllKeys
in interfaceMutableMapIterable<K,V>
- Overrides:
withoutAllKeys
in classAbstractMutableMap<K,V>
- See Also:
Map.remove(Object)
-
toString
public java.lang.String toString()
Deprecated.Description copied from class:AbstractRichIterable
Returns a string with the elements of the iterable separated by commas with spaces and enclosed in square brackets.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());
- Specified by:
toString
in interfaceMapIterable<K,V>
- Specified by:
toString
in interfaceRichIterable<K>
- Overrides:
toString
in classAbstractRichIterable<V>
- Returns:
- a string representation of this collection.
- See Also:
AbstractCollection.toString()
-
clone
public MutableMap<K,V> clone()
Deprecated.- Specified by:
clone
in interfaceMutableMap<K,V>
- Specified by:
clone
in classAbstractMutableMap<K,V>
-
newEmpty
public <K,V> MutableMap<K,V> newEmpty(int capacity)
Deprecated.Description copied from class:AbstractMutableMap
Creates a new instance of the same type, using the given capacity and the default growth parameters.- Specified by:
newEmpty
in classAbstractMutableMap<K,V>
-
notEmpty
public boolean notEmpty()
Deprecated.Description copied from interface:RichIterable
The English equivalent of !this.isEmpty()- Specified by:
notEmpty
in interfaceRichIterable<K>
-
forEachWithIndex
public void forEachWithIndex(ObjectIntProcedure<? super V> objectIntProcedure)
Deprecated.Description copied from interface:InternalIterable
Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.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()); } });
- Specified by:
forEachWithIndex
in interfaceInternalIterable<K>
- Overrides:
forEachWithIndex
in classAbstractMapIterable<K,V>
-
size
public int size()
Deprecated.Description copied from interface:RichIterable
Returns the number of items in this iterable.- Specified by:
size
in interfacejava.util.Map<K,V>
- Specified by:
size
in interfaceRichIterable<K>
-
isEmpty
public boolean isEmpty()
Deprecated.Description copied from interface:RichIterable
Returns true if this iterable has zero items.- Specified by:
isEmpty
in interfacejava.util.Map<K,V>
- Specified by:
isEmpty
in interfaceRichIterable<K>
- Overrides:
isEmpty
in classAbstractRichIterable<V>
-
iterator
public java.util.Iterator<V> iterator()
Deprecated.- Specified by:
iterator
in interfacejava.lang.Iterable<K>
- Overrides:
iterator
in classAbstractMutableMapIterable<K,V>
-
remove
public V remove(java.lang.Object key)
Deprecated.
-
keySet
public java.util.Set<K> keySet()
Deprecated.
-
values
public java.util.Collection<V> values()
Deprecated.
-
newEmpty
public MutableMap<K,V> newEmpty()
Deprecated.Description copied from interface:MutableMapIterable
Creates a new instance of the same type, using the default capacity and growth parameters.- Specified by:
newEmpty
in interfaceMutableMap<K,V>
- Specified by:
newEmpty
in interfaceMutableMapIterable<K,V>
-
tap
public ConcurrentMutableMap<K,V> tap(Procedure<? super V> procedure)
Deprecated.Description copied from interface:MapIterable
Executes the Procedure for each value of the map and returnsthis
.return peopleByCity.tap(person -> LOGGER.info(person.getName()));
- Specified by:
tap
in interfaceConcurrentMutableMap<K,V>
- Specified by:
tap
in interfaceMapIterable<K,V>
- Specified by:
tap
in interfaceMutableMap<K,V>
- Specified by:
tap
in interfaceMutableMapIterable<K,V>
- Specified by:
tap
in interfaceRichIterable<K>
- Specified by:
tap
in interfaceUnsortedMapIterable<K,V>
- Overrides:
tap
in classAbstractMutableMap<K,V>
- See Also:
RichIterable.forEach(Procedure)
-
forEachValue
public void forEachValue(Procedure<? super V> procedure)
Deprecated.Description copied from interface:MapIterable
Calls the procedure with each value of the map.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);
- Specified by:
forEachValue
in interfaceMapIterable<K,V>
- Overrides:
forEachValue
in classAbstractMapIterable<K,V>
-
forEachKey
public void forEachKey(Procedure<? super K> procedure)
Deprecated.Description copied from interface:MapIterable
Calls theprocedure
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);
- Specified by:
forEachKey
in interfaceMapIterable<K,V>
- Overrides:
forEachKey
in classAbstractMapIterable<K,V>
-
forEachKeyValue
public void forEachKeyValue(Procedure2<? super K,? super V> procedure)
Deprecated.Description copied from interface:MapIterable
Calls theprocedure
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");
- Specified by:
forEachKeyValue
in interfaceMapIterable<K,V>
-
get
public V get(java.lang.Object key)
Deprecated.
-
collectKeysAndValues
public <E> MutableMap<K,V> collectKeysAndValues(java.lang.Iterable<E> iterable, Function<? super E,? extends K> keyFunction, Function<? super E,? extends V> valueFunction)
Deprecated.Description copied from interface:MutableMap
Adds all the entries derived fromiterable
tothis
. The key and value for each entry is determined by applying thekeyFunction
andvalueFunction
to each item incollection
. Any entry inmap
that has the same key as an entry inthis
will have its value replaced by that inmap
.- Specified by:
collectKeysAndValues
in interfaceMutableMap<K,V>
-
removeKey
public V removeKey(K key)
Deprecated.Description copied from interface:MutableMapIterable
Remove an entry from the map at the specifiedkey
.- Specified by:
removeKey
in interfaceMutableMapIterable<K,V>
- Returns:
- The value removed from entry at key, or null if not found.
- See Also:
Map.remove(Object)
-
containsKey
public boolean containsKey(java.lang.Object key)
Deprecated.- Specified by:
containsKey
in interfacejava.util.Map<K,V>
- Specified by:
containsKey
in interfaceMapIterable<K,V>
- See Also:
Map.containsKey(Object)
-
containsValue
public boolean containsValue(java.lang.Object value)
Deprecated.- Specified by:
containsValue
in interfacejava.util.Map<K,V>
- Specified by:
containsValue
in interfaceMapIterable<K,V>
- See Also:
Map.containsValue(Object)
-
getIfAbsentPut
public V getIfAbsentPut(K key, Function0<? extends V> function)
Deprecated.Description copied from interface:MutableMapIterable
Get and return the value in the Map at the specified key. Alternatively, if there is no value in the map at the key, return the result of evaluating the specified Function0, and put that value in the map at the specified key.- Specified by:
getIfAbsentPut
in interfaceMutableMapIterable<K,V>
- Overrides:
getIfAbsentPut
in classAbstractMutableMapIterable<K,V>
-
getIfAbsentPut
public V getIfAbsentPut(K key, V value)
Deprecated.Description copied from interface:MutableMapIterable
Get and return the value in the Map at the specified key. Alternatively, if there is no value in the map at the key, return the specified value, and put that value in the map at the specified key.- Specified by:
getIfAbsentPut
in interfaceMutableMapIterable<K,V>
- Overrides:
getIfAbsentPut
in classAbstractMutableMapIterable<K,V>
-
getIfAbsentPutWith
public <P> V getIfAbsentPutWith(K key, Function<? super P,? extends V> function, P parameter)
Deprecated.Description copied from interface:MutableMapIterable
Get and return the value in the Map at the specified key. Alternatively, if there is no value in the map for that key return the result of evaluating the specified Function using the specified parameter, and put that value in the map at the specified key.- Specified by:
getIfAbsentPutWith
in interfaceMutableMapIterable<K,V>
- Overrides:
getIfAbsentPutWith
in classAbstractMutableMapIterable<K,V>
-
getIfAbsent
public V getIfAbsent(K key, Function0<? extends V> function)
Deprecated.Description copied from interface:MapIterable
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.- Specified by:
getIfAbsent
in interfaceMapIterable<K,V>
- Overrides:
getIfAbsent
in classAbstractMapIterable<K,V>
-
getIfAbsentValue
public V getIfAbsentValue(K key, V value)
Deprecated.Description copied from interface:MapIterable
Return the value in the Map that corresponds to the specified key, or if there is no value at the key, returnvalue
.- Specified by:
getIfAbsentValue
in interfaceMapIterable<K,V>
- Overrides:
getIfAbsentValue
in classAbstractMapIterable<K,V>
-
getIfAbsentWith
public <P> V getIfAbsentWith(K key, Function<? super P,? extends V> function, P parameter)
Deprecated.Description copied from interface:MapIterable
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.- Specified by:
getIfAbsentWith
in interfaceMapIterable<K,V>
- Overrides:
getIfAbsentWith
in classAbstractMapIterable<K,V>
-
getIfAbsentPut
public V getIfAbsentPut(K key, Function<? super K,? extends V> factory)
Deprecated.
-
ifPresentApply
public <A> A ifPresentApply(K key, Function<? super V,? extends A> function)
Deprecated.Description copied from interface:MapIterable
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.- Specified by:
ifPresentApply
in interfaceMapIterable<K,V>
- Overrides:
ifPresentApply
in classAbstractMapIterable<K,V>
-
equals
public boolean equals(java.lang.Object o)
Deprecated.Description copied from interface:MapIterable
Follows the same general contract asMap.equals(Object)
.
-
hashCode
public int hashCode()
Deprecated.Description copied from interface:MapIterable
Follows the same general contract asMap.hashCode()
.
-
forEachWith
public <P> void forEachWith(Procedure2<? super V,? super P> procedure, P parameter)
Deprecated.Description copied from interface:InternalIterable
The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument.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);
- Specified by:
forEachWith
in interfaceInternalIterable<K>
- Overrides:
forEachWith
in classAbstractMapIterable<K,V>
-
remove
public boolean remove(java.lang.Object key, java.lang.Object value)
Deprecated.
-
updateValue
public V updateValue(K key, Function0<? extends V> factory, Function<? super V,? extends V> function)
Deprecated.Description copied from interface:MutableMapIterable
Looks up the value associated withkey
, applies thefunction
to it, and replaces the value. If there is no value associated withkey
, starts it off with a value supplied byfactory
.- Specified by:
updateValue
in interfaceMutableMapIterable<K,V>
- Overrides:
updateValue
in classAbstractMutableMapIterable<K,V>
-
updateValueWith
public <P> V updateValueWith(K key, Function0<? extends V> factory, Function2<? super V,? super P,? extends V> function, P parameter)
Deprecated.Description copied from interface:MutableMapIterable
Same asMutableMapIterable.updateValue(Object, Function0, Function)
with a Function2 and specified parameter which is passed to the function.- Specified by:
updateValueWith
in interfaceMutableMapIterable<K,V>
- Overrides:
updateValueWith
in classAbstractMutableMapIterable<K,V>
-
toImmutable
public ImmutableMap<K,V> toImmutable()
Deprecated.Description copied from interface:MutableMapIterable
Returns an immutable copy of this map. If the map is immutable, it returns itself.- Specified by:
toImmutable
in interfaceMapIterable<K,V>
- Specified by:
toImmutable
in interfaceMutableMapIterable<K,V>
- Specified by:
toImmutable
in interfaceUnsortedMapIterable<K,V>
- Overrides:
toImmutable
in classAbstractMutableMap<K,V>
-
-