Constructor and Description |
---|
LinkedList() |
Modifier and Type | Method and Description |
---|---|
void |
add(E item)
Add item to the end of the list.
|
void |
add(int pos,
E item)
Add item to the pos index of the list.
|
boolean |
contains(E item)
Returns true iff item is in the List.
|
E |
get(int pos)
Returns a reference to the item at the specified position.
|
Listnode<E> |
getHeaderNode()
Returns a reference to the header node for this linked list.
|
boolean |
isEmpty()
Returns true iff the list has no items.
|
LinkedListIterator<E> |
iterator() |
E |
remove(int pos)
removes and returns the item at position pos in the List,
moving the items originally in positions pos+1 through size()-1
one place to the left to fill in the gap (error if pos is less
than 0 or greater than or equal to size())
|
int |
size()
Return the number of items in the List.
|
public LinkedListIterator<E> iterator()
iterator
in interface java.lang.Iterable<E>
public Listnode<E> getHeaderNode()
public void add(E item)
ListADT
public void add(int pos, E item)
ListADT
public boolean contains(E item)
ListADT
public E get(int pos)
ListADT
public boolean isEmpty()
ListADT
public E remove(int pos)
ListADT