public class SortedMapAdapter<K,V> extends AbstractMutableSortedMap<K,V> implements Serializable
adapt(SortedMap)
factory method.Modifier and Type | Method and Description |
---|---|
static <K,V> MutableSortedMap<K,V> |
adapt(SortedMap<K,V> map) |
void |
clear() |
MutableSortedMap<K,V> |
clone() |
Comparator<? super K> |
comparator() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
MutableSet<Map.Entry<K,V>> |
entrySet() |
boolean |
equals(Object o)
Follows the same general contract as
Map.equals(Object) . |
K |
firstKey() |
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() . |
MutableSortedMap<K,V> |
headMap(K toKey) |
boolean |
isEmpty()
Returns true if this iterable has zero items.
|
Iterator<V> |
iterator() |
MutableSet<K> |
keySet()
The underlying set for the keys is sorted in ascending order according to their natural ordering or a custom comparator.
|
K |
lastKey() |
MutableSortedMap<K,V> |
newEmpty()
Deprecated.
use
TreeSortedMap.newEmpty() instead (inlineable) |
V |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> map) |
V |
remove(Object key) |
V |
removeKey(K key)
Remove an entry from the map at the specified
key . |
int |
size()
Returns the number of items in this iterable.
|
MutableSortedMap<K,V> |
subMap(K fromKey,
K toKey) |
MutableSortedMap<K,V> |
tailMap(K fromKey) |
String |
toString()
Returns a string representation of this MapIterable.
|
MutableCollection<V> |
values() |
MutableSortedMap<K,V> |
with(Pair<K,V>... pairs) |
aggregateBy, aggregateInPlaceBy, asSynchronized, asUnmodifiable, collect, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectKeysAndValues, collectLong, collectShort, collectValues, collectWith, detect, flatCollect, flip, flipUniqueValues, getIfAbsentPut, getIfAbsentPutWith, getIfAbsentPutWithKey, groupBy, groupByEach, groupByUniqueKey, keysView, keyValuesView, partition, partitionWith, reject, reject, rejectWith, select, select, selectInstancesOf, selectWith, toImmutable, valuesView, 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, detectWith, detectWithIfNone, flatCollect, forEach, forEachKey, forEachValue, forEachWith, forEachWithIndex, getFirst, getIfAbsent, getIfAbsentValue, getIfAbsentWith, getLast, groupBy, groupByEach, ifPresentApply, injectInto, injectInto, injectInto, injectInto, injectInto, 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, detectWith, detectWithIfNone, flatCollect, getFirst, getLast, groupBy, groupByEach, injectInto, injectInto, injectInto, injectInto, injectInto, 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, merge, putIfAbsent, remove, replace, replace, replaceAll
public static <K,V> MutableSortedMap<K,V> adapt(SortedMap<K,V> map)
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");
forEachKeyValue
in interface MapIterable<K,V>
@Deprecated public MutableSortedMap<K,V> newEmpty()
TreeSortedMap.newEmpty()
instead (inlineable)MutableSortedMap
newEmpty
in interface MutableSortedMap<K,V>
public boolean containsKey(Object key)
containsKey
in interface MapIterable<K,V>
containsKey
in interface Map<K,V>
Map.containsKey(Object)
public boolean containsValue(Object value)
containsValue
in interface MapIterable<K,V>
containsValue
in interface Map<K,V>
Map.containsValue(Object)
public Comparator<? super K> comparator()
comparator
in interface SortedMapIterable<K,V>
comparator
in interface SortedMap<K,V>
public int size()
RichIterable
public boolean isEmpty()
RichIterable
public MutableCollection<V> values()
public MutableSet<Map.Entry<K,V>> entrySet()
public MutableSet<K> keySet()
MutableSortedMap
public MutableSortedMap<K,V> headMap(K toKey)
public MutableSortedMap<K,V> tailMap(K fromKey)
public MutableSortedMap<K,V> subMap(K fromKey, K toKey)
public V get(Object key)
get
in interface MapIterable<K,V>
get
in interface Map<K,V>
Map.get(Object)
public V removeKey(K key)
MutableSortedMap
key
.removeKey
in interface MutableSortedMap<K,V>
Map.remove(Object)
public MutableSortedMap<K,V> with(Pair<K,V>... pairs)
with
in interface MutableSortedMap<K,V>
public String toString()
MapIterable
String.valueOf(Object)
.toString
in interface MapIterable<K,V>
toString
in interface RichIterable<V>
toString
in class Object
public MutableSortedMap<K,V> clone()
clone
in interface MutableSortedMap<K,V>
clone
in class AbstractMutableSortedMap<K,V>
public boolean equals(Object o)
MapIterable
Map.equals(Object)
.public int hashCode()
MapIterable
Map.hashCode()
.Copyright © 2004–2019. All rights reserved.