public abstract class AbstractSynchronizedMapIterable<K,V> extends AbstractSynchronizedRichIterable<V> implements com.gs.collections.api.map.MutableMapIterable<K,V>
delegate, lock| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSynchronizedMapIterable(com.gs.collections.api.map.MutableMapIterable<K,V> delegate) |
protected |
AbstractSynchronizedMapIterable(com.gs.collections.api.map.MutableMapIterable<K,V> delegate,
java.lang.Object lock) |
| Modifier and Type | Method and Description |
|---|---|
V |
add(com.gs.collections.api.tuple.Pair<K,V> keyValuePair)
This method allows mutable map the ability to add an element in the form of Pair
|
void |
clear() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
com.gs.collections.api.tuple.Pair<K,V> |
detect(com.gs.collections.api.block.predicate.Predicate2<? super K,? super V> predicate)
Return the first key and value of the map for which the predicate evaluates to true when they are given
as arguments.
|
void |
forEachKey(com.gs.collections.api.block.procedure.Procedure<? super K> procedure)
Calls the
procedure with each key of the map. |
void |
forEachKeyValue(com.gs.collections.api.block.procedure.Procedure2<? super K,? super V> procedure2)
Calls the
procedure with each key-value pair of the map. |
void |
forEachValue(com.gs.collections.api.block.procedure.Procedure<? super V> procedure)
Calls the procedure with each value of the map.
|
V |
get(java.lang.Object key) |
protected com.gs.collections.api.map.MutableMapIterable<K,V> |
getDelegate() |
V |
getIfAbsent(K key,
com.gs.collections.api.block.function.Function0<? extends V> function)
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,
com.gs.collections.api.block.function.Function0<? extends V> function)
Get and return the value in the Map at the specified key.
|
V |
getIfAbsentPut(K key,
V value)
Get and return the value in the Map at the specified key.
|
<P> V |
getIfAbsentPutWith(K key,
com.gs.collections.api.block.function.Function<? super P,? extends V> function,
P parameter)
Get and return the value in the Map at the specified key.
|
V |
getIfAbsentPutWithKey(K key,
com.gs.collections.api.block.function.Function<? super K,? extends V> function)
Get and return the value in the Map at the specified key.
|
V |
getIfAbsentValue(K key,
V value)
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,
com.gs.collections.api.block.function.Function<? super P,? extends V> function,
P parameter)
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.
|
<A> A |
ifPresentApply(K key,
com.gs.collections.api.block.function.Function<? super V,? extends A> function)
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.
|
com.gs.collections.api.RichIterable<com.gs.collections.api.tuple.Pair<K,V>> |
keyValuesView()
Returns an unmodifiable lazy iterable of key/value pairs wrapped around the entrySet for the map
|
V |
put(K key,
V value) |
void |
putAll(java.util.Map<? extends K,? extends V> map) |
V |
remove(java.lang.Object key) |
V |
removeKey(K key)
Remove an entry from the map at the specified
key. |
V |
updateValue(K key,
com.gs.collections.api.block.function.Function0<? extends V> factory,
com.gs.collections.api.block.function.Function<? super V,? extends V> function)
Looks up the value associated with
key, applies the function to it, and replaces the value. |
<P> V |
updateValueWith(K key,
com.gs.collections.api.block.function.Function0<? extends V> factory,
com.gs.collections.api.block.function.Function2<? super V,? super P,? extends V> function,
P parameter)
Same as
MutableMapIterable.updateValue(Object, Function0, Function) with a Function2 and specified parameter which is
passed to the function. |
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, countWith, detect, detectIfNone, detectWith, detectWithIfNone, each, equals, flatCollect, forEach, forEachWith, forEachWithIndex, getFirst, getLast, getLock, groupBy, groupByEach, groupByUniqueKey, groupByUniqueKey, hashCode, injectInto, injectInto, injectInto, injectInto, injectInto, isEmpty, iterator, makeString, makeString, makeString, max, max, maxBy, min, min, minBy, noneSatisfy, noneSatisfyWith, notEmpty, reject, rejectWith, select, selectWith, size, sumByDouble, sumByFloat, sumByInt, sumByLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndexclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaggregateBy, aggregateInPlaceBy, asSynchronized, asUnmodifiable, collect, collectValues, flip, flipUniqueValues, groupBy, groupByEach, groupByUniqueKey, newEmpty, partition, reject, reject, rejectWith, select, select, selectInstancesOf, selectWith, tap, toImmutable, withAllKeyValueArguments, withAllKeyValues, withKeyValue, withoutAllKeys, withoutKey, zip, zipWithIndexequals, hashCode, keysView, toString, valuesViewallSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, chunk, collect, collect, collectBoolean, collectBoolean, collectByte, collectByte, collectChar, collectChar, collectDouble, collectDouble, collectFloat, collectFloat, collectIf, collectIf, collectInt, collectInt, collectLong, collectLong, collectShort, collectShort, collectWith, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, count, countWith, detect, detectIfNone, detectWith, detectWithIfNone, each, flatCollect, flatCollect, getFirst, getLast, groupBy, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, isEmpty, makeString, makeString, makeString, max, max, maxBy, min, min, minBy, noneSatisfy, noneSatisfyWith, notEmpty, partitionWith, reject, rejectWith, select, selectWith, size, sumByDouble, sumByFloat, sumByInt, sumByLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toSortedSetBy, zip, zipWithIndexprotected AbstractSynchronizedMapIterable(com.gs.collections.api.map.MutableMapIterable<K,V> delegate)
protected com.gs.collections.api.map.MutableMapIterable<K,V> getDelegate()
getDelegate in class AbstractSynchronizedRichIterable<V>public V get(java.lang.Object key)
public V getIfAbsent(K key, com.gs.collections.api.block.function.Function0<? extends V> function)
com.gs.collections.api.map.MapIterablepublic V getIfAbsentValue(K key, V value)
com.gs.collections.api.map.MapIterablevalue.public <P> V getIfAbsentWith(K key, com.gs.collections.api.block.function.Function<? super P,? extends V> function, P parameter)
com.gs.collections.api.map.MapIterablepublic <A> A ifPresentApply(K key, com.gs.collections.api.block.function.Function<? super V,? extends A> function)
com.gs.collections.api.map.MapIterablepublic boolean containsKey(java.lang.Object key)
public boolean containsValue(java.lang.Object value)
public void forEachValue(com.gs.collections.api.block.procedure.Procedure<? super V> procedure)
com.gs.collections.api.map.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);
public void forEachKey(com.gs.collections.api.block.procedure.Procedure<? super K> procedure)
com.gs.collections.api.map.MapIterableprocedure 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);
public void forEachKeyValue(com.gs.collections.api.block.procedure.Procedure2<? super K,? super V> procedure2)
com.gs.collections.api.map.MapIterableprocedure 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(new Procedure2<Integer, String>()
{
public void value(final Integer key, final String value)
{
collection.add(String.valueOf(key) + value);
}
});
Verify.assertContainsAll(collection, "1One", "2Two", "3Three");
public com.gs.collections.api.tuple.Pair<K,V> detect(com.gs.collections.api.block.predicate.Predicate2<? super K,? super V> predicate)
com.gs.collections.api.map.MapIterable
e.g.
peopleByCity.detect(new Predicate2<City, Person>()
{
public boolean accept(City city, Person person)
{
return city.getName().equals("Anytown") && person.getLastName().equals("Smith");
}
});
public V getIfAbsentPut(K key, com.gs.collections.api.block.function.Function0<? extends V> function)
com.gs.collections.api.map.MutableMapIterablepublic V getIfAbsentPut(K key, V value)
com.gs.collections.api.map.MutableMapIterablepublic V getIfAbsentPutWithKey(K key, com.gs.collections.api.block.function.Function<? super K,? extends V> function)
com.gs.collections.api.map.MutableMapIterablepublic <P> V getIfAbsentPutWith(K key, com.gs.collections.api.block.function.Function<? super P,? extends V> function, P parameter)
com.gs.collections.api.map.MutableMapIterablepublic V removeKey(K key)
com.gs.collections.api.map.MutableMapIterablekey.public V add(com.gs.collections.api.tuple.Pair<K,V> keyValuePair)
com.gs.collections.api.map.MutableMapIterablepublic V updateValue(K key, com.gs.collections.api.block.function.Function0<? extends V> factory, com.gs.collections.api.block.function.Function<? super V,? extends V> function)
com.gs.collections.api.map.MutableMapIterablekey, 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.public <P> V updateValueWith(K key, com.gs.collections.api.block.function.Function0<? extends V> factory, com.gs.collections.api.block.function.Function2<? super V,? super P,? extends V> function, P parameter)
com.gs.collections.api.map.MutableMapIterableMutableMapIterable.updateValue(Object, Function0, Function) with a Function2 and specified parameter which is
passed to the function.