public interface PositionList<E>
| Modifier and Type | Method and Description |
|---|---|
void |
addAfter(Position<E> p,
E e)
Inserts an element after position p.
|
void |
addBefore(Position<E> p,
E e)
Inserts an element before position p.
|
void |
addFirst(E e)
Inserts an element at the front of the list.
|
void |
addLast(E e)
Inserts an element at the back of the list.
|
Position<E> |
first()
Returns the first node in the list.
|
boolean |
isEmpty()
Returns true if the list is empty.
|
Position<E> |
last()
Returns the last node in the list.
|
Position<E> |
next(Position<E> p)
Returns the node after position p.
|
Position<E> |
prev(Position<E> p)
Returns the node before position.
|
Position<E> |
remove(Position<E> p)
Remove the element at a given position
|
E |
set(Position<E> p,
E e)
Replaces the element stored at the given node
|
int |
size()
Returns the number of elements in this list.
|
int size()
boolean isEmpty()
Position<E> next(Position<E> p) throws InvalidPositionException, BoundaryViolationException
Position<E> prev(Position<E> p) throws InvalidPositionException, BoundaryViolationException
void addFirst(E e)
void addLast(E e)
void addAfter(Position<E> p, E e) throws InvalidPositionException
InvalidPositionExceptionvoid addBefore(Position<E> p, E e) throws InvalidPositionException
InvalidPositionExceptionPosition<E> remove(Position<E> p) throws InvalidPositionException
InvalidPositionExceptionE set(Position<E> p, E e) throws InvalidPositionException
InvalidPositionException