Package gnu.trove.list.linked
Class TLinkedList.IteratorImpl
- java.lang.Object
-
- gnu.trove.list.linked.TLinkedList.IteratorImpl
-
- All Implemented Interfaces:
java.util.Iterator<T>,java.util.ListIterator<T>
- Enclosing class:
- TLinkedList<T extends TLinkable<T>>
protected final class TLinkedList.IteratorImpl extends java.lang.Object implements java.util.ListIterator<T>A ListIterator that supports additions and deletions.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(T linkable)Insert linkable at the current position of the iterator.booleanhasNext()True if a call to next() will return an object.booleanhasPrevious()True if a call to previous() will return a value.Tnext()Returns the value at the Iterator's index and advances the iterator.intnextIndex()returns the index of the next node in the list (the one that would be returned by a call to next()).Tprevious()Returns the value before the Iterator's index and moves the iterator back one index.intpreviousIndex()Returns the previous element's index.voidremove()Removes the current element in the list and shrinks its size accordingly.voidset(T linkable)Replaces the current element in the list with linkable
-
-
-
Method Detail
-
add
public final void add(T linkable)
Insert linkable at the current position of the iterator. Calling next() after add() will return the added object.
-
hasNext
public final boolean hasNext()
True if a call to next() will return an object.
-
hasPrevious
public final boolean hasPrevious()
True if a call to previous() will return a value.
-
next
public final T next()
Returns the value at the Iterator's index and advances the iterator.
-
nextIndex
public final int nextIndex()
returns the index of the next node in the list (the one that would be returned by a call to next()).
-
previous
public final T previous()
Returns the value before the Iterator's index and moves the iterator back one index.
-
previousIndex
public final int previousIndex()
Returns the previous element's index.
-
remove
public final void remove()
Removes the current element in the list and shrinks its size accordingly.- Specified by:
removein interfacejava.util.Iterator<T extends TLinkable<T>>- Specified by:
removein interfacejava.util.ListIterator<T extends TLinkable<T>>- Throws:
java.lang.IllegalStateException- neither next nor previous have been invoked, or remove or add have been invoked after the last invocation of next or previous.
-
-