saker.util Documentation TaskDoc JavaDoc Packages
package saker.util
public abstract class TransformingNavigableSet<SE, Eextends TransformingSortedSet<SE, E> implements NavigableSet<E>
Pseudo-Set implementation that dynamically generated the elements for it based on the elements of a subject set.

Works exactly the same way as TransformingSortedSet, but also implements NavigableSet as well.

SEThe source set element type.
EThe element type of this set.
Constructors
public
Creates a new instance with the given set.
public
TransformingNavigableSet(NavigableSet<extends SE> set, Comparator<super E> comparator)
Creates a new instance with the given set and comparator.
Methods
public 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.
public Iterator<E>
Returns an iterator over the elements in this set, in descending order.
public NavigableSet<E>
Returns a reverse order view of the elements contained in this set.
public 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.
public NavigableSet<E>
headSet(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.
public 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.
public 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.
public E
Retrieves and removes the first (lowest) element, or returns null if this set is empty.
public E
Retrieves and removes the last (highest) element, or returns null if this set is empty.
public NavigableSet<E>
subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
Returns a view of the portion of this set whose elements range from fromElement to toElement.
public NavigableSet<E>
tailSet(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.
Creates a new instance with the given set.
setThe subject set.
NullPointerExceptionIf the set is null.
public TransformingNavigableSet(NavigableSet<extends SE> set, Comparator<super E> comparator) throws NullPointerException
Creates a new instance with the given set and comparator.
setThe subject set.
comparatorThe comparator.
NullPointerExceptionIf the set is null.
public E ceiling(E e)
Overridden from: NavigableSet
Returns the least element in this set greater than or equal to the given element, or null if there is no such element.
ethe value to match
the least element greater than or equal to e, or null if there is no such element
Overridden from: NavigableSet
Returns an iterator over the elements in this set, in descending order. Equivalent in effect to descendingSet().iterator().
an iterator over the elements in this set, in descending order
Overridden from: NavigableSet
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(comparator()). The expression s.descendingSet().descendingSet() returns a view of s essentially equivalent to s.

a reverse order view of this set
public E floor(E e)
Overridden from: NavigableSet
Returns the greatest element in this set less than or equal to the given element, or null if there is no such element.
ethe value to match
the greatest element less than or equal to e, or null if there is no such element
public NavigableSet<E> headSet(E toElement, boolean inclusive)
Overridden from: NavigableSet
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.

toElementhigh endpoint of the returned set
inclusivetrue if the high endpoint is to be included in the returned view
a view of the portion of this set whose elements are less than (or equal to, if inclusive is true) toElement
public E higher(E e)
Overridden from: NavigableSet
Returns the least element in this set strictly greater than the given element, or null if there is no such element.
ethe value to match
the least element greater than e, or null if there is no such element
public E lower(E e)
Overridden from: NavigableSet
Returns the greatest element in this set strictly less than the given element, or null if there is no such element.
ethe value to match
the greatest element less than e, or null if there is no such element
public E pollFirst()
Overridden from: NavigableSet
Retrieves and removes the first (lowest) element, or returns null if this set is empty.
the first element, or null if this set is empty
public E pollLast()
Overridden from: NavigableSet
Retrieves and removes the last (highest) element, or returns null if this set is empty.
the last element, or null if this set is empty
public NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
Overridden from: NavigableSet
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.

fromElementlow endpoint of the returned set
fromInclusivetrue if the low endpoint is to be included in the returned view
toElementhigh endpoint of the returned set
toInclusivetrue if the high endpoint is to be included in the returned view
a view of the portion of this set whose elements range from fromElement, inclusive, to toElement, exclusive
public NavigableSet<E> tailSet(E fromElement, boolean inclusive)
Overridden from: NavigableSet
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.

fromElementlow endpoint of the returned set
inclusivetrue if the low endpoint is to be included in the returned view
a view of the portion of this set whose elements are greater than or equal to fromElement