@Immutable public class ImmutableTreeMap<K,V> extends AbstractImmutableSortedMap<K,V>
Constructor and Description |
---|
ImmutableTreeMap(SortedMap<K,V> sortedMap) |
Modifier and Type | Method and Description |
---|---|
Comparator<? super K> |
comparator() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
boolean |
equals(Object o)
Follows the same general contract as
Map.equals(Object) . |
K |
firstKey() |
ImmutableMap<V,K> |
flipUniqueValues()
Return the MapIterable that is obtained by flipping the direction of this map and making the associations
from value to key.
|
void |
forEachKeyValue(Procedure2<? super K,? super V> procedure)
Calls the
procedure with each key-value pair of the map. |
V |
get(Object key) |
int |
hashCode()
Follows the same general contract as
Map.hashCode() . |
Set<K> |
keySet() |
RichIterable<K> |
keysView()
Returns an unmodifiable lazy iterable wrapped around the keySet for the map
|
RichIterable<Pair<K,V>> |
keyValuesView()
Returns an unmodifiable lazy iterable of key/value pairs wrapped around the entrySet for the map
|
K |
lastKey() |
static <K,V> ImmutableSortedMap<K,V> |
newMap(SortedMap<K,V> sortedMap) |
int |
size()
Returns the number of items in this iterable.
|
String |
toString()
Returns a string representation of this MapIterable.
|
Collection<V> |
values() |
RichIterable<V> |
valuesView()
Returns an unmodifiable lazy iterable wrapped around the values for the map
|
aggregateBy, aggregateInPlaceBy, castToSortedMap, clear, collect, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectValues, collectWith, detect, detectWith, detectWithIfNone, entrySet, flatCollect, flip, groupBy, groupByEach, groupByUniqueKey, headMap, iterator, newWithAllKeyValueArguments, newWithAllKeyValues, newWithKeyValue, newWithoutAllKeys, newWithoutKey, partition, partitionWith, put, putAll, reject, reject, rejectWith, remove, select, select, selectInstancesOf, selectWith, subMap, tailMap, toImmutable, toSortedMap, zip, zipWithIndex
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, flatCollect, forEach, forEachKey, forEachValue, forEachWith, forEachWithIndex, getFirst, getIfAbsent, getIfAbsentValue, getIfAbsentWith, getLast, groupBy, groupByEach, ifPresentApply, injectInto, injectInto, injectInto, injectInto, injectInto, isEmpty, makeString, makeString, makeString, max, max, maxBy, min, min, minBy, noneSatisfy, noneSatisfyWith, notEmpty, reject, rejectWith, select, selectWith, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toList, toMap, toSet, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toSortedSetBy, zip, zipWithIndex
forEachKey, forEachValue, getIfAbsent, getIfAbsentValue, getIfAbsentWith, ifPresentApply
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, flatCollect, getFirst, getLast, groupBy, groupByEach, injectInto, injectInto, injectInto, injectInto, injectInto, isEmpty, makeString, makeString, makeString, max, max, maxBy, min, min, minBy, noneSatisfy, noneSatisfyWith, notEmpty, reject, rejectWith, select, selectWith, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toList, toMap, toSet, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toSortedSetBy, zip, zipWithIndex
forEach, forEachWith, forEachWithIndex
forEach, spliterator
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, isEmpty, merge, putIfAbsent, remove, replace, replace, replaceAll
public static <K,V> ImmutableSortedMap<K,V> newMap(SortedMap<K,V> sortedMap)
public boolean equals(Object o)
MapIterable
Map.equals(Object)
.public int hashCode()
MapIterable
Map.hashCode()
.public String toString()
MapIterable
String.valueOf(Object)
.toString
in interface MapIterable<K,V>
toString
in interface RichIterable<V>
toString
in class Object
public int size()
RichIterable
public boolean containsKey(Object key)
Map.containsKey(Object)
public boolean containsValue(Object value)
Map.containsValue(Object)
public V get(Object key)
Map.get(Object)
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(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 ImmutableMap<V,K> flipUniqueValues()
MapIterable
MapIterablemap = this.newMapWithKeysValues(1, "1", 2, "2", 3, "3"); MapIterable result = map.flipUniqueValues(); Assert.assertTrue(result.equals(UnifiedMap.newWithKeysValues("1", 1, "2", 2, "3", 3)));
public RichIterable<K> keysView()
MapIterable
public RichIterable<V> valuesView()
MapIterable
public RichIterable<Pair<K,V>> keyValuesView()
MapIterable
public Comparator<? super K> comparator()
public K firstKey()
public K lastKey()
public Collection<V> values()
Copyright © 2004–2019. All rights reserved.