public interface

NavigableSet

implements SortedSet<E>
java.util.NavigableSet<E>
Known Indirect Subclasses

Class Overview

NavigableSet is a SortedSet with navigation methods answering the closest matches for specified item.

Summary

Public Methods
abstract E ceiling(E e)
Returns the smallest element bigger than or equal to the specified one, or null if no such element.
abstract Iterator<E> descendingIterator()
Returns a descending iterator of this set.
abstract NavigableSet<E> descendingSet()
Returns a reverse order view of this set.
abstract E floor(E e)
Returns the biggest element less than or equal to the specified one, or null if no such element.
abstract NavigableSet<E> headSet(E end, boolean endInclusive)
Returns a NavigableSet of the specified portion of this set which contains elements less than (or equal to, depends on endInclusive) the end element.
abstract E higher(E e)
Returns the smallest element bigger than the specified one, or null if no such element.
abstract E lower(E e)
Returns the biggest element less than the specified one, or null if no such element.
abstract E pollFirst()
Deletes and returns the smallest element, or null if the set is empty.
abstract E pollLast()
Deletes and returns the biggest element, or null if the set is empty.
abstract NavigableSet<E> subSet(E start, boolean startInclusive, E end, boolean endInclusive)
Returns a NavigableSet of the specified portion of this set which contains elements greater (or equal to, depends on startInclusive) the start element but less than (or equal to, depends on endInclusive) the end element.
abstract NavigableSet<E> tailSet(E start, boolean startInclusive)
Returns a NavigableSet of the specified portion of this set which contains elements greater (or equal to, depends on startInclusive) the start element.
[Expand]
Inherited Methods
From interface java.lang.Iterable
From interface java.util.Collection
From interface java.util.Set
From interface java.util.SortedSet

Public Methods

public abstract E ceiling (E e)

Since: API Level 9

Returns the smallest element bigger than or equal to the specified one, or null if no such element.

Parameters
e the specified element
Returns
  • the smallest element bigger than or equal to the specified one, or null if no such element
Throws
ClassCastException if the element cannot be compared with the ones in the set
NullPointerException if the element is null and the set can not contain null

public abstract Iterator<E> descendingIterator ()

Since: API Level 9

Returns a descending iterator of this set.

Returns
  • the descending iterator

public abstract NavigableSet<E> descendingSet ()

Since: API Level 9

Returns a reverse order view of this set.

Returns
  • the reverse order view

public abstract E floor (E e)

Since: API Level 9

Returns the biggest element less than or equal to the specified one, or null if no such element.

Parameters
e the specified element
Returns
  • the biggest element less than or equal to the specified one, or null if no such element
Throws
ClassCastException if the element cannot be compared with the ones in the set
NullPointerException if the element is null and the set can not contain null

public abstract NavigableSet<E> headSet (E end, boolean endInclusive)

Since: API Level 9

Returns a NavigableSet of the specified portion of this set which contains elements less than (or equal to, depends on endInclusive) the end element. The returned NavigableSet is backed by this set so changes to one are reflected by the other.

Parameters
end the end element
endInclusive true if the end element is in the returned set
Returns
  • the subset
Throws
ClassCastException when the end object cannot be compared with the elements in this set
NullPointerException when the end object is null and the set cannot contain handle null
IllegalArgumentException when end is out of range and the set has a range

public abstract E higher (E e)

Since: API Level 9

Returns the smallest element bigger than the specified one, or null if no such element.

Parameters
e the specified element
Returns
  • the smallest element bigger than the specified one, or null if no such element
Throws
ClassCastException if the element cannot be compared with the ones in the set
NullPointerException if the element is null and the set can not contain null

public abstract E lower (E e)

Since: API Level 9

Returns the biggest element less than the specified one, or null if no such element.

Parameters
e the specified element
Returns
  • the biggest element less than the specified one, or null if no such element
Throws
ClassCastException if the element cannot be compared with the ones in the set
NullPointerException if the element is null and the set can not contain null

public abstract E pollFirst ()

Since: API Level 9

Deletes and returns the smallest element, or null if the set is empty.

Returns
  • the smallest element, or null if the set is empty

public abstract E pollLast ()

Since: API Level 9

Deletes and returns the biggest element, or null if the set is empty.

Returns
  • the biggest element, or null if the set is empty

public abstract NavigableSet<E> subSet (E start, boolean startInclusive, E end, boolean endInclusive)

Since: API Level 9

Returns a NavigableSet of the specified portion of this set which contains elements greater (or equal to, depends on startInclusive) the start element but less than (or equal to, depends on endInclusive) the end element. The returned NavigableSet is backed by this set so changes to one are reflected by the other.

Parameters
start the start element
startInclusive true if the start element is in the returned set
end the end element
endInclusive true if the end element is in the returned set
Returns
  • the subset
Throws
ClassCastException when the start or end object cannot be compared with the elements in this set
NullPointerException when the start or end object is null and the set cannot contain null
IllegalArgumentException when the start is bigger than end; or start or end is out of range and the set has a range

public abstract NavigableSet<E> tailSet (E start, boolean startInclusive)

Since: API Level 9

Returns a NavigableSet of the specified portion of this set which contains elements greater (or equal to, depends on startInclusive) the start element. The returned NavigableSet is backed by this set so changes to one are reflected by the other.

Parameters
start the start element
startInclusive true if the start element is in the returned set
Returns
  • the subset
Throws
ClassCastException when the start object cannot be compared with the elements in this set
NullPointerException when the start object is null and the set cannot contain null
IllegalArgumentException when start is out of range and the set has a range