Package gnu.trove.list.linked
Class TLinkedList.IteratorImpl
java.lang.Object
gnu.trove.list.linked.TLinkedList.IteratorImpl
- All Implemented Interfaces:
Iterator<T>
,ListIterator<T>
- Enclosing class:
TLinkedList<T extends TLinkable<T>>
A ListIterator that supports additions and deletions.
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
Insert linkable at the current position of the iterator.final boolean
hasNext()
True if a call to next() will return an object.final boolean
True if a call to previous() will return a value.final T
next()
Returns the value at the Iterator's index and advances the iterator.final int
returns the index of the next node in the list (the one that would be returned by a call to next()).final T
previous()
Returns the value before the Iterator's index and moves the iterator back one index.final int
Returns the previous element's index.final void
remove()
Removes the current element in the list and shrinks its size accordingly.final void
Replaces the current element in the list with linkableMethods 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
-
Method Details
-
add
Insert linkable at the current position of the iterator. Calling next() after add() will return the added object.- Specified by:
add
in interfaceListIterator<T extends TLinkable<T>>
- Parameters:
linkable
- an object of type TLinkable
-
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.- Specified by:
hasPrevious
in interfaceListIterator<T extends TLinkable<T>>
- Returns:
- a
boolean
value
-
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()).- Specified by:
nextIndex
in interfaceListIterator<T extends TLinkable<T>>
- Returns:
- an
int
value
-
previous
Returns the value before the Iterator's index and moves the iterator back one index.- Specified by:
previous
in interfaceListIterator<T extends TLinkable<T>>
- Returns:
- an
Object
value - Throws:
NoSuchElementException
- if there is no previous element.
-
previousIndex
public final int previousIndex()Returns the previous element's index.- Specified by:
previousIndex
in interfaceListIterator<T extends TLinkable<T>>
- Returns:
- an
int
value
-
remove
public final void remove()Removes the current element in the list and shrinks its size accordingly. -
set
Replaces the current element in the list with linkable- Specified by:
set
in interfaceListIterator<T extends TLinkable<T>>
- Parameters:
linkable
- an object of type TLinkable
-