Class CursorableLinkedList.SubCursor<E>
- java.lang.Object
-
- org.apache.commons.collections4.list.AbstractLinkedList.LinkedListIterator<E>
-
- org.apache.commons.collections4.list.CursorableLinkedList.Cursor<E>
-
- org.apache.commons.collections4.list.CursorableLinkedList.SubCursor<E>
-
- All Implemented Interfaces:
Iterator<E>,ListIterator<E>,OrderedIterator<E>
- Enclosing class:
- CursorableLinkedList<E>
protected static class CursorableLinkedList.SubCursor<E> extends CursorableLinkedList.Cursor<E>
A cursor for the sublist based on LinkedSubListIterator.- Since:
- 3.2
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractLinkedList.LinkedSubList<E>subThe parent list-
Fields inherited from class org.apache.commons.collections4.list.CursorableLinkedList.Cursor
currentRemovedByAnother, nextIndexValid, valid
-
Fields inherited from class org.apache.commons.collections4.list.AbstractLinkedList.LinkedListIterator
current, expectedModCount, next, nextIndex, parent
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSubCursor(AbstractLinkedList.LinkedSubList<E> sub, int index)Constructs a new cursor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(E obj)Adds an object to the list.booleanhasNext()booleanhasPrevious()Checks to see if there is a previous element that can be iterated to.intnextIndex()Gets the index of the next element to be returned.voidremove()Removes the item last returned by this iterator.-
Methods inherited from class org.apache.commons.collections4.list.CursorableLinkedList.Cursor
checkModCount, close, nodeChanged, nodeInserted, nodeRemoved
-
Methods inherited from class org.apache.commons.collections4.list.AbstractLinkedList.LinkedListIterator
getLastNodeReturned, next, previous, previousIndex, set
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Field Detail
-
sub
protected final AbstractLinkedList.LinkedSubList<E> sub
The parent list
-
-
Constructor Detail
-
SubCursor
protected SubCursor(AbstractLinkedList.LinkedSubList<E> sub, int index)
Constructs a new cursor.- Parameters:
sub- the sub listindex- the index to start from
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfaceIterator<E>- Specified by:
hasNextin interfaceListIterator<E>- Overrides:
hasNextin classAbstractLinkedList.LinkedListIterator<E>
-
hasPrevious
public boolean hasPrevious()
Description copied from interface:OrderedIteratorChecks to see if there is a previous element that can be iterated to.- Specified by:
hasPreviousin interfaceListIterator<E>- Specified by:
hasPreviousin interfaceOrderedIterator<E>- Overrides:
hasPreviousin classAbstractLinkedList.LinkedListIterator<E>- Returns:
trueif the iterator has a previous element
-
nextIndex
public int nextIndex()
Description copied from class:CursorableLinkedList.CursorGets the index of the next element to be returned.- Specified by:
nextIndexin interfaceListIterator<E>- Overrides:
nextIndexin classCursorableLinkedList.Cursor<E>- Returns:
- the next index
-
add
public void add(E obj)
Description copied from class:CursorableLinkedList.CursorAdds an object to the list. The object added here will be the new 'previous' in the iterator.- Specified by:
addin interfaceListIterator<E>- Overrides:
addin classCursorableLinkedList.Cursor<E>- Parameters:
obj- the object to add
-
remove
public void remove()
Description copied from class:CursorableLinkedList.CursorRemoves the item last returned by this iterator.There may have been subsequent alterations to the list since you obtained this item, however you can still remove it. You can even remove it if the item is no longer in the main list. However, you can't call this method on the same iterator more than once without calling next() or previous().
- Specified by:
removein interfaceIterator<E>- Specified by:
removein interfaceListIterator<E>- Overrides:
removein classCursorableLinkedList.Cursor<E>
-
-