Top Fields Constructors Methods
org.jboss.marshalling.util

public final Class FlatNavigableSet<E>

extends AbstractSet<E>
implements NavigableSet<E>
Class Inheritance
All Implemented Interfaces
java.util.NavigableSet, java.util.SortedSet, java.util.SequencedSet, java.util.Set, java.util.Collection, java.lang.Iterable, java.util.SequencedCollection
Imports
java.util.AbstractSet, .ArrayList, .Comparator, .Iterator, .List, .NavigableSet, .SortedSet

Author
David M. Lloyd

Field Summary

Modifier and TypeField and Description
private final Comparator<? super E>
private final List<E>

Constructor Summary

AccessConstructor and Description
public
FlatNavigableSet(final Comparator<? super E> comparator)

Method Summary

Modifier and TypeMethod and Description
public boolean
add(final E
element to be added to this set
e
)

Overrides java.util.AbstractCollection.add.

Implements java.util.Set.add, java.util.Collection.add.

Adds the specified element to this set if it is not already present (optional operation).
public E
ceiling(final E
the value to match
e
)

Implements java.util.NavigableSet.ceiling.

Returns the least element in this set greater than or equal to the given element, or null if there is no such element.
public Comparator<? super E>
comparator()

Implements java.util.SortedSet.comparator.

Returns the comparator used to order the elements in this set, or null if this set uses the natural ordering of its elements.
public Iterator<E>
descendingIterator()

Implements java.util.NavigableSet.descendingIterator.

Returns an iterator over the elements in this set, in descending order.
public NavigableSet<E>
descendingSet()

Implements java.util.NavigableSet.descendingSet.

Returns a reverse order view of the elements contained in this set.
public E
first()

Implements java.util.SortedSet.first.

Returns the first (lowest) element currently in this set.
public E
floor(final E
the value to match
e
)

Implements java.util.NavigableSet.floor.

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(final E
high endpoint of the returned set
toElement
,
final boolean
true if the high endpoint is to be included in the returned view
inclusive
)

Implements java.util.NavigableSet.headSet.

Returns a view of the portion of this set whose elements are less than (or equal to, if inclusive is true) toElement.
public SortedSet<E>
headSet(final E
high endpoint (exclusive) of the returned set
toElement
)

Implements java.util.NavigableSet.headSet.

Returns a view of the portion of this set whose elements are strictly less than toElement.
public E
higher(final E
the value to match
e
)

Implements java.util.NavigableSet.higher.

Returns the least element in this set strictly greater than the given element, or null if there is no such element.
public Iterator<E>
iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.NavigableSet.iterator, java.util.Set.iterator, java.util.Collection.iterator.

Returns an iterator over the elements in this set, in ascending order.
public E
last()

Implements java.util.SortedSet.last.

Returns the last (highest) element currently in this set.
public E
lower(final E
the value to match
e
)

Implements java.util.NavigableSet.lower.

Returns the greatest element in this set strictly less than the given element, or null if there is no such element.
public E
pollFirst()

Implements java.util.NavigableSet.pollFirst.

Retrieves and removes the first (lowest) element, or returns null if this set is empty.
public E
pollLast()

Implements java.util.NavigableSet.pollLast.

Retrieves and removes the last (highest) element, or returns null if this set is empty.
public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Returns the number of elements in this set (its cardinality).
public NavigableSet<E>
subSet(final E
low endpoint of the returned set
fromElement
,
final boolean
true if the low endpoint is to be included in the returned view
fromInclusive
,
final E
high endpoint of the returned set
toElement
,
final boolean
true if the high endpoint is to be included in the returned view
toInclusive
)

Implements java.util.NavigableSet.subSet.

Returns a view of the portion of this set whose elements range from fromElement to toElement.
public SortedSet<E>
subSet(final E
low endpoint (inclusive) of the returned set
fromElement
,
final E
high endpoint (exclusive) of the returned set
toElement
)

Implements java.util.NavigableSet.subSet.

Returns a view of the portion of this set whose elements range from fromElement, inclusive, to toElement, exclusive.
public NavigableSet<E>
tailSet(final E
low endpoint of the returned set
fromElement
,
final boolean
true if the low endpoint is to be included in the returned view
inclusive
)

Implements java.util.NavigableSet.tailSet.

Returns a view of the portion of this set whose elements are greater than (or equal to, if inclusive is true) fromElement.
public SortedSet<E>
tailSet(final E
low endpoint (inclusive) of the returned set
fromElement
)

Implements java.util.NavigableSet.tailSet.

Returns a view of the portion of this set whose elements are greater than or equal to fromElement.
Inherited from java.util.AbstractSet:
equalshashCoderemoveAll

Field Detail

comparatorback to summary
private final Comparator<? super E> comparator
entriesback to summary
private final List<E> entries

Constructor Detail

FlatNavigableSetback to summary
public FlatNavigableSet(final Comparator<? super E> comparator)

Method Detail

addback to summary
public boolean add(final E e)

Overrides java.util.AbstractCollection.add.

Implements java.util.Set.add, java.util.Collection.add.

Doc from java.util.Set.add.

Adds the specified element to this set if it is not already present (optional operation). More formally, adds the specified element e to this set if the set contains no element e2 such that Objects.equals(e, e2). If this set already contains the element, the call leaves the set unchanged and returns false. In combination with the restriction on constructors, this ensures that sets never contain duplicate elements.

The stipulation above does not imply that sets must accept all elements; sets may refuse to add any particular element, including null, and throw an exception, as described in the specification for Collection.add. Individual set implementations should clearly document any restrictions on the elements that they may contain.

Parameters
e:E

element to be added to this set

Returns:boolean

true if this set did not already contain the specified element

ceilingback to summary
public E ceiling(final E e)

Implements java.util.NavigableSet.ceiling.

Doc from java.util.NavigableSet.ceiling.

Returns the least element in this set greater than or equal to the given element, or null if there is no such element.

Parameters
e:E

the value to match

Returns:E

the least element greater than or equal to e, or null if there is no such element

comparatorback to summary
public Comparator<? super E> comparator()

Implements java.util.SortedSet.comparator.

Doc from java.util.SortedSet.comparator.

Returns the comparator used to order the elements in this set, or null if this set uses the natural ordering of its elements.

Returns:Comparator<? super E>

the comparator used to order the elements in this set, or null if this set uses the natural ordering of its elements

descendingIteratorback to summary
public Iterator<E> descendingIterator()

Implements java.util.NavigableSet.descendingIterator.

Doc from java.util.NavigableSet.descendingIterator.

Returns an iterator over the elements in this set, in descending order. Equivalent in effect to descendingSet().iterator().

Returns:Iterator<E>

an iterator over the elements in this set, in descending order

descendingSetback to summary
public NavigableSet<E> descendingSet()

Implements java.util.NavigableSet.descendingSet.

Doc from java.util.NavigableSet.descendingSet.

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.

Returns:NavigableSet<E>

a reverse order view of this set

firstback to summary
public E first()

Implements java.util.SortedSet.first.

Doc from java.util.SortedSet.first.

Returns the first (lowest) element currently in this set.

Returns:E

the first (lowest) element currently in this set

floorback to summary
public E floor(final E e)

Implements java.util.NavigableSet.floor.

Doc from java.util.NavigableSet.floor.

Returns the greatest element in this set less than or equal to the given element, or null if there is no such element.

Parameters
e:E

the value to match

Returns:E

the greatest element less than or equal to e, or null if there is no such element

headSetback to summary
public NavigableSet<E> headSet(final E toElement, final boolean inclusive)

Implements java.util.NavigableSet.headSet.

Doc from java.util.NavigableSet.headSet.

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.

Parameters
toElement:E

high endpoint of the returned set

inclusive:boolean

true if the high endpoint is to be included in the returned view

Returns:NavigableSet<E>

a view of the portion of this set whose elements are less than (or equal to, if inclusive is true) toElement

headSetback to summary
public SortedSet<E> headSet(final E toElement)

Implements java.util.NavigableSet.headSet.

Doc from java.util.NavigableSet.headSet.

Returns a view of the portion of this set whose elements are strictly less than 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.

Equivalent to headSet(toElement, false).

Parameters
toElement:E

Doc from java.util.SortedSet.headSet.

high endpoint (exclusive) of the returned set

Returns:SortedSet<E>

Doc from java.util.SortedSet.headSet.

a view of the portion of this set whose elements are strictly less than toElement

higherback to summary
public E higher(final E e)

Implements java.util.NavigableSet.higher.

Doc from java.util.NavigableSet.higher.

Returns the least element in this set strictly greater than the given element, or null if there is no such element.

Parameters
e:E

the value to match

Returns:E

the least element greater than e, or null if there is no such element

iteratorback to summary
public Iterator<E> iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.NavigableSet.iterator, java.util.Set.iterator, java.util.Collection.iterator.

Doc from java.util.NavigableSet.iterator.

Returns an iterator over the elements in this set, in ascending order.

Returns:Iterator<E>

an iterator over the elements in this set, in ascending order

lastback to summary
public E last()

Implements java.util.SortedSet.last.

Doc from java.util.SortedSet.last.

Returns the last (highest) element currently in this set.

Returns:E

the last (highest) element currently in this set

lowerback to summary
public E lower(final E e)

Implements java.util.NavigableSet.lower.

Doc from java.util.NavigableSet.lower.

Returns the greatest element in this set strictly less than the given element, or null if there is no such element.

Parameters
e:E

the value to match

Returns:E

the greatest element less than e, or null if there is no such element

pollFirstback to summary
public E pollFirst()

Implements java.util.NavigableSet.pollFirst.

Doc from java.util.NavigableSet.pollFirst.

Retrieves and removes the first (lowest) element, or returns null if this set is empty.

Returns:E

the first element, or null if this set is empty

pollLastback to summary
public E pollLast()

Implements java.util.NavigableSet.pollLast.

Doc from java.util.NavigableSet.pollLast.

Retrieves and removes the last (highest) element, or returns null if this set is empty.

Returns:E

the last element, or null if this set is empty

sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Doc from java.util.Set.size.

Returns the number of elements in this set (its cardinality). If this set contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of elements in this set (its cardinality)

subSetback to summary
public NavigableSet<E> subSet(final E fromElement, final boolean fromInclusive, final E toElement, final boolean toInclusive)

Implements java.util.NavigableSet.subSet.

Doc from java.util.NavigableSet.subSet.

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.

Parameters
fromElement:E

low endpoint of the returned set

fromInclusive:boolean

true if the low endpoint is to be included in the returned view

toElement:E

high endpoint of the returned set

toInclusive:boolean

true if the high endpoint is to be included in the returned view

Returns:NavigableSet<E>

a view of the portion of this set whose elements range from fromElement, inclusive, to toElement, exclusive

subSetback to summary
public SortedSet<E> subSet(final E fromElement, final E toElement)

Implements java.util.NavigableSet.subSet.

Doc from java.util.NavigableSet.subSet.

Returns a view of the portion of this set whose elements range from fromElement, inclusive, to toElement, exclusive. (If fromElement and toElement are equal, the returned set is empty.) 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.

Equivalent to subSet(fromElement, true, toElement, false).

Parameters
fromElement:E

Doc from java.util.SortedSet.subSet.

low endpoint (inclusive) of the returned set

toElement:E

Doc from java.util.SortedSet.subSet.

high endpoint (exclusive) of the returned set

Returns:SortedSet<E>

Doc from java.util.SortedSet.subSet.

a view of the portion of this set whose elements range from fromElement, inclusive, to toElement, exclusive

tailSetback to summary
public NavigableSet<E> tailSet(final E fromElement, final boolean inclusive)

Implements java.util.NavigableSet.tailSet.

Doc from java.util.NavigableSet.tailSet.

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.

Parameters
fromElement:E

low endpoint of the returned set

inclusive:boolean

true if the low endpoint is to be included in the returned view

Returns:NavigableSet<E>

a view of the portion of this set whose elements are greater than or equal to fromElement

tailSetback to summary
public SortedSet<E> tailSet(final E fromElement)

Implements java.util.NavigableSet.tailSet.

Doc from java.util.NavigableSet.tailSet.

Returns a view of the portion of this set whose elements are greater than or equal to 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.

Equivalent to tailSet(fromElement, true).

Parameters
fromElement:E

Doc from java.util.SortedSet.tailSet.

low endpoint (inclusive) of the returned set

Returns:SortedSet<E>

Doc from java.util.SortedSet.tailSet.

a view of the portion of this set whose elements are greater than or equal to fromElement