NavigableSet to validate that all additions
match a specified predicate.
This set exists to provide validation for the decorated set. It is normally created to decorate an empty set. If an object cannot be added to the set, an IllegalArgumentException is thrown.
One usage would be to ensure that no null entries are added to the set.
NavigableSet set =
PredicatedSortedSet.predicatedNavigableSet(new TreeSet(),
NotNullPredicate.notNullPredicate());
| Modifier and Type | Field and Description |
|---|---|
| private static final long | serialVersionUID
Hides org. |
| Access | Constructor and Description |
|---|---|
| protected | PredicatedNavigableSet(final NavigableSet<E>
the set to decorate, must not be null set, final Predicate<? super E> the predicate to use for validation, must not be null predicate)Constructor that wraps (not copies). |
| Modifier and Type | Method and Description |
|---|---|
| public E | ceiling(final E
the value to match e)Implements java. null if there is no such element.
|
| protected NavigableSet | Returns: the decorated navigable setOverrides org. |
| public Iterator | descendingIterator()
Implements java. |
| public NavigableSet | descendingSet()
Implements java. |
| public E | floor(final E
the value to match e)Implements java. null if there is no such element.
|
| public NavigableSet | headSet(final E
high endpoint of the returned set toElement, final boolean true if the high endpoint
is to be included in the returned viewImplements java. inclusive is true) toElement.
|
| public E | higher(final E
the value to match e)Implements java. null if there is no such element.
|
| public E | lower(final E
the value to match e)Implements java. null if there is no such element.
|
| public E | pollFirst()
Implements java. null if this set is empty.
|
| public E | pollLast()
Implements java. null if this set is empty.
|
| public static < the element type E> PredicatedNavigableSet | Returns: a new predicated navigable set.the set to decorate, must not be null set, final Predicate<? super E> the predicate to use for validation, must not be null predicate)Factory method to create a predicated (validating) navigable set. |
| public NavigableSet | subSet(final E
low endpoint of the returned set fromElement, final boolean true if the low endpoint
is to be included in the returned viewhigh endpoint of the returned set toElement, final boolean true if the high endpoint
is to be included in the returned viewImplements java. fromElement to toElement.
|
| public NavigableSet | tailSet(final E
low endpoint of the returned set fromElement, final boolean true if the low endpoint
is to be included in the returned viewImplements java. inclusive is true) fromElement.
|
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides org. Serialization version | |
| PredicatedNavigableSet | back to summary |
|---|---|
| protected PredicatedNavigableSet(final NavigableSet<E> set, final Predicate<? super E> predicate) Constructor that wraps (not copies). If there are any elements already in the set being decorated, they are validated.
| |
| ceiling | back to summary |
|---|---|
| public E ceiling(final E e) Implements java. Doc from java. Returns the least element in this set greater than or equal to
the given element, or
| |
| decorated | back to summary |
|---|---|
| protected NavigableSet Overrides org. Gets the navigable set being decorated.
| |
| descendingIterator | back to summary |
|---|---|
| public Iterator Implements java. Doc from java. Returns an iterator over the elements in this set, in descending order.
Equivalent in effect to | |
| descendingSet | back to summary |
|---|---|
| public NavigableSet Implements java. Doc from java. 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 The returned set has an ordering equivalent to
| |
| floor | back to summary |
|---|---|
| public E floor(final E e) Implements java. Doc from java. Returns the greatest element in this set less than or equal to
the given element, or
| |
| headSet | back to summary |
|---|---|
| public NavigableSet Implements java. Doc from java. Returns a view of the portion of this set whose elements are less than
(or equal to, if The returned set will throw an
| |
| higher | back to summary |
|---|---|
| public E higher(final E e) Implements java. Doc from java. Returns the least element in this set strictly greater than the
given element, or
| |
| lower | back to summary |
|---|---|
| public E lower(final E e) Implements java. Doc from java. Returns the greatest element in this set strictly less than the
given element, or
| |
| pollFirst | back to summary |
|---|---|
| public E pollFirst() Implements java. Doc from java. Retrieves and removes the first (lowest) element,
or returns
| |
| pollLast | back to summary |
|---|---|
| public E pollLast() Implements java. Doc from java. Retrieves and removes the last (highest) element,
or returns
| |
| predicatedNavigableSet | back to summary |
|---|---|
| public static <E> PredicatedNavigableSet Factory method to create a predicated (validating) navigable set. If there are any elements already in the set being decorated, they are validated.
| |
| subSet | back to summary |
|---|---|
| public NavigableSet Implements java. Doc from java. Returns a view of the portion of this set whose elements range from
The returned set will throw an
| |
| tailSet | back to summary |
|---|---|
| public NavigableSet Implements java. Doc from java. Returns a view of the portion of this set whose elements are greater
than (or equal to, if The returned set will throw an
| |