A MutableMap
implemented using a red/black tree.
Entries in the map are maintained in a sorted order, from
smallest to largest key, as determined by the given
comparator function.
naturalOrderTreeMap()
no subtypes hierarchy
Constructors | |
TreeMap | Source Codeshared TreeMap(Comparison compare(Key x, Key y), {<Key->Item>*} entries = ...) Create a new |
copy | Source Codeshared copy(TreeMap<Key,Item> treeMap) Create a new |
Attributes | |
first | Source Codeshared actual <Key->Item>? first The first element returned by the iterator, if any, or
Refines Iterable.first |
hash | Source Codeshared actual Integer hash The hash value of the value, which allows the value to be an element of a hash-based set or key of a hash-based map. Implementations must respect the constraint that:
Therefore, a class which refines In general, Note that when executing on a Java Virtual Machine, the
64-bit |
last | Source Codeshared actual <Key->Item>? last The last element returned by the iterator, if any, or
Refines Iterable.last |
size | Source Codeshared actual Integer size The number of elements returned by the Refines Iterable.size |
string | Source Codeshared actual String string A developer-friendly string representing the instance.
Concatenates the name of the concrete class of the
instance with the |
Inherited Attributes |
Attributes inherited from: Object |
Attributes inherited from: Collection<Element> |
Attributes inherited from: Correspondence<Key,Item> |
Attributes inherited from: Iterable<Element,Absent> |
Attributes inherited from: Map<Key,Item> |
Methods | |
ascendingEntries | Source Codeshared actual {<Key->Item>*} ascendingEntries(Key from, Key to) The entries with keys larger than or equal to the first given value, and smaller than or equal to the second given value, sorted in ascending order. This is a lazy operation, returning a view of the underlying sorted map. Refines SortedMap.ascendingEntries |
assertInvariants | Source Codeshared void assertInvariants() |
clear | Source Codeshared actual void clear() Remove every entry from this map, leaving an empty map with no entries. Refines MapMutator.clear |
clone | Source Codeshared actual TreeMap<Key,Item> clone() A shallow copy of this collection, that is, a collection with identical elements which does not change if this collection changes. If this collection is immutable, it is acceptable to return a reference to this collection. If this collection is mutable, a newly instantiated collection must be returned. |
contains | Source Codeshared actual Boolean contains(Object entry) Returns For any instance element in c For most
However, it is possible to form a useful |
defines | Source Codeshared actual Boolean defines(Object key) Determines if there is a value defined for the given key. |
descendingEntries | Source Codeshared actual {<Key->Item>*} descendingEntries(Key from, Key to) The entries with keys smaller than or equal to the first given value, and larger than or equal to the second given value, sorted in descending order. This is a lazy operation, returning a view of the underlying sorted map. Refines SortedMap.descendingEntries |
equals | Source Codeshared actual Boolean equals(Object that) Determine if two values are equal. For any two non-null objects x == y Implementations should respect the constraints that:
Furthermore it is recommended that implementations
ensure that if A class which explicitly refines Note that an implementation of |
get | Source Codeshared actual Item? get(Object key) Returns the value defined for the given key, or For any instance c[key] |
getOrDefault | Source Codeshared actual Item|Default getOrDefault<Default>(Object key, Default default) Returns the item of the entry with the given For maps with non-null items, the expression: map.getOrDefault(key, def) is equivalent to this common idiom: map[key] else def However, when the map has null items, Note that high-quality implementations of Refines Map.getOrDefault |
higherEntries | Source Codeshared actual {<Key->Item>*} higherEntries(Key key) The entries with keys larger than or equal to the given
This is a lazy operation, returning a view of the underlying sorted map. Refines SortedMap.higherEntries |
iterator | Source Codeshared actual Iterator<Key->Item> iterator() An iterator for the elements belonging to this stream. If this is a nonempty stream with type Refines Iterable.iterator |
lowerEntries | Source Codeshared actual {<Key->Item>*} lowerEntries(Key key) The entries with keys smaller than or equal to the
given This is a lazy operation, returning a view of the underlying sorted map. Refines SortedMap.lowerEntries |
measure | Source Codeshared actual TreeMap<Key,Item> measure(Key from, Integer length) Obtain a measure containing the mapped values starting
from the given starting index ( For any ranged stream r[from:length] The measure should contain the given number ( When the given index does not belong to this ranged object, the behavior is implementation dependent. Refines Ranged.measure |
put | Source Codeshared actual Item? put(Key key, Item item) Set the item associated with the given For any instance c[key] = item |
remove | Source Codeshared actual Item? remove(Key key) Remove the entry associated with the given |
removeEntry | Source Codeshared actual Boolean removeEntry(Key key, Item&Object item) Remove the entry associated with the given Refines MapMutator.removeEntry |
replaceEntry | Source Codeshared actual Boolean replaceEntry(Key key, Item&Object item, Item newItem) |
span | Source Codeshared actual TreeMap<Key,Item> span(Key from, Key to) Obtain a span containing the elements between the two given indices. For any ranged stream r[from..to] The span should contain elements of this stream,
starting from the element at the given starting
index ( When one or both of the given indices does not belong to this ranged stream, the behavior is implementation dependent. Refines Ranged.span |
spanFrom | Source Codeshared actual TreeMap<Key,Item> spanFrom(Key from) Obtain a span containing the elements between the given
starting index ( For any ranged stream r[from...] The span should contain elements of this stream,
starting from the element at the given starting
index ( When the given index does not belong to this ranged stream, the behavior is implementation dependent. Refines Ranged.spanFrom |
spanTo | Source Codeshared actual TreeMap<Key,Item> spanTo(Key to) Obtain a span containing the elements between the first
index of this ranged stream and given end index ( For any ranged stream r[...to] The span should contain elements of this stream, up to
the element at the given ending index ( When the given index does not belong to this ranged stream, the behavior is implementation dependent. Refines Ranged.spanTo |
Inherited Methods |
Methods inherited from: Object |
Methods inherited from: Category<Element> |
Methods inherited from: Collection<Element> |
Methods inherited from: Correspondence<Key,Item> |
Methods inherited from: Iterable<Element,Absent> any() , by() , chain() , collect() , contains() , count() , defaultNullElements() , each() , every() , filter() , find() , findLast() , flatMap() , fold() , follow() , frequencies() , getFromFirst() , group() , indexes() , interpose() , iterator() , locate() , locateLast() , locations() , longerThan() , map() , max() , narrow() , partition() , product() , reduce() , repeat() , scan() , select() , sequence() , shorterThan() , skip() , skipWhile() , sort() , spread() , summarize() , tabulate() , take() , takeWhile() |
Methods inherited from: KeyedCorrespondenceMutator<Key,Item> |
Methods inherited from: Map<Key,Item> |
Methods inherited from: MapMutator<Key,Item> |
Methods inherited from: MutableMap<Key,Item> |
Methods inherited from: Ranged<Index,Element,Subrange> |
Methods inherited from: SortedMap<Key,Item> |