Class Sequence<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
java.util.TreeSet<E>
org.apache.camel.processor.resequencer.Sequence<E>
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<E>
,Collection<E>
,NavigableSet<E>
,Set<E>
,SortedSet<E>
A sorted set of elements with additional methods for obtaining immediate successors and immediate predecessors of a
given element in the sequence. Successors and predecessors are calculated by using a
SequenceElementComparator
.- See Also:
-
Constructor Summary
ConstructorDescriptionSequence
(SequenceElementComparator<E> comparator) Creates a newSequence
instance. -
Method Summary
Modifier and TypeMethodDescriptionReturns this sequence's comparator.Returns the next higher element in the sequence to the given element.Returns the next lower element in the sequence to the given element.predecessor
(E e) Returns the immediate predecessor of the given element in this sequence ornull
if no predecessor exists.Returns the immediate successor of the given element in this sequence ornull
if no successor exists.Methods inherited from class java.util.TreeSet
add, addAll, ceiling, clear, clone, contains, descendingIterator, descendingSet, first, floor, headSet, headSet, isEmpty, iterator, last, pollFirst, pollLast, remove, size, spliterator, subSet, subSet, tailSet, tailSet
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
Methods inherited from class java.util.AbstractCollection
containsAll, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Constructor Details
-
Sequence
Creates a newSequence
instance.- Parameters:
comparator
- a strategy for comparing elements of this sequence.
-
-
Method Details
-
predecessor
Returns the immediate predecessor of the given element in this sequence ornull
if no predecessor exists.- Parameters:
e
- an element which is compared to elements of this sequence.- Returns:
- an element of this sequence or
null
.
-
successor
Returns the immediate successor of the given element in this sequence ornull
if no successor exists.- Parameters:
e
- an element which is compared to elements of this sequence.- Returns:
- an element of this sequence or
null
.
-
comparator
Returns this sequence's comparator.- Specified by:
comparator
in interfaceSortedSet<E>
- Overrides:
comparator
in classTreeSet<E>
- Returns:
- this sequence's comparator.
-
higher
Returns the next higher element in the sequence to the given element. If the given element doesn't exist or if it is the last element in the sequencenull
is returned. Please note that this method is provided for compatibility with Java 5 SE. On a Java 6 SE platform the same method implemented by theTreeSet
class should be used for better performance. -
lower
Returns the next lower element in the sequence to the given element. If the given element doesn't exist or if it is the first element in the sequencenull
is returned. Please note that this method is provided for compatibility with Java 5 SE. On a Java 6 SE platform the same method implemented by theTreeSet
class should be used for better performance.
-