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:
java.lang.Iterable<E>
,java.util.Collection<E>
,java.util.NavigableSet<E>
,java.util.Set<E>
,java.util.SortedSet<E>
public abstract class ForwardingNavigableSet<E> extends ForwardingSortedSet<E> implements java.util.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)
java.util.Iterator<E>
descendingIterator()
java.util.NavigableSet<E>
descendingSet()
E
floor(E e)
java.util.NavigableSet<E>
headSet(E toElement, boolean inclusive)
E
higher(E e)
E
lower(E e)
E
pollFirst()
E
pollLast()
java.util.NavigableSet<E>
subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
java.util.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
-
-
-
-
Method Detail
-
descendingSet
public java.util.NavigableSet<E> descendingSet()
- Specified by:
descendingSet
in interfacejava.util.NavigableSet<E>
-
descendingIterator
public java.util.Iterator<E> descendingIterator()
- Specified by:
descendingIterator
in interfacejava.util.NavigableSet<E>
-
subSet
public java.util.NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
- Specified by:
subSet
in interfacejava.util.NavigableSet<E>
-
headSet
public java.util.NavigableSet<E> headSet(E toElement, boolean inclusive)
- Specified by:
headSet
in interfacejava.util.NavigableSet<E>
-
-