|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.mhhe.clrs2e.LinkedList
Abstract class for a doubly linked list in Section 10.2 of Introduction to Algorithms, Second edition.
Nested Class Summary | |
class |
LinkedList.ListIterator
Abstract inner class for an iterator. |
protected static class |
LinkedList.Node
Inner class for nodes of a linked list. |
Constructor Summary | |
LinkedList()
|
Method Summary | |
abstract void |
concatenate(com.mhhe.clrs2e.LinkedList l)
Concatenates another linked list onto the end of this list, destroying the other linked list. |
abstract void |
delete(java.lang.Object handle)
Removes an element. |
static java.lang.Object |
dereference(java.lang.Object node)
Returns the object stored in a node. |
abstract java.lang.Object |
insert(java.lang.Object o)
Inserts an element at the head of the list. |
abstract java.lang.Object |
insertAfter(java.lang.Object o,
java.lang.Object after)
Inserts an element after a given element. |
abstract boolean |
isEmpty()
Returns true if this list is empty,
false otherwise. |
abstract java.util.Iterator |
iterator()
Creates and returns an Iterator object for this
list. |
void |
toArray(java.lang.Object[] array)
Copies each element of this list into an array. |
java.lang.String |
toString()
Returns the String representation of this list. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public LinkedList()
Method Detail |
public static java.lang.Object dereference(java.lang.Object node)
node
- The node.
java.lang.ClassCastException
- if node
does not
reference a Node
object.public abstract java.lang.Object insert(java.lang.Object o)
o
- The element to be inserted.
public abstract java.lang.Object insertAfter(java.lang.Object o, java.lang.Object after)
o
- The element to be inserted.after
- The element after which the new element is to be
inserted. If null
, the new element is inserted at
the head of the list.
public abstract void delete(java.lang.Object handle)
handle
- Handle to the element to remove.public abstract boolean isEmpty()
true
if this list is empty,
false
otherwise.
public abstract java.util.Iterator iterator()
Iterator
object for this
list.
public abstract void concatenate(com.mhhe.clrs2e.LinkedList l)
l
- The linked list to be concatenated onto the end of
this list.public java.lang.String toString()
String
representation of this list.
toString
in class java.lang.Object
public void toArray(java.lang.Object[] array)
array
- The array, assumed to be already allocated.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |