# 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 | | java.util.SortedSet<Type> |

#### Sorted set creation

**new treeset**

Parameter type | Result type |
---|---|

Type... | |

Creates an empty set. Optionally, initial values may be specified right in the new set creation expression.

Alternatively, a sequence may be specified that is used to copy elements from.

#### Operations on sorted set

#### headSet

Operand type | Parameter type | Result type |
---|---|---|

| 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.

#### tailSet

Operand type | Parameter type | Result type |
---|---|---|

| 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.

#### subSet

Operand type | Parameter type | Result type |
---|---|---|

| Type, 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.