public class TreeSortedMap<K,V> extends AbstractMutableSortedMap<K,V> implements java.io.Externalizable
| Constructor and Description |
|---|
TreeSortedMap() |
TreeSortedMap(java.util.Comparator<? super K> comparator) |
TreeSortedMap(java.util.Comparator<? super K> comparator,
java.util.Map<? extends K,? extends V> map) |
TreeSortedMap(java.util.Map<? extends K,? extends V> map) |
TreeSortedMap(com.gs.collections.api.tuple.Pair<K,V>... pairs) |
TreeSortedMap(java.util.SortedMap<K,? extends V> map) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
TreeSortedMap<K,V> |
clone() |
java.util.Comparator<? super K> |
comparator() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
com.gs.collections.api.list.MutableList<V> |
distinct()
Returns a new
OrderedIterable containing the distinct elements in this iterable. |
com.gs.collections.api.map.sorted.MutableSortedMap<K,V> |
drop(int count)
Returns an iterable after skipping the first
count elements
or an empty iterable if the count is greater than the length of the iterable. |
com.gs.collections.api.map.sorted.MutableSortedMap<K,V> |
dropWhile(com.gs.collections.api.block.predicate.Predicate<? super V> predicate)
Returns the final elements that do not satisfy the Predicate.
|
com.gs.collections.api.set.MutableSet<java.util.Map.Entry<K,V>> |
entrySet() |
boolean |
equals(java.lang.Object o)
Follows the same general contract as
Map.equals(Object). |
K |
firstKey() |
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. |
V |
get(java.lang.Object key) |
int |
hashCode()
Follows the same general contract as
Map.hashCode(). |
com.gs.collections.api.map.sorted.MutableSortedMap<K,V> |
headMap(K toKey) |
com.gs.collections.api.set.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() |
com.gs.collections.api.map.sorted.MutableSortedMap<K,V> |
newEmpty()
Creates a new instance of the same type with the same internal Comparator.
|
static <K,V> TreeSortedMap<K,V> |
newMap() |
static <K,V> TreeSortedMap<K,V> |
newMap(java.util.Comparator<? super K> comparator) |
static <K,V> TreeSortedMap<K,V> |
newMap(java.util.Comparator<? super K> comparator,
java.util.Map<? extends K,? extends V> map) |
static <K,V> TreeSortedMap<K,V> |
newMap(java.util.Map<? extends K,? extends V> map) |
static <K,V> TreeSortedMap<K,V> |
newMapWith(java.util.Comparator<? super K> comparator,
K key,
V value) |
static <K,V> TreeSortedMap<K,V> |
newMapWith(java.util.Comparator<? super K> comparator,
K key1,
V value1,
K key2,
V value2) |
static <K,V> TreeSortedMap<K,V> |
newMapWith(java.util.Comparator<? super K> comparator,
K key1,
V value1,
K key2,
V value2,
K key3,
V value3) |
static <K,V> TreeSortedMap<K,V> |
newMapWith(java.util.Comparator<? super K> comparator,
K key1,
V value1,
K key2,
V value2,
K key3,
V value3,
K key4,
V value4) |
static <K,V> TreeSortedMap<K,V> |
newMapWith(java.util.Comparator<? super K> comparator,
com.gs.collections.api.tuple.Pair<K,V>... pairs) |
static <K,V> TreeSortedMap<K,V> |
newMapWith(K key,
V value) |
static <K,V> TreeSortedMap<K,V> |
newMapWith(K key1,
V value1,
K key2,
V value2) |
static <K,V> TreeSortedMap<K,V> |
newMapWith(K key1,
V value1,
K key2,
V value2,
K key3,
V value3) |
static <K,V> TreeSortedMap<K,V> |
newMapWith(K key1,
V value1,
K key2,
V value2,
K key3,
V value3,
K key4,
V value4) |
static <K,V> TreeSortedMap<K,V> |
newMapWith(com.gs.collections.api.tuple.Pair<K,V>... pairs) |
com.gs.collections.api.partition.list.PartitionMutableList<V> |
partitionWhile(com.gs.collections.api.block.predicate.Predicate<? super V> predicate)
Returns a Partition of the initial elements that satisfy the Predicate and the remaining elements.
|
V |
put(K key,
V value) |
void |
putAll(java.util.Map<? extends K,? extends V> map) |
void |
readExternal(java.io.ObjectInput in) |
V |
remove(java.lang.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.
|
com.gs.collections.api.map.sorted.MutableSortedMap<K,V> |
subMap(K fromKey,
K toKey) |
com.gs.collections.api.map.sorted.MutableSortedMap<K,V> |
tailMap(K fromKey) |
com.gs.collections.api.map.sorted.MutableSortedMap<K,V> |
take(int count)
Returns the first
count elements of the iterable
or all the elements in the iterable if count is greater than the length of
the iterable. |
com.gs.collections.api.map.sorted.MutableSortedMap<K,V> |
takeWhile(com.gs.collections.api.block.predicate.Predicate<? super V> predicate)
Returns the initial elements that satisfy the Predicate.
|
com.gs.collections.api.map.sorted.MutableSortedMap<K,V> |
toReversed()
Returns a new ReversibleIterable in reverse order.
|
java.lang.String |
toString()
Returns a string representation of this collection.
|
com.gs.collections.api.collection.MutableCollection<V> |
values() |
TreeSortedMap<K,V> |
with(K key,
V value) |
TreeSortedMap<K,V> |
with(K key1,
V value1,
K key2,
V value2) |
TreeSortedMap<K,V> |
with(K key1,
V value1,
K key2,
V value2,
K key3,
V value3) |
TreeSortedMap<K,V> |
with(K key1,
V value1,
K key2,
V value2,
K key3,
V value3,
K key4,
V value4) |
TreeSortedMap<K,V> |
with(com.gs.collections.api.tuple.Pair<K,V>... pairs) |
void |
writeExternal(java.io.ObjectOutput out) |
asReversed, asSynchronized, asUnmodifiable, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectKeysAndValues, collectLong, collectShort, collectValues, collectWith, corresponds, detectIndex, detectLastIndex, flatCollect, flip, forEach, forEachWithIndex, groupBy, groupByEach, indexOf, partition, partitionWith, reject, reject, rejectWith, reverseForEach, select, select, selectInstancesOf, selectWith, tap, toImmutable, toStack, withAllKeyValueArguments, withAllKeyValues, withKeyValue, withoutAllKeys, withoutKey, zip, zipWithIndexadd, aggregateBy, aggregateInPlaceBy, collect, detect, flipUniqueValues, getIfAbsentPut, getIfAbsentPut, getIfAbsentPutWith, getIfAbsentPutWithKey, groupByUniqueKey, iterator, keysView, keyValuesView, updateValue, updateValueWith, valuesViewallSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, asLazy, chunk, contains, detect, detectIfNone, detectWith, detectWithIfNone, each, forEachKey, forEachValue, forEachWith, forEachWithIndex, getFirst, getIfAbsent, getIfAbsentValue, getIfAbsentWith, getLast, ifPresentApply, isAbsent, keyAndValueEquals, keyAndValueHashCode, noneSatisfy, noneSatisfyWith, toArray, toArrayappendString, appendString, appendString, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, containsAll, containsAllArguments, containsAllIterable, count, countWith, flatCollect, forEach, groupBy, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, isEmpty, makeString, makeString, makeString, max, max, maxBy, min, min, minBy, notEmpty, reject, rejectWith, select, selectWith, sumByDouble, sumByFloat, sumByInt, sumByLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toBag, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toSortedSetBy, zip, zipWithIndexfinalize, getClass, notify, notifyAll, wait, wait, waitaggregateBy, aggregateInPlaceBy, collect, getIfAbsentPutWith, groupByUniqueKeyadd, flipUniqueValues, getIfAbsentPut, getIfAbsentPut, getIfAbsentPutWithKey, updateValue, updateValueWithdetect, forEachKey, forEachValue, getIfAbsent, getIfAbsentValue, getIfAbsentWith, ifPresentApply, keysView, keyValuesView, valuesViewforEachWithIndex, getFirst, getLast, max, min, zip, zipWithIndexallSatisfy, 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, flatCollect, groupBy, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, isEmpty, makeString, makeString, makeString, max, maxBy, min, minBy, noneSatisfy, noneSatisfyWith, notEmpty, reject, rejectWith, select, selectWith, sumByDouble, sumByFloat, sumByInt, sumByLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toSortedSetBypublic TreeSortedMap()
public TreeSortedMap(java.util.Comparator<? super K> comparator)
public TreeSortedMap(java.util.Comparator<? super K> comparator, java.util.Map<? extends K,? extends V> map)
public static <K,V> TreeSortedMap<K,V> newMap()
public static <K,V> TreeSortedMap<K,V> newMap(java.util.Comparator<? super K> comparator)
public static <K,V> TreeSortedMap<K,V> newMap(java.util.Map<? extends K,? extends V> map)
public static <K,V> TreeSortedMap<K,V> newMap(java.util.Comparator<? super K> comparator, java.util.Map<? extends K,? extends V> map)
public static <K,V> TreeSortedMap<K,V> newMapWith(com.gs.collections.api.tuple.Pair<K,V>... pairs)
public static <K,V> TreeSortedMap<K,V> newMapWith(java.util.Comparator<? super K> comparator, com.gs.collections.api.tuple.Pair<K,V>... pairs)
public static <K,V> TreeSortedMap<K,V> newMapWith(K key, V value)
public static <K,V> TreeSortedMap<K,V> newMapWith(K key1, V value1, K key2, V value2)
public static <K,V> TreeSortedMap<K,V> newMapWith(K key1, V value1, K key2, V value2, K key3, V value3)
public static <K,V> TreeSortedMap<K,V> newMapWith(K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4)
public static <K,V> TreeSortedMap<K,V> newMapWith(java.util.Comparator<? super K> comparator, K key, V value)
public static <K,V> TreeSortedMap<K,V> newMapWith(java.util.Comparator<? super K> comparator, K key1, V value1, K key2, V value2)
public static <K,V> TreeSortedMap<K,V> newMapWith(java.util.Comparator<? super K> comparator, K key1, V value1, K key2, V value2, K key3, V value3)
public static <K,V> TreeSortedMap<K,V> newMapWith(java.util.Comparator<? super K> comparator, K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4)
public TreeSortedMap<K,V> with(K key, V value)
public TreeSortedMap<K,V> with(K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4)
public TreeSortedMap<K,V> with(com.gs.collections.api.tuple.Pair<K,V>... pairs)
public int size()
com.gs.collections.api.RichIterablepublic com.gs.collections.api.map.sorted.MutableSortedMap<K,V> newEmpty()
com.gs.collections.api.map.sorted.MutableSortedMappublic V removeKey(K key)
com.gs.collections.api.map.MutableMapIterablekey.public TreeSortedMap<K,V> clone()
public 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 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.set.MutableSet<K> keySet()
com.gs.collections.api.map.sorted.MutableSortedMappublic com.gs.collections.api.collection.MutableCollection<V> values()
public java.util.Comparator<? super K> comparator()
public V get(java.lang.Object key)
public boolean containsKey(java.lang.Object key)
public boolean containsValue(java.lang.Object value)
public com.gs.collections.api.map.sorted.MutableSortedMap<K,V> toReversed()
com.gs.collections.api.ordered.ReversibleIterablepublic com.gs.collections.api.map.sorted.MutableSortedMap<K,V> take(int count)
com.gs.collections.api.ordered.ReversibleIterablecount elements of the iterable
or all the elements in the iterable if count is greater than the length of
the iterable.take in interface com.gs.collections.api.map.sorted.MutableSortedMap<K,V>take in interface com.gs.collections.api.map.sorted.SortedMapIterable<K,V>take in interface com.gs.collections.api.ordered.ReversibleIterable<V>count - the number of items to take.public com.gs.collections.api.map.sorted.MutableSortedMap<K,V> takeWhile(com.gs.collections.api.block.predicate.Predicate<? super V> predicate)
com.gs.collections.api.ordered.ReversibleIterabletakeWhile in interface com.gs.collections.api.map.sorted.MutableSortedMap<K,V>takeWhile in interface com.gs.collections.api.map.sorted.SortedMapIterable<K,V>takeWhile in interface com.gs.collections.api.ordered.OrderedIterable<V>takeWhile in interface com.gs.collections.api.ordered.ReversibleIterable<V>public com.gs.collections.api.map.sorted.MutableSortedMap<K,V> drop(int count)
com.gs.collections.api.ordered.ReversibleIterablecount elements
or an empty iterable if the count is greater than the length of the iterable.drop in interface com.gs.collections.api.map.sorted.MutableSortedMap<K,V>drop in interface com.gs.collections.api.map.sorted.SortedMapIterable<K,V>drop in interface com.gs.collections.api.ordered.ReversibleIterable<V>count - the number of items to drop.public com.gs.collections.api.map.sorted.MutableSortedMap<K,V> dropWhile(com.gs.collections.api.block.predicate.Predicate<? super V> predicate)
com.gs.collections.api.ordered.ReversibleIterabledropWhile in interface com.gs.collections.api.map.sorted.MutableSortedMap<K,V>dropWhile in interface com.gs.collections.api.map.sorted.SortedMapIterable<K,V>dropWhile in interface com.gs.collections.api.ordered.OrderedIterable<V>dropWhile in interface com.gs.collections.api.ordered.ReversibleIterable<V>public com.gs.collections.api.partition.list.PartitionMutableList<V> partitionWhile(com.gs.collections.api.block.predicate.Predicate<? super V> predicate)
com.gs.collections.api.ordered.OrderedIterablepartitionWhile in interface com.gs.collections.api.map.sorted.MutableSortedMap<K,V>partitionWhile in interface com.gs.collections.api.map.sorted.SortedMapIterable<K,V>partitionWhile in interface com.gs.collections.api.ordered.OrderedIterable<V>partitionWhile in interface com.gs.collections.api.ordered.ReversibleIterable<V>public com.gs.collections.api.list.MutableList<V> distinct()
com.gs.collections.api.ordered.OrderedIterableOrderedIterable containing the distinct elements in this iterable.
Conceptually similar to RichIterable.toSet().RichIterable.toList() but retains the original order. If an element appears
multiple times in this iterable, the first one will be copied into the result.
distinct in interface com.gs.collections.api.map.sorted.MutableSortedMap<K,V>distinct in interface com.gs.collections.api.map.sorted.SortedMapIterable<K,V>distinct in interface com.gs.collections.api.ordered.OrderedIterable<V>distinct in interface com.gs.collections.api.ordered.ReversibleIterable<V>OrderedIterable of distinct elementspublic java.lang.String toString()
AbstractRichIterable
This implementation creates an empty string buffer, appends a left square bracket, and iterates over the collection appending the string representation of each element in turn. After appending each element except the last, the string ", " is appended. Finally a right bracket is appended. A string is obtained from the string buffer, and returned.
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizablejava.io.IOExceptionpublic void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.Externalizablejava.io.IOExceptionjava.lang.ClassNotFoundException