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
ForwardingNavigableSetforward 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 overrideaddAllas well, either providing your own implementation, or delegating to the providedstandardAddAllmethod.Each of the
standardmethods 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 theSetcontract.The
standardmethods 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 Eceiling(E e)Iterator<E>descendingIterator()NavigableSet<E>descendingSet()Efloor(E e)NavigableSet<E>headSet(E toElement, boolean inclusive)Ehigher(E e)Elower(E e)EpollFirst()EpollLast()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:
lowerin interfaceNavigableSet<E>
-
floor
public E floor(E e)
- Specified by:
floorin interfaceNavigableSet<E>
-
ceiling
public E ceiling(E e)
- Specified by:
ceilingin interfaceNavigableSet<E>
-
higher
public E higher(E e)
- Specified by:
higherin interfaceNavigableSet<E>
-
pollFirst
public E pollFirst()
- Specified by:
pollFirstin interfaceNavigableSet<E>
-
pollLast
public E pollLast()
- Specified by:
pollLastin interfaceNavigableSet<E>
-
descendingSet
public NavigableSet<E> descendingSet()
- Specified by:
descendingSetin interfaceNavigableSet<E>
-
descendingIterator
public Iterator<E> descendingIterator()
- Specified by:
descendingIteratorin interfaceNavigableSet<E>
-
subSet
public NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
- Specified by:
subSetin interfaceNavigableSet<E>
-
headSet
public NavigableSet<E> headSet(E toElement, boolean inclusive)
- Specified by:
headSetin interfaceNavigableSet<E>
-
tailSet
public NavigableSet<E> tailSet(E fromElement, boolean inclusive)
- Specified by:
tailSetin interfaceNavigableSet<E>
-
-