Interface SmartSequence<E>
-
- Type Parameters:
E
- element class.
- All Superinterfaces:
Collection<E>
,Iterable<E>
,SmartCollection<E>
- All Known Implementing Classes:
AbstractLinkedList
,DefaultLinkedList
,IntrusiveLinkedList
public interface SmartSequence<E> extends SmartCollection<E>
Sequence interface. A sequence is a collection where elements are stored in a specific order, and elements can be inserted in between.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ElementReference
insertAfter(E element, ElementReference ref)
Inserts the given element after the element referenced by the specified reference.ElementReference
insertBefore(E element, ElementReference ref)
Inserts the given element before the element referenced by the specified reference.@Nullable ElementReference
pred(ElementReference ref)
Retrieves the reference to the preceding element, ornull
if the given reference references the first element in the list.@Nullable ElementReference
succ(ElementReference ref)
Retrieves the reference to the succeeding element, ornull
if the given reference references the last element in the list.-
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray
-
Methods inherited from interface net.automatalib.common.smartcollection.SmartCollection
addAll, addAll, choose, chooseRef, deepClear, find, get, quickClear, referencedAdd, referenceIterator, references, remove, remove, replace
-
-
-
-
Method Detail
-
pred
@Nullable ElementReference pred(ElementReference ref)
Retrieves the reference to the preceding element, ornull
if the given reference references the first element in the list.- Parameters:
ref
- the reference- Returns:
- the reference to the preceding element
-
succ
@Nullable ElementReference succ(ElementReference ref)
Retrieves the reference to the succeeding element, ornull
if the given reference references the last element in the list.- Parameters:
ref
- the reference- Returns:
- the reference to the succeeding element
-
insertBefore
ElementReference insertBefore(E element, ElementReference ref)
Inserts the given element before the element referenced by the specified reference.- Parameters:
element
- the element to be added.ref
- reference to the element before which the new element is to be inserted.- Returns:
- reference to the newly added element.
-
insertAfter
ElementReference insertAfter(E element, ElementReference ref)
Inserts the given element after the element referenced by the specified reference.- Parameters:
element
- the element to be added.ref
- reference to the element after which the new element is to be inserted.- Returns:
- reference to the newly added element.
-
-