public interface DoublyLinkedList<T extends DoublyLinkedList.Item<?>>
extends java.lang.Iterable<T>
| Modifier and Type | Interface and Description |
|---|---|
static interface |
DoublyLinkedList.Item<T extends DoublyLinkedList.Item<?>>
List element
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear this list
|
boolean |
contains(T item)
Returns true if the list contains an item i where
i.equals(item) is true. |
java.util.Enumeration<T> |
elements()
Get a
Enumeration of DoublyLinkedList.Item. |
boolean |
hasNext(T i) |
boolean |
hasPrev(T i) |
T |
head()
Returns the first item.
|
void |
insertNext(T i,
T j)
Inserts item j after item i
|
void |
insertPrev(T i,
T j)
Inserts item
j before item i. |
boolean |
isEmpty()
Check if this list is empty.
|
T |
next(T i) |
T |
pop()
Removes and returns the last item.
|
DoublyLinkedList<T> |
pop(int n)
Remove n elements from tail and return them as a
DoublyLinkedList. |
T |
prev(T i) |
void |
push(T i)
Puts the item after the last item.
|
T |
remove(T i)
Remove and return a element
|
T |
shift()
Removes and returns the first item.
|
DoublyLinkedList<T> |
shift(int n)
Remove n elements from head and return them as a
DoublyLinkedList. |
int |
size()
Return the size of this list
|
T |
tail()
Returns the last item.
|
void |
unshift(T i)
Puts the item before the first item.
|
void clear()
int size()
boolean isEmpty()
true if this list is empty, false otherwise.java.util.Enumeration<T> elements()
Enumeration of DoublyLinkedList.Item.boolean contains(T item)
i.equals(item) is true.T head()
null if emptyT tail()
null if emptyvoid unshift(T i)
T shift()
DoublyLinkedList<T> shift(int n)
DoublyLinkedList.void push(T i)
T pop()
DoublyLinkedList<T> pop(int n)
DoublyLinkedList.boolean hasNext(T i)
true if i has next item. (ie. not the last item); false otherwiseboolean hasPrev(T i)
true if i has previous item. (ie. not the first item); false otherwiseT remove(T i)
null if the item was not in the list