A MutableSet
implemented using a red/black tree.
Elements of the set are maintained in a sorted order, from
smallest to largest, as determined by the given
comparator function.
naturalOrderTreeSet()
no subtypes hierarchy
Constructors | |
TreeSet | Source Codeshared TreeSet(Comparison compare(Element x, Element y), {Element*} elements = ...) Create a new |
copy | Source Codeshared copy(TreeSet<Element> treeSet) Create a new |
Attributes | |
first | Source Codeshared actual Element? 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 Element? last The last element returned by the iterator, if any, or
Refines Iterable.last |
Inherited Attributes |
Attributes inherited from: Object |
Attributes inherited from: Collection<Element> |
Attributes inherited from: Iterable<Element,Absent> |
Attributes inherited from: Set<Element> |
Methods | |
add | Source Codeshared actual Boolean add(Element element) Add the given Refines SetMutator.add |
ascendingElements | Source Codeshared actual {Element*} ascendingElements(Element from, Element to) The elements 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 set. Refines SortedSet.ascendingElements |
clear | Source Codeshared actual void clear() Remove every element from this set, leaving an empty set with no elements. Refines SetMutator.clear |
clone | Source Codeshared actual TreeSet<Element> 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. |
complement | Source Codeshared actual HashSet<Element> complement<Other>(Set<Other> set) Returns a new For example: set { "hello", "world" } ~ set { 1, 2, "hello" } Produces the set Refines Set.complement |
contains | Source Codeshared actual Boolean contains(Object element) Returns For any instance element in c For most
However, it is possible to form a useful |
descendingElements | Source Codeshared actual {Element*} descendingElements(Element from, Element to) The elements 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 set. Refines SortedSet.descendingElements |
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 |
exclusiveUnion | Source Codeshared actual HashSet<Element|Other> exclusiveUnion<Other>(Set<Other> set) Returns a new Refines Set.exclusiveUnion |
higherElements | Source Codeshared actual {Element*} higherElements(Element element) The elements larger than or equal to the given value, sorted in ascending order. This is a lazy operation, returning a view of the underlying sorted set. Refines SortedSet.higherElements |
intersection | Source Codeshared actual HashSet<Element&Other> intersection<Other>(Set<Other> set) Returns a new For example: set { "hello", "world" } & set { 1, 2, "hello" } Produces the set Note that, according to this definition, and even
though set { 1 } & set { 1.0 } produces the empty set Refines Set.intersection |
iterator | Source Codeshared actual Iterator<Element> iterator() An iterator for the elements belonging to this stream. If this is a nonempty stream with type Refines Iterable.iterator |
lowerElements | Source Codeshared actual {Element*} lowerElements(Element element) The elements smaller than or equal to the given value, sorted in descending order. This is a lazy operation, returning a view of the underlying sorted set. Refines SortedSet.lowerElements |
measure | Source Codeshared actual TreeSet<Element> measure(Element 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 |
remove | Source Codeshared actual Boolean remove(Element element) Remove an Refines SetMutator.remove |
span | Source Codeshared actual TreeSet<Element> span(Element from, Element 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 TreeSet<Element> spanFrom(Element 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 TreeSet<Element> spanTo(Element 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 |
union | Source Codeshared actual HashSet<Element|Other> union<Other>(Set<Other> set) Returns a new For example: set { "hello", "world" } | set { 1, 2, "hello" } Produces the set Note that it is possible for two sets of disjoint
element type to be considered to have elements in
common. For example, since set { 1 } | set { 1.0 } produces the set Refines Set.union |
Inherited Methods |
Methods inherited from: Object |
Methods inherited from: Category<Element> |
Methods inherited from: Collection<Element> |
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: MutableSet<Element> |
Methods inherited from: Ranged<Index,Element,Subrange> |
Methods inherited from: Set<Element> |
Methods inherited from: SetMutator<Element> |
Methods inherited from: SortedSet<Element> |