E
- the type of content of this Setpublic class ImmutableTreeSet<E> extends ImmutableAbstractSet<E> implements ImmutableNavigableSet<E>
Copyright (c) 2016-2019 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html.
copyOrWrap
Constructor and Description |
---|
ImmutableTreeSet(Collection<? extends E> sortedSet) |
ImmutableTreeSet(ImmutableAbstractSet<E> immutableSortedSet) |
ImmutableTreeSet(ImmutableTreeSet<E> immutableTreeSet,
Immutable copyOrWrap) |
ImmutableTreeSet(NavigableSet<E> treeSet,
Immutable copyOrWrap) |
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. |
Comparator<? super E> |
comparator()
Returns the comparator used to order the elements in this immutable set, or null if this immutable set
uses the natural ordering of its elements.
|
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.
|
E |
first()
Returns the first (lowest) element currently in this immutable set.
|
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. |
protected NavigableSet<E> |
getCollection()
Returns the underlying collection of this immutable collection.
|
ImmutableSortedSet<E> |
headSet(E toElement)
Returns a view of the portion of this immutable set whose elements are strictly less than toElement.
|
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 |
last()
Returns the last (highest) element currently in this immutable set.
|
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 . |
ImmutableSortedSet<E> |
subSet(E fromElement,
E toElement)
Returns a view of the portion of this immutable set whose elements range from fromElement, inclusive, to
toElement, exclusive.
|
ImmutableSortedSet<E> |
tailSet(E fromElement)
Returns a view of the portion of this immutable set whose elements are greater than or equal to
fromElement.
|
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.
|
String |
toString() |
contains, containsAll, containsAll, equals, forEach, hashCode, isEmpty, isWrap, iterator, parallelStream, size, spliterator, stream, toArray, toArray, toCollection
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
equals, hashCode
contains, containsAll, containsAll, isCopy, isEmpty, isWrap, iterator, parallelStream, size, spliterator, stream, toArray, toArray, toCollection
public ImmutableTreeSet(Collection<? extends E> sortedSet)
sortedSet
- Collection<? extends E>; the collection to use for the immutable set.public ImmutableTreeSet(NavigableSet<E> treeSet, Immutable copyOrWrap)
treeSet
- NavigableSet<E>; the collection to use for the immutable set.copyOrWrap
- COPY stores a safe, internal copy of the collection; WRAP stores a pointer to the original
collectionpublic ImmutableTreeSet(ImmutableAbstractSet<E> immutableSortedSet)
immutableSortedSet
- ImmutableAbstractSet<E>; the collection to use for the immutable set.public ImmutableTreeSet(ImmutableTreeSet<E> immutableTreeSet, Immutable copyOrWrap)
immutableTreeSet
- ImmutableTreeSet<E>; the collection to use for the immutable set.copyOrWrap
- COPY stores a safe, internal copy of the collection; WRAP stores a pointer to the original
collectionpublic final NavigableSet<E> toSet()
toSet
in interface ImmutableNavigableSet<E>
toSet
in interface ImmutableSet<E>
toSet
in interface ImmutableSortedSet<E>
protected NavigableSet<E> getCollection()
getCollection
in class ImmutableAbstractSet<E>
public final Comparator<? super E> comparator()
comparator
in interface ImmutableSortedSet<E>
public final ImmutableSortedSet<E> subSet(E fromElement, E toElement)
The result of this method is a new, immutable sorted set.
subSet
in interface ImmutableSortedSet<E>
fromElement
- E; low endpoint (inclusive) of the returned immutable settoElement
- E; high endpoint (exclusive) of the returned immutable setpublic final ImmutableSortedSet<E> headSet(E toElement)
The result of this method is a new, immutable sorted set.
headSet
in interface ImmutableSortedSet<E>
toElement
- E; high endpoint (exclusive) of the returned immutable setpublic final ImmutableSortedSet<E> tailSet(E fromElement)
The result of this method is a new, immutable sorted set.
tailSet
in interface ImmutableSortedSet<E>
fromElement
- E; low endpoint (inclusive) of the returned immutable setpublic final E first()
first
in interface ImmutableSortedSet<E>
public final E last()
last
in interface ImmutableSortedSet<E>
public final E lower(E e)
null
if there
is no such element.lower
in interface ImmutableNavigableSet<E>
e
- E; the value to matche
, or null
if there is no such elementpublic final E floor(E e)
null
if
there is no such element.floor
in interface ImmutableNavigableSet<E>
e
- E; the value to matche
, or null
if there is no such elementpublic final E ceiling(E e)
null
if
there is no such element.ceiling
in interface ImmutableNavigableSet<E>
e
- E; the value to matche
, or null
if there is no such elementpublic final E higher(E e)
null
if there
is no such element.higher
in interface ImmutableNavigableSet<E>
e
- E; the value to matche
, or null
if there is no such elementpublic final ImmutableNavigableSet<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
.
descendingSet
in interface ImmutableNavigableSet<E>
public final ImmutableIterator<E> descendingIterator()
descendingSet().iterator()
.descendingIterator
in interface ImmutableNavigableSet<E>
public final 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.subSet
in interface ImmutableNavigableSet<E>
fromElement
- E; low endpoint of the returned immutable setfromInclusive
- boolean; true
if the low endpoint is to be included in the returned viewtoElement
- E; high endpoint of the returned immutable settoInclusive
- boolean; true
if the high endpoint is to be included in the returned viewfromElement
, inclusive, to
toElement
, exclusivepublic final ImmutableNavigableSet<E> headSet(E toElement, boolean inclusive)
inclusive
is true) toElement
.headSet
in interface ImmutableNavigableSet<E>
toElement
- E; high endpoint of the returned immutable setinclusive
- boolean; true
if the high endpoint is to be included in the returned viewinclusive
is true) toElement
public final ImmutableNavigableSet<E> tailSet(E fromElement, boolean inclusive)
inclusive
is true) fromElement
.tailSet
in interface ImmutableNavigableSet<E>
fromElement
- E; low endpoint of the returned immutable setinclusive
- boolean; true
if the low endpoint is to be included in the returned viewfromElement
public final String toString()
toString
in class ImmutableAbstractSet<E>
Copyright © 2018–2019 Delft University of Technology. All rights reserved.