Class ForwardingNavigableSet<E>
- java.lang.Object
-
- com.google.common.collect.ForwardingObject
-
- com.google.common.collect.ForwardingCollection<E>
-
- com.google.common.collect.ForwardingSet<E>
-
- com.google.common.collect.ForwardingSortedSet<E>
-
- com.google.common.collect.ForwardingNavigableSet<E>
-
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
,NavigableSet<E>
,Set<E>
,SortedSet<E>
public abstract class ForwardingNavigableSet<E> extends ForwardingSortedSet<E> implements NavigableSet<E>
A navigable set which forwards all its method calls to another navigable set. Subclasses should override one or more methods to modify the behavior of the backing set as desired per the decorator pattern.Warning: The methods of
ForwardingNavigableSet
forward indiscriminately to the methods of the delegate. For example, overridingForwardingCollection.add(E)
alone will not change the behavior ofForwardingCollection.addAll(java.util.Collection<? extends E>)
, which can lead to unexpected behavior. In this case, you should overrideaddAll
as well, either providing your own implementation, or delegating to the providedstandardAddAll
method.Each of the
standard
methods uses the set's comparator (or the natural ordering of the elements, if there is no comparator) to test element equality. As a result, if the comparator is not consistent with equals, some of the standard implementations may violate theSet
contract.The
standard
methods and the collection views they return are not guaranteed to be thread-safe, even when all of the methods that they depend on are thread-safe.- Since:
- 12.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description E
ceiling(E e)
Iterator<E>
descendingIterator()
NavigableSet<E>
descendingSet()
E
floor(E e)
NavigableSet<E>
headSet(E toElement, boolean inclusive)
E
higher(E e)
E
lower(E e)
E
pollFirst()
E
pollLast()
NavigableSet<E>
subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
NavigableSet<E>
tailSet(E fromElement, boolean inclusive)
-
Methods inherited from class com.google.common.collect.ForwardingSortedSet
comparator, first, headSet, last, subSet, tailSet
-
Methods inherited from class com.google.common.collect.ForwardingSet
equals, hashCode
-
Methods inherited from class com.google.common.collect.ForwardingCollection
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
-
Methods inherited from class com.google.common.collect.ForwardingObject
toString
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.NavigableSet
headSet, iterator, subSet, tailSet
-
Methods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, size, toArray, toArray
-
Methods inherited from interface java.util.SortedSet
comparator, first, last, spliterator
-
-
-
-
Method Detail
-
lower
public E lower(E e)
- Specified by:
lower
in interfaceNavigableSet<E>
-
floor
public E floor(E e)
- Specified by:
floor
in interfaceNavigableSet<E>
-
ceiling
public E ceiling(E e)
- Specified by:
ceiling
in interfaceNavigableSet<E>
-
higher
public E higher(E e)
- Specified by:
higher
in interfaceNavigableSet<E>
-
pollFirst
public E pollFirst()
- Specified by:
pollFirst
in interfaceNavigableSet<E>
-
pollLast
public E pollLast()
- Specified by:
pollLast
in interfaceNavigableSet<E>
-
descendingSet
public NavigableSet<E> descendingSet()
- Specified by:
descendingSet
in interfaceNavigableSet<E>
-
descendingIterator
public Iterator<E> descendingIterator()
- Specified by:
descendingIterator
in interfaceNavigableSet<E>
-
subSet
public NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
- Specified by:
subSet
in interfaceNavigableSet<E>
-
headSet
public NavigableSet<E> headSet(E toElement, boolean inclusive)
- Specified by:
headSet
in interfaceNavigableSet<E>
-
tailSet
public NavigableSet<E> tailSet(E fromElement, boolean inclusive)
- Specified by:
tailSet
in interfaceNavigableSet<E>
-
-