All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class list.DList

java.lang.Object
   |
   +----list.DList

public class DList
extends Object
The DList class implements a doubly-linked list abstraction. DLists are mutable data structures.


Constructor Index

 o DList()
Constructs an empty d1ist.

Method Index

 o back()
Creates a Position that is at the back of the list.
 o front()
Creates a Position that is at the front of the list.
 o insertFront(Object)
Inserts obj into this DList at the front.
 o isEmpty()
Returns true if this DList is empty, false otherwise.
 o length()
Returns the length of this DList.
 o main(String[])
 o toString()
Returns a String representation of the DList.

Constructors

 o DList
 public DList()
Constructs an empty d1ist.

Methods

 o isEmpty
 public boolean isEmpty()
Returns true if this DList is empty, false otherwise.

Returns:
true if the DList is empty, false otherwise. Performance: runs in O(1) time.
 o length
 public int length()
Returns the length of this DList.

Returns:
the length of the DList. Performance: runs in O(n) time, where n is the length of the list.
 o insertFront
 public void insertFront(Object value)
Inserts obj into this DList at the front.

Parameters:
value - is the value to be inserted. Performance: runs in O(1) time.
 o front
 public Position front()
Creates a Position that is at the front of the list.

 o back
 public Position back()
Creates a Position that is at the back of the list.

 o toString
 public String toString()
Returns a String representation of the DList.

Returns:
a String representation of the DList. Performance: runs in O(n) time, where n is the length of the list.
Overrides:
toString in class Object
 o main
 public static void main(String argv[])

All Packages  Class Hierarchy  This Package  Previous  Next  Index