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.
-
DList()
- Constructs an empty d1ist.
-
back()
- Creates a Position that is at the back of the list.
-
front()
- Creates a Position that is at the front of the list.
-
insertFront(Object)
- Inserts obj into this DList at the front.
-
isEmpty()
- Returns true if this DList is empty,
false otherwise.
-
length()
- Returns the length of this DList.
-
main(String[])
-
-
toString()
- Returns a String representation of the DList.
DList
public DList()
- Constructs an empty d1ist.
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.
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.
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.
front
public Position front()
- Creates a Position that is at the front of the list.
back
public Position back()
- Creates a Position that is at the back of the list.
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
main
public static void main(String argv[])
All Packages Class Hierarchy This Package Previous Next Index