| 
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectstructure.AbstractStructure<ELTTYPE>
structure.AbstractList<ELTTYPE>
structure.DoublyLinkedList<ELTTYPE>
public class DoublyLinkedList<ELTTYPE>
An implementation of lists using doubly linked elements, similar to that of java.util.LinkedList.
 
       
 This class is a basic implementation of the List interface.
 Operations accessing or modifying either the head or the tail of 
 the list execute in constant time.
 Doubly linked lists are less space-efficient than singly linked lists, 
 but tail-related operations are less costly.
 
Example usage: To place a copy of every unique parameter passed to a program into a DoublyLinkedList, we would use the following:
public static void main(String[]arguments) {DoublyLinkedListargList = newDoublyLinkedList(); for (int i = 0; i < arguments.length; i++){ if (!argList.contains(arguments[i])){ argList.add(arguments[i]); } } System.out.println(argList); }
SinglyLinkedList, 
CircularList| Constructor Summary | |
|---|---|
DoublyLinkedList()
Constructs an empty list.  | 
|
| Method Summary | |
|---|---|
 void | 
add(ELTTYPE value)
Add a value to head of list.  | 
 void | 
add(int i,
    ELTTYPE o)
Insert value at location.  | 
 void | 
addFirst(ELTTYPE value)
Add a value to head of list.  | 
 void | 
addLast(ELTTYPE value)
Add a value to tail of list.  | 
 void | 
clear()
Remove all values from list.  | 
 boolean | 
contains(ELTTYPE value)
Check to see if a value is within list.  | 
 ELTTYPE | 
get(int i)
Get value at location i.  | 
 ELTTYPE | 
getFirst()
Get a copy of first value found in list.  | 
 ELTTYPE | 
getLast()
Get a copy of last value found in list.  | 
 int | 
indexOf(ELTTYPE value)
Determine first location of a value in list.  | 
 boolean | 
isEmpty()
Determine if list is empty.  | 
 java.util.Iterator<ELTTYPE> | 
iterator()
Construct an iterator to traverse list.  | 
 int | 
lastIndexOf(ELTTYPE value)
Determine last location of a value in list.  | 
 ELTTYPE | 
remove(ELTTYPE value)
Remove a value from list.  | 
 ELTTYPE | 
remove(int i)
Remove and return value at location i.  | 
 ELTTYPE | 
removeFirst()
Remove a value from head of list.  | 
 ELTTYPE | 
removeLast()
Remove a value from tail of list.  | 
 ELTTYPE | 
set(int i,
    ELTTYPE o)
Set value stored at location i to object o, returning old value.  | 
 int | 
size()
Determine number of elements in list.  | 
 java.lang.String | 
toString()
Construct a string representation of list.  | 
| Methods inherited from class structure.AbstractList | 
|---|
get, remove | 
| Methods inherited from class structure.AbstractStructure | 
|---|
elements, hashCode, values | 
| Methods inherited from class java.lang.Object | 
|---|
equals, getClass, notify, notifyAll, wait, wait, wait | 
| Methods inherited from interface structure.Structure | 
|---|
elements, values | 
| Constructor Detail | 
|---|
public DoublyLinkedList()
| Method Detail | 
|---|
public void add(ELTTYPE value)
add in interface List<ELTTYPE>add in interface Structure<ELTTYPE>add in class AbstractList<ELTTYPE>value - value to be added.AbstractList.addLast(ELTTYPE)public void addFirst(ELTTYPE value)
addFirst in interface List<ELTTYPE>addFirst in class AbstractList<ELTTYPE>value - value to be added.public ELTTYPE removeFirst()
removeFirst in interface List<ELTTYPE>removeFirst in class AbstractList<ELTTYPE>public void addLast(ELTTYPE value)
addLast in interface List<ELTTYPE>addLast in class AbstractList<ELTTYPE>value - value to be added.public ELTTYPE removeLast()
removeLast in interface List<ELTTYPE>removeLast in class AbstractList<ELTTYPE>public ELTTYPE getFirst()
getFirst in interface List<ELTTYPE>getFirst in class AbstractList<ELTTYPE>public ELTTYPE getLast()
getLast in interface List<ELTTYPE>getLast in class AbstractList<ELTTYPE>public boolean contains(ELTTYPE value)
contains in interface List<ELTTYPE>contains in interface Structure<ELTTYPE>contains in class AbstractList<ELTTYPE>value - A value to be found in list.
public ELTTYPE remove(ELTTYPE value)
value - value to be removed.
public int size()
public boolean isEmpty()
isEmpty in interface List<ELTTYPE>isEmpty in interface Structure<ELTTYPE>isEmpty in class AbstractList<ELTTYPE>public void clear()
public ELTTYPE get(int i)
i - position of value to be retrieved.
public ELTTYPE set(int i,
                   ELTTYPE o)
i - location of entry to be changed.o - new value
public void add(int i,
                ELTTYPE o)
i - index of this new valueo - value to be storedpublic ELTTYPE remove(int i)
i - position of value to be retrieved.
public int indexOf(ELTTYPE value)
value - value sought.
public int lastIndexOf(ELTTYPE value)
value - value sought.
public java.util.Iterator<ELTTYPE> iterator()
AbstractIterator, 
Iterator, 
Enumeration, 
Structure.elements()public java.lang.String toString()
toString in class java.lang.Object
  | 
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||