|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.mhhe.clrs2e.LinkedList | +--com.mhhe.clrs2e.LinearDLL
A simple linear, doubly linked list without a sentinel from pages 205-206 of Introduction to Algorithms, Second edition.
Nested Class Summary | |
class |
LinearDLL.LinearDLLIterator
Inner class for an iterator. |
Nested classes inherited from class com.mhhe.clrs2e.LinkedList |
LinkedList.Node |
Field Summary | |
protected LinkedList.Node |
head
The first node in the list. |
Constructor Summary | |
LinearDLL()
Makes an empty list. |
Method Summary | |
void |
concatenate(com.mhhe.clrs2e.LinkedList l)
Concatenates another linked list onto the end of this list, destroying the other linked list. |
void |
delete(java.lang.Object handle)
Removes an element. |
java.lang.Object |
insert(java.lang.Object o)
Inserts an element at the head of the list. |
java.lang.Object |
insertAfter(java.lang.Object o,
java.lang.Object after)
Inserts an element after a given element. |
boolean |
isEmpty()
Returns true if this list is empty,
false otherwise. |
java.util.Iterator |
iterator()
Creates and returns an Iterator object for this
list. |
Methods inherited from class com.mhhe.clrs2e.LinkedList |
dereference, toArray, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected LinkedList.Node head
Constructor Detail |
public LinearDLL()
Method Detail |
public java.lang.Object insert(java.lang.Object o)
insert
in class LinkedList
o
- The element to be inserted.
public java.lang.Object insertAfter(java.lang.Object o, java.lang.Object after)
insertAfter
in class LinkedList
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 void delete(java.lang.Object handle)
delete
in class LinkedList
handle
- Handle to the element to remove.public boolean isEmpty()
true
if this list is empty,
false
otherwise.
isEmpty
in class LinkedList
public java.util.Iterator iterator()
Iterator
object for this
list.
iterator
in class LinkedList
public void concatenate(com.mhhe.clrs2e.LinkedList l)
concatenate
in class LinkedList
l
- The linked list to be concatenated onto the end of
this list.
java.lang.ClassCastException
- if l
is not a
LinearDLL
object.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |