@Immutable public class ImmutableUnifiedMap<K,V> extends AbstractImmutableMap<K,V> implements BatchIterable<V>, java.io.Serializable
AbstractImmutableMap.ImmutableMapSerializationProxy<K,V>| Constructor and Description |
|---|
ImmutableUnifiedMap(java.util.Map<K,V> delegate) |
ImmutableUnifiedMap(com.gs.collections.api.tuple.Pair<K,V>... pairs) |
| Modifier and Type | Method and Description |
|---|---|
void |
batchForEach(com.gs.collections.api.block.procedure.Procedure<? super V> procedure,
int sectionIndex,
int sectionCount) |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
boolean |
equals(java.lang.Object o)
Follows the same general contract as
Map.equals(Object). |
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> procedure)
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.
|
<P> void |
forEachWith(com.gs.collections.api.block.procedure.Procedure2<? super V,? super P> procedure,
P parameter)
The procedure2 is evaluated for each element in the iterable with the specified parameter provided
as the second argument.
|
void |
forEachWithIndex(com.gs.collections.api.block.procedure.primitive.ObjectIntProcedure<? super V> objectIntProcedure)
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) |
int |
getBatchCount(int batchSize) |
int |
hashCode()
Follows the same general contract as
Map.hashCode(). |
java.util.Set<K> |
keySet() |
com.gs.collections.api.RichIterable<K> |
keysView()
Returns an unmodifiable lazy iterable wrapped around the keySet for the map
|
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
|
int |
size()
Returns the number of items in this iterable.
|
java.lang.String |
toString()
Returns a string representation of this MapIterable.
|
java.util.Collection<V> |
values() |
com.gs.collections.api.RichIterable<V> |
valuesView()
Returns an unmodifiable lazy iterable wrapped around the values for the map
|
protected java.lang.Object |
writeReplace() |
aggregateBy, aggregateInPlaceBy, castToMap, clear, collect, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectValues, detect, entrySet, flatCollect, groupBy, groupByEach, iterator, newWithAllKeyValueArguments, newWithAllKeyValues, newWithKeyValue, newWithoutAllKeys, newWithoutKey, partition, put, putAll, reject, reject, remove, select, select, selectInstancesOf, toMap, zip, zipWithIndexallSatisfy, anySatisfy, appendString, appendString, appendString, asLazy, chunk, collect, collectIf, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, count, detect, detectIfNone, flatCollect, forEach, getFirst, getIfAbsent, getIfAbsentValue, getIfAbsentWith, getLast, groupBy, groupByEach, ifPresentApply, injectInto, injectInto, injectInto, injectInto, injectInto, isAbsent, isEmpty, keyAndValueEquals, keyAndValueHashCode, makeString, makeString, makeString, max, max, maxBy, min, min, minBy, noneSatisfy, notEmpty, reject, rejectWith, select, selectWith, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toList, toMap, toSet, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toSortedSetBy, zip, zipWithIndexclone, finalize, getClass, notify, notifyAll, wait, wait, waitforEachgetIfAbsent, getIfAbsentValue, getIfAbsentWith, ifPresentApplyallSatisfy, anySatisfy, appendString, appendString, appendString, asLazy, chunk, collect, collectIf, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, count, detect, detectIfNone, flatCollect, getFirst, getLast, groupBy, groupByEach, injectInto, injectInto, injectInto, injectInto, injectInto, isEmpty, makeString, makeString, makeString, max, max, maxBy, min, min, minBy, noneSatisfy, notEmpty, reject, rejectWith, select, selectWith, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toList, toMap, toSet, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toSortedSetBy, zip, zipWithIndexpublic boolean equals(java.lang.Object o)
com.gs.collections.api.map.MapIterableMap.equals(Object).public int hashCode()
com.gs.collections.api.map.MapIterableMap.hashCode().public java.lang.String toString()
com.gs.collections.api.map.MapIterableString.valueOf(Object).public int size()
com.gs.collections.api.RichIterablepublic boolean containsKey(java.lang.Object key)
public boolean containsValue(java.lang.Object value)
public V get(java.lang.Object key)
public int getBatchCount(int batchSize)
getBatchCount in interface BatchIterable<V>public void batchForEach(com.gs.collections.api.block.procedure.Procedure<? super V> procedure, int sectionIndex, int sectionCount)
batchForEach in interface BatchIterable<V>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);
forEachValue in interface com.gs.collections.api.map.MapIterable<K,V>forEachValue in class AbstractMapIterable<K,V>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);
forEachKey in interface com.gs.collections.api.map.MapIterable<K,V>forEachKey in class AbstractMapIterable<K,V>public void forEachKeyValue(com.gs.collections.api.block.procedure.Procedure2<? super K,? super V> procedure)
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.RichIterable<K> keysView()
com.gs.collections.api.map.MapIterablepublic com.gs.collections.api.RichIterable<V> valuesView()
com.gs.collections.api.map.MapIterablepublic com.gs.collections.api.RichIterable<com.gs.collections.api.tuple.Pair<K,V>> keyValuesView()
com.gs.collections.api.map.MapIterablepublic void forEachWithIndex(com.gs.collections.api.block.procedure.primitive.ObjectIntProcedure<? super V> objectIntProcedure)
com.gs.collections.api.InternalIterablee.g. people.forEachWithIndex(new ObjectIntProcedure() { public void value(Person person, int index) { LOGGER.info("Index: " + index + " person: " + person.getName()); } });
forEachWithIndex in interface com.gs.collections.api.InternalIterable<V>forEachWithIndex in class AbstractMapIterable<K,V>public <P> void forEachWith(com.gs.collections.api.block.procedure.Procedure2<? super V,? super P> procedure, P parameter)
com.gs.collections.api.InternalIterablee.g. people.forEachWith(new Procedure2() { public void value(Person person, Person other) { if (person.isRelatedTo(other)) { LOGGER.info(person.getName()); } } }, fred);
forEachWith in interface com.gs.collections.api.InternalIterable<V>forEachWith in class AbstractMapIterable<K,V>protected java.lang.Object writeReplace()