MPS 2019.1 Help

Sorted Set

Sorted Set

A subtype of set that provides iteration over its elements in the natural sorting order, backed by a tree set.

Sorted Set type

set<Type>

Subtypes

Supertypes

Comparable types

none

set<Type>

java.util.SortedSet<Type>

Sorted set creation

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);

Operations on sorted set

headSet

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);

tailSet

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);

subSet

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);
Last modified: 5 July 2019