E - the type of content of this Setpublic class ImmutableTreeSet<E> extends ImmutableAbstractSet<E> implements ImmutableNavigableSet<E>
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.
| Constructor and Description |
|---|
ImmutableTreeSet(ImmutableSortedSet<E> immutableSortedSet) |
ImmutableTreeSet(ImmutableSortedSet<E> immutableSortedSet,
Immutable copyOrWrap) |
ImmutableTreeSet(SortedSet<E> sortedSet) |
ImmutableTreeSet(SortedSet<E> sortedSet,
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> |
getSet()
Prepare the set of the right type for use a subclass.
|
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, toCollectionclone, finalize, getClass, notify, notifyAll, wait, wait, waitequals, hashCodecontains, containsAll, containsAll, isCopy, isEmpty, isWrap, iterator, parallelStream, size, spliterator, stream, toArray, toArray, toCollectionpublic ImmutableTreeSet(SortedSet<E> sortedSet)
sortedSet - the collection to use as the immutable set.public ImmutableTreeSet(SortedSet<E> sortedSet, Immutable copyOrWrap)
sortedSet - the collection to use as the immutable set.copyOrWrap - COPY stores a safe, internal copy of the collection; WRAP stores a pointer to the original collectionpublic ImmutableTreeSet(ImmutableSortedSet<E> immutableSortedSet)
immutableSortedSet - the collection to use as the immutable set.public ImmutableTreeSet(ImmutableSortedSet<E> immutableSortedSet, Immutable copyOrWrap)
immutableSortedSet - the collection to use as the immutable set.copyOrWrap - COPY stores a safe, internal copy of the collection; WRAP stores a pointer to the original collectionprotected final NavigableSet<E> getSet()
@Override
protected ArraySet<E> getSet()
{
return (ArraySet<E>) super.getSet();
}
getSet in class ImmutableAbstractSet<E>public final NavigableSet<E> toSet()
toSet in interface ImmutableNavigableSet<E>toSet in interface ImmutableSet<E>toSet in interface ImmutableSortedSet<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 - low endpoint (inclusive) of the returned immutable settoElement - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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, exclusivepublic final ImmutableNavigableSet<E> headSet(E toElement, boolean inclusive)
inclusive is
true) toElement.headSet in interface ImmutableNavigableSet<E>toElement - high endpoint of the returned immutable setinclusive - true if the high endpoint is to be included in the returned viewinclusive is
true) toElementpublic final ImmutableNavigableSet<E> tailSet(E fromElement, boolean inclusive)
inclusive is
true) fromElement.tailSet in interface ImmutableNavigableSet<E>fromElement - low endpoint of the returned immutable setinclusive - true if the low endpoint is to be included in the returned viewfromElementpublic final String toString()
toString in class ImmutableAbstractSet<E>Copyright © 2014–2016 Delft University of Technology. All rights reserved.