public interface Loop<E>
extends java.lang.Iterable<E>
Modifier and Type | Method and Description |
---|---|
void |
backward()
Moves the current item backward one item resulting in the item
that is immediately before the current item becoming the
current item.
|
void |
forward()
Advances the current item forward one item resulting in the item
that is immediately after the current item becoming the
current item.
|
E |
getCurrent()
Returns the current item.
|
void |
insert(E item)
Adds the given item immediately before the current
item.
|
boolean |
isEmpty()
Returns true if this Loop is empty and false otherwise.
|
java.util.Iterator<E> |
iterator()
Returns an iterator for this Loop.
|
E |
removeCurrent()
Removes and returns the current item.
|
int |
size()
Returns the number of items in this Loop.
|
E getCurrent()
EmptyLoopException
- if the Loop is emptyvoid insert(E item)
item
- the item to addE removeCurrent()
EmptyLoopException
- if the Loop is emptyvoid forward()
EmptyLoopException
- if the Loop is emptyvoid backward()
EmptyLoopException
- if the Loop is emptyint size()
boolean isEmpty()