E
- the type of elements contained in the list. The list is covariant on its element type.public ImmutableNavigableSet<E> extends ImmutableSortedSet<E>
An interface that mimics the original NavigableSet but without exposing modification functions to Kotlin source codes.
Modifications are strictly forbidden after the map is created.
Modifier and Type | Method and Description |
---|---|
E |
ceiling(E e)
Returns the least element in this set greater than or equal to
the given element, or
null if there is no such element. |
java.util.Iterator<E> |
descendingIterator()
Returns an iterator over the elements in this set, in descending order.
Equivalent in effect to
descendingSet().iterator() . |
E |
floor(E e)
Returns the greatest element in this set less than or equal to
the given element, or
null if there is no such element. |
ImmutableNavigableSet<E> |
getDescending()
Returns a reverse order view of the elements contained in this set.
The descending set is backed by this set, so changes to the set are
reflected in the descending set, and vice-versa. If either set is
modified while an iteration over either set is in progress (except
through the iterator's own
remove operation), the results of
the iteration are undefined. |
ImmutableNavigableSet<E> |
head(E toElement,
boolean inclusive)
Returns a view of the portion of this set whose elements are less than
(or equal to, if
inclusive is true) toElement . 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. |
ImmutableSortedSet<E> |
head(E toElement)
See ImmutableSortedSet.head
|
E |
higher(E e)
Returns the least element in this set strictly greater than the
given element, or
null if there is no such element. |
java.util.Iterator<E> |
iterator()
Returns an iterator over the elements in this set, in ascending order.
|
E |
lower(E e)
Returns the greatest element in this set strictly less than the
given element, or
null if there is no such element. |
E |
pollFirst()
Retrieves and removes the first (lowest) element,
or returns
null if this set is empty. |
E |
pollLast()
Retrieves and removes the last (highest) element,
or returns
null if this set is empty. |
ImmutableNavigableSet<E> |
sub(E fromElement,
boolean fromInclusive,
E toElement,
boolean toInclusive)
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. |
ImmutableSortedSet<E> |
sub(E fromElement,
E toElement)
See ImmutableSortedSet.sub
|
ImmutableNavigableSet<E> |
tail(E fromElement,
boolean inclusive)
Returns a view of the portion of this set whose elements are greater
than (or equal to, if
inclusive is true) fromElement .
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. |
ImmutableSortedSet<E> |
tail(E fromElement)
See ImmutableSortedSet.tail
|
comparator, first, head, last, sub, tail
E lower(E e)
Returns the greatest element in this set strictly less than the
given element, or null
if there is no such element.
e
- the value to matche
,
or null
if there is no such elementE floor(E e)
Returns the greatest element in this set less than or equal to
the given element, or null
if there is no such element.
e
- the value to matche
,
or null
if there is no such elementE ceiling(E e)
Returns the least element in this set greater than or equal to
the given element, or null
if there is no such element.
e
- the value to matche
,
or null
if there is no such elementE higher(E e)
Returns the least element in this set strictly greater than the
given element, or null
if there is no such element.
e
- the value to matche
,
or null
if there is no such elementE pollFirst()
Retrieves and removes the first (lowest) element,
or returns null
if this set is empty.
null
if this set is emptyE pollLast()
Retrieves and removes the last (highest) element,
or returns null
if this set is empty.
null
if this set is emptyjava.util.Iterator<E> iterator()
Returns an iterator over the elements in this set, in ascending order.
ImmutableNavigableSet<E> getDescending()
Returns a reverse order view of the elements contained in this set.
The descending set is backed by this set, so changes to the set are
reflected in the descending set, and vice-versa. If either set is
modified while an iteration over either set is in progress (except
through the iterator's own remove
operation), the results of
the iteration are undefined.
The returned set has an ordering equivalent to
Collections.reverseOrder.
The expression s.descendingSet().descendingSet()
returns a
view of s
essentially equivalent to s
.
java.util.Iterator<E> descendingIterator()
Returns an iterator over the elements in this set, in descending order.
Equivalent in effect to descendingSet().iterator()
.
ImmutableNavigableSet<E> sub(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
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.
fromElement
- low endpoint of the returned setfromInclusive
- true
if the low endpoint
is to be included in the returned viewtoElement
- high endpoint of the returned settoInclusive
- true
if the high endpoint
is to be included in the returned viewfromElement
, inclusive, to toElement
, exclusivefromElement
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.fromElement
or
toElement
is null and this set does
not permit null elementsfromElement
is
greater than toElement
; or if this set itself
has a restricted range, and fromElement
or
toElement
lies outside the bounds of the range.ImmutableNavigableSet<E> head(E toElement, boolean inclusive)
Returns a view of the portion of this set whose elements are less than
(or equal to, if inclusive
is true) toElement
. 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.
toElement
- high endpoint of the returned setinclusive
- true
if the high endpoint
is to be included in the returned viewinclusive
is true) toElement
toElement
is not compatible
with this set's comparator (or, if the set has no comparator,
if toElement
does not implement Comparable).
Implementations may, but are not required to, throw this
exception if toElement
cannot be compared to elements
currently in the set.toElement
is null and
this set does not permit null elementstoElement
lies outside the
bounds of the rangeImmutableNavigableSet<E> tail(E fromElement, boolean inclusive)
Returns a view of the portion of this set whose elements are greater
than (or equal to, if inclusive
is true) fromElement
.
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.
fromElement
- low endpoint of the returned setinclusive
- true
if the low endpoint
is to be included in the returned viewfromElement
fromElement
is not compatible
with this set's comparator (or, if the set has no comparator,
if fromElement
does not implement Comparable).
Implementations may, but are not required to, throw this
exception if fromElement
cannot be compared to elements
currently in the set.fromElement
is null
and this set does not permit null elementsfromElement
lies outside the
bounds of the rangeImmutableSortedSet<E> sub(E fromElement, E toElement)
See ImmutableSortedSet.sub
Equivalent to subSet(fromElement, true, toElement, false)
.
ImmutableSortedSet<E> head(E toElement)
See ImmutableSortedSet.head
Equivalent to headSet(toElement, false)
.
ImmutableSortedSet<E> tail(E fromElement)
See ImmutableSortedSet.tail
Equivalent to tailSet(fromElement, true)
.