Sorted Set
A subtype of set
that provides iteration over its elements in the natural sorting order, backed by a tree set.
set<Type>
Subtypes | Supertypes | Comparable types |
---|---|---|
none | set<Type> | java.util.SortedSet<Type> |
new treeset
Parameter type | Result type |
---|---|
Type... sequence<? extends Type> | set<Type> |
Creates an empty set. Optionally, initial values may be specified right in the new set creation expression.
sorted_set<string> test = new treeset<string> {"A", "B", "C"};
Alternatively, a sequence may be specified that is used to copy elements from.
sorted_set<Type> = new treeset<Type> (sequence);
Operand type | Parameter type | Result type |
---|---|---|
sorted_set<Type> | Type | sorted_set<Type> |
Results in a sorted_set
that is a subset of all elements from the original set in the original sorting order, starting with the first element and up to but not including the specified element.
set.headSet (upTo);
Operand type | Parameter type | Result type |
---|---|---|
sorted_set<Type> | Type | sorted_set<Type> |
Results in a sorted_set
that is a subset of all elements from the original set in the original sorting order, starting with the specified element.
set.tailSet (from);
Operand type | Parameter type | Result type |
---|---|---|
sorted_set<Type> | Type, Type | sorted_set<Type> |
Results in a sorted_set
that is a subset of all elements from the original set in the original sorting order, starting with the first specified element and up to but not including the second specified element.
set.tailSet (from,upTo);
Thanks for your feedback!