ImmutableMap
| Modifier and Type | Field and Description |
|---|---|
| private final UnifiedMap | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | batchForEach(Procedure<? super V> procedure, int sectionIndex, int sectionCount)
Implements org.
|
| public boolean | containsKey(Object key)
Implements org. Returns |
| public boolean | containsValue(Object value)
Implements org. Returns |
| public boolean | equals(Object o)
Overrides java. Implements org. Compares the specified object with this map for equality. |
| public void | forEachKey(Procedure<? super K> procedure)
Overrides org. Implements org. Calls the |
| public void | forEachKeyValue(Procedure2<? super K, ? super V> procedure)
Implements org. Calls the |
| public void | forEachValue(Procedure<? super V> procedure)
Overrides org. Implements org. Calls the procedure with each value of the map. |
| public <P> void | forEachWith(Procedure2<? super V, ? super P> procedure, P parameter)
Overrides org. Implements org. The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument. |
| public void | forEachWithIndex(ObjectIntProcedure<? super V> objectIntProcedure)
Overrides org. Implements org. Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure. |
| public V | get(Object key)
Implements org. Returns the value to which the specified key is mapped,
or |
| public int | getBatchCount(int batchSize)
Implements org.
|
| public V | getIfAbsent(K key, Function0<? extends V> function)
Overrides org. Implements org. 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. |
| public V | getIfAbsentValue(K key, V value)
Overrides org. Implements org. Return the value in the Map that corresponds to the specified key, or if there is no value at the key, return |
| public <P> V | getIfAbsentWith(K key, Function<? super P, ? extends V> function, P parameter)
Overrides org. Implements org. 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. |
| public int | hashCode()
Overrides java. Implements org. Returns the hash code value for this map. |
| public <A> A | ifPresentApply(K key, Function<? super V, ? extends A> function)
Overrides org. Implements org. 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. |
| public Set | |
| public RichIterable | keysView()
Implements org. Returns an unmodifiable lazy iterable wrapped around the keySet for the map. |
| public RichIterable | keyValuesView()
Implements org. Returns an unmodifiable lazy iterable of key/value pairs wrapped around the entrySet for the map. |
| public int | size()
Implements org. Returns the number of key-value mappings in this map. |
| public String | toString()
Overrides org. Implements org. Returns a string with the keys and values of this map separated by commas with spaces and enclosed in curly braces. |
| public Collection | values()
Implements java. Returns a |
| public RichIterable | valuesView()
Implements org. Returns an unmodifiable lazy iterable wrapped around the values for the map. |
| protected Object |
| delegate | back to summary |
|---|---|
| private final UnifiedMap<K, V> delegate | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| ImmutableUnifiedMap | back to summary |
|---|---|
| public ImmutableUnifiedMap(Map<? extends K, ? extends V> delegate) | |
| ImmutableUnifiedMap | back to summary |
|---|---|
| public ImmutableUnifiedMap(Pair<K, V>... pairs) | |
| batchForEach | back to summary |
|---|---|
| public void batchForEach(Procedure<? super V> procedure, int sectionIndex, int sectionCount) Implements org.
| |
| containsKey | back to summary |
|---|---|
| public boolean containsKey(Object key) Implements org. Doc from java. Returns
| |
| containsValue | back to summary |
|---|---|
| public boolean containsValue(Object value) Implements org. Doc from java. Returns
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Implements org. Doc from java. Compares the specified object with this map for equality. Returns
| |
| forEachKey | back to summary |
|---|---|
| public void forEachKey(Procedure<? super K> procedure) Overrides org. Implements org. Doc from org. Calls the
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);
| |
| forEachKeyValue | back to summary |
|---|---|
| public void forEachKeyValue(Procedure2<? super K, ? super V> procedure) Implements org. Doc from org. Calls the
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");
| |
| forEachValue | back to summary |
|---|---|
| public void forEachValue(Procedure<? super V> procedure) Overrides org. Implements org. Doc from org. 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);
| |
| forEachWith | back to summary |
|---|---|
| public <P> void forEachWith(Procedure2<? super V, ? super P> procedure, P parameter) Overrides org. Implements org. Doc from org. 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);
| |
| forEachWithIndex | back to summary |
|---|---|
| public void forEachWithIndex(ObjectIntProcedure<? super V> objectIntProcedure) Overrides org. Implements org. Doc from org. 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());
}
});
| |
| get | back to summary |
|---|---|
| public V get(Object key) Implements org. Doc from java. Returns the value to which the specified key is mapped,
or More formally, if this map contains a mapping from a key
If this map permits null values, then a return value of
| |
| getBatchCount | back to summary |
|---|---|
| public int getBatchCount(int batchSize) Implements org.
| |
| getIfAbsent | back to summary |
|---|---|
| public V getIfAbsent(K key, Function0<? extends V> function) Overrides org. Implements org. Doc from org. 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.
| |
| getIfAbsentValue | back to summary |
|---|---|
| public V getIfAbsentValue(K key, V value) Overrides org. Implements org. Doc from org. Return the value in the Map that corresponds to the specified key, or if there is no value at the key, return
| |
| getIfAbsentWith | back to summary |
|---|---|
| public <P> V getIfAbsentWith(K key, Function<? super P, ? extends V> function, P parameter) Overrides org. Implements org. Doc from org. 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.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Implements org. Doc from java. Returns the hash code value for this map. The hash code of a map is
defined to be the sum of the hash codes of each entry in the map's
| |
| ifPresentApply | back to summary |
|---|---|
| public <A> A ifPresentApply(K key, Function<? super V, ? extends A> function) Overrides org. Implements org. Doc from org. 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.
| |
| keySet | back to summary |
|---|---|
| public Set Implements java. Doc from java. Returns a
| |
| keysView | back to summary |
|---|---|
| public RichIterable Implements org. Doc from org. Returns an unmodifiable lazy iterable wrapped around the keySet for the map.
| |
| keyValuesView | back to summary |
|---|---|
| public RichIterable Implements org. Doc from org. Returns an unmodifiable lazy iterable of key/value pairs wrapped around the entrySet for the map.
| |
| size | back to summary |
|---|---|
| public int size() Implements org. Doc from java. Returns the number of key-value mappings in this map. If the
map contains more than
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides org. Implements org. Doc from org. Returns a string with the keys and values of this map separated by commas with spaces and enclosed in curly braces. Each key and value is separated by an equals sign.
Assert.assertEquals("{1=1, 2=2, 3=3}", Maps.mutable.with(1, 1, 2, 2, 3, 3).toString());
| |
| values | back to summary |
|---|---|
| public Collection Implements java. Doc from java. Returns a
| |
| valuesView | back to summary |
|---|---|
| public RichIterable Implements org. Doc from org. Returns an unmodifiable lazy iterable wrapped around the values for the map.
| |
| writeReplace | back to summary |
|---|---|
| protected Object writeReplace() | |