E
- the type of content of this Setpublic interface ImmutableNavigableSet<E> extends ImmutableSortedSet<E>
ImmutableSortedSet
extended with navigation methods reporting closest matches for given search targets. Methods
lower
, floor
, ceiling
, and higher
return elements respectively less than, less than or equal,
greater than or equal, and greater than a given element, returning null
if there is no such element. All methods from
java.util.NavigableSet that can change the set have been left out.
Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Modifier and Type | Method and Description |
---|---|
E |
ceiling(E e)
Returns the least element in this immutable set greater than or equal to the given element, or
null if there is
no such element. |
ImmutableIterator<E> |
descendingIterator()
Returns an immutable iterator over the elements in this immutable set, in descending order.
|
ImmutableNavigableSet<E> |
descendingSet()
Returns a reverse order view of the elements contained in this immutable set.
|
boolean |
equals(Object obj)
Force to redefine equals for the implementations of immutable collection classes.
|
E |
floor(E e)
Returns the greatest element in this immutable set less than or equal to the given element, or
null if there is
no such element. |
int |
hashCode()
Force to redefine hashCode for the implementations of immutable collection classes.
|
ImmutableNavigableSet<E> |
headSet(E toElement,
boolean inclusive)
Returns a view of the portion of this immutable set whose elements are less than (or equal to, if
inclusive is
true) toElement . |
E |
higher(E e)
Returns the least element in this immutable set strictly greater than the given element, or
null if there is no
such element. |
E |
lower(E e)
Returns the greatest element in this immutable set strictly less than the given element, or
null if there is no
such element. |
ImmutableNavigableSet<E> |
subSet(E fromElement,
boolean fromInclusive,
E toElement,
boolean toInclusive)
Returns a view of the portion of this immutable set whose elements range from
fromElement to toElement . |
ImmutableNavigableSet<E> |
tailSet(E fromElement,
boolean inclusive)
Returns a view of the portion of this immutable set whose elements are greater than (or equal to, if
inclusive is
true) fromElement . |
NavigableSet<E> |
toSet()
Returns a modifiable copy of this immutable set.
|
comparator, first, headSet, last, subSet, tailSet
contains, containsAll, containsAll, isCopy, isEmpty, isWrap, iterator, parallelStream, size, spliterator, stream, toArray, toArray, toCollection
NavigableSet<E> toSet()
toSet
in interface ImmutableSet<E>
toSet
in interface ImmutableSortedSet<E>
E lower(E e)
null
if there is no
such element.e
- the value to matche
, or null
if there is no such elementClassCastException
- if the specified element cannot be compared with the elements currently in the immutable setNullPointerException
- if the specified element is null and this immutable set does not permit null elementsE floor(E e)
null
if there is
no such element.e
- the value to matche
, or null
if there is no such elementClassCastException
- if the specified element cannot be compared with the elements currently in the immutable setNullPointerException
- if the specified element is null and this immutable set does not permit null elementsE ceiling(E e)
null
if there is
no such element.e
- the value to matche
, or null
if there is no such elementClassCastException
- if the specified element cannot be compared with the elements currently in the immutable setNullPointerException
- if the specified element is null and this immutable set does not permit null elementsE higher(E e)
null
if there is no
such element.e
- the value to matche
, or null
if there is no such elementClassCastException
- if the specified element cannot be compared with the elements currently in the immutable setNullPointerException
- if the specified element is null and this immutable set does not permit null elementsImmutableNavigableSet<E> descendingSet()
The returned immutable set has an ordering equivalent to
Collections.reverseOrder
(comparator()). The expression
s.descendingSet().descendingSet()
returns a view of s
essentially equivalent to s
.
ImmutableIterator<E> descendingIterator()
descendingSet().iterator()
.ImmutableNavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
fromElement
to toElement
.
If fromElement
and toElement
are equal, the returned immutable set is empty unless fromInclusive
and toInclusive
are both true.fromElement
- low endpoint of the returned immutable setfromInclusive
- true
if the low endpoint is to be included in the returned viewtoElement
- high endpoint of the returned immutable settoInclusive
- true
if the high endpoint is to be included in the returned viewfromElement
, inclusive, to
toElement
, exclusiveClassCastException
- if fromElement
and toElement
cannot be compared to one another using this
immutable set's comparator (or, if the immutable 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 immutable set.NullPointerException
- if fromElement
or toElement
is null and this immutable set does not permit
null elementsIllegalArgumentException
- if fromElement
is greater than toElement
; or if this immutable set
itself has a restricted range, and fromElement
or toElement
lies outside the bounds of the
range.ImmutableNavigableSet<E> headSet(E toElement, boolean inclusive)
inclusive
is
true) toElement
.toElement
- high endpoint of the returned immutable setinclusive
- true
if the high endpoint is to be included in the returned viewinclusive
is
true) toElement
ClassCastException
- if toElement
is not compatible with this immutable set's comparator (or, if the
immutable 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 immutable set.NullPointerException
- if toElement
is null and this immutable set does not permit null elementsIllegalArgumentException
- if this immutable set itself has a restricted range, and toElement
lies outside
the bounds of the rangeImmutableNavigableSet<E> tailSet(E fromElement, boolean inclusive)
inclusive
is
true) fromElement
.fromElement
- low endpoint of the returned immutable setinclusive
- true
if the low endpoint is to be included in the returned viewfromElement
ClassCastException
- if fromElement
is not compatible with this immutable set's comparator (or, if the
immutable 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 immutable set.NullPointerException
- if fromElement
is null and this immutable set does not permit null elementsIllegalArgumentException
- if this immutable set itself has a restricted range, and fromElement
lies
outside the bounds of the rangeboolean equals(Object obj)
equals
in interface ImmutableCollection<E>
equals
in interface ImmutableSet<E>
equals
in interface ImmutableSortedSet<E>
equals
in class Object
obj
- the object to compare this collection withint hashCode()
hashCode
in interface ImmutableCollection<E>
hashCode
in interface ImmutableSet<E>
hashCode
in interface ImmutableSortedSet<E>
hashCode
in class Object
Copyright © 2014–2016 Delft University of Technology. All rights reserved.