subSet

open override fun subSet(fromElement: E, fromInclusive: Boolean, toElement: E, toInclusive: Boolean): NavigableSet<E>

Returns a view of the portion of this set whose elements range from fromElement to toElement. If fromElement and toElement are equal, the returned set is empty unless fromInclusive and toInclusive are both true. The returned set is backed by this set, so changes in the returned set are reflected in this set, and vice-versa. The returned set supports all optional set operations that this set supports.

The returned set will throw an IllegalArgumentException on an attempt to insert an element outside its range.

Return

a view of the portion of this set whose elements range from fromElement, inclusive, to toElement, exclusive

Parameters

fromElement

low endpoint of the returned set

fromInclusive

true if the low endpoint is to be included in the returned view

toElement

high endpoint of the returned set

toInclusive

true if the high endpoint is to be included in the returned view

Throws

if fromElement and toElement cannot be compared to one another using this set's comparator (or, if the set has no comparator, using natural ordering). Implementations may, but are not required to, throw this exception if fromElement or toElement cannot be compared to elements currently in the set.

if fromElement or toElement is null and this set does not permit null elements

if fromElement is greater than toElement; or if this set itself has a restricted range, and fromElement or toElement lies outside the bounds of the range.


open override fun subSet(fromElement: E, toElement: E): SortedSet<E>

{@inheritDoc}

Equivalent to subSet(fromElement, true, toElement, false).

Throws