Interface NavigableSet<E>
- Record Components:
the-type of element
Since
1.6
- All Superinterfaces:
Collection<E>, Iterable<E>, Set<E>, SortedSet<E>
- All Known Implementing Classes:
TreeSet
-
Method Summary
Modifier and TypeMethodDescriptionAnswers the smallest element bigger than or equal to the specified one, or null if no such element.Answers a descending iterator of this set.Answers a reverse order view of this set.Answers the biggest element less than or equal to the specified one, or null if no such element.Answers a NavigableSet of the specified portion of this set which contains elements less than (or equal to, depends on endInclusive) the end element.Answers the smallest element bigger than the specified one, or null if no such element.Answers the biggest element less than the specified one, or null if no such element.Deletes and answers the smallest element, or null if the set is empty.pollLast()Deletes and answers the biggest element, or null if the set is empty.Answers 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.Answers a NavigableSet of the specified portion of this set which contains elements greater (or equal to, depends on startInclusive) the start element.
-
Method Details
-
pollFirst
E pollFirst()Deletes and answers the smallest element, or null if the set is empty.
Returns
the smallest element, or null if the set is empty
-
pollLast
E pollLast()Deletes and answers the biggest element, or null if the set is empty.
Returns
the biggest element, or null if the set is empty
-
higher
Answers the smallest element bigger than the specified one, or null if no such element.
Parameters
e: the specified element
Returns
- 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
-
-
ceiling
Answers the smallest element bigger than or equal to the specified one, or null if no such element.
Parameters
e: the specified element
Returns
- 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
-
-
lower
Answers the biggest element less than the specified one, or null if no such element.
Parameters
e: the specified element
Returns
- 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
-
-
floor
Answers the biggest element less than or equal to the specified one, or null if no such element.
Parameters
e: the specified element
Returns
- 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
-
-
descendingIterator
-
descendingSet
NavigableSet<E> descendingSet()Answers a reverse order view of this set.
Returns
the reverse order view
-
subSet
Answers 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: @throws ClassCastException when the start or end object cannot be compared with the elements in this set -
NullPointerException: @throws NullPointerException when the start or end object is null and the set cannot contain null -
IllegalArgumentException: @throws IllegalArgumentException when the start is bigger than end; or start or end is out of range and the set has a range
-
-
headSet
Answers 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: @throws ClassCastException when the end object cannot be compared with the elements in this set -
NullPointerException: @throws 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
-
-
tailSet
Answers 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: @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
-
-