|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectstructure.AbstractStructure
structure.AbstractList
structure.DoublyLinkedList
public class DoublyLinkedList
An implementation of lists that makes use of doubly linked elements. This provided efficient implementation of both head and tail operations.
| Constructor Summary | |
|---|---|
DoublyLinkedList()
Constructs an empty list. |
|
| Method Summary | |
|---|---|
void |
add(int i,
Object o)
Insert value at location. |
void |
add(Object value)
Add a value to head of list. |
void |
addFirst(Object value)
Add a value to head of list. |
void |
addLast(Object value)
Add a value to tail of list. |
void |
clear()
Remove all values from list. |
boolean |
contains(Object value)
Check to see if a value is within list. |
Object |
get(int i)
Get value at location i. |
Object |
getFirst()
Get a copy of first value found in list. |
Object |
getLast()
Get a copy of last value found in list. |
int |
indexOf(Object value)
Determine first location of a value in list. |
boolean |
isEmpty()
Determine if list is empty. |
Iterator |
iterator()
Construct an iterator to traverse list. |
int |
lastIndexOf(Object value)
Determine last location of a value in list. |
Object |
remove(int i)
Remove and return value at location i. |
Object |
remove(Object value)
Remove a value from list. |
Object |
removeFirst()
Remove a value from head of list. |
Object |
removeLast()
Remove a value from tail of list. |
Object |
set(int i,
Object o)
Set value stored at location i to object o, returning old value. |
int |
size()
Determine number of elements in list. |
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(Object value)
add in interface Listadd in interface Structureadd in class AbstractListvalue - value to be added.#addToHeadpublic void addFirst(Object value)
addFirst in interface ListaddFirst in class AbstractListvalue - value to be added.public Object removeFirst()
removeFirst in interface ListremoveFirst in class AbstractListpublic void addLast(Object value)
addLast in interface ListaddLast in class AbstractListvalue - value to be added.public Object removeLast()
removeLast in interface ListremoveLast in class AbstractListpublic Object getFirst()
getFirst in interface ListgetFirst in class AbstractListpublic Object getLast()
getLast in interface ListgetLast in class AbstractListpublic boolean contains(Object value)
contains in interface Listcontains in interface Structurecontains in class AbstractListvalue - A value to be found in list.
public Object remove(Object value)
value - value to be removed.
public int size()
public boolean isEmpty()
isEmpty in interface ListisEmpty in interface StructureisEmpty in class AbstractListpublic void clear()
public Object get(int i)
i - position of value to be retrieved.
public Object set(int i,
Object o)
i - location of entry to be changed.o - new value
public void add(int i,
Object o)
i - index of this new valueo - value to be storedpublic Object remove(int i)
i - position of value to be retrieved.
public int indexOf(Object value)
value - value sought.
public int lastIndexOf(Object value)
value - value sought.
public Iterator iterator()
AbstractIterator,
Iterator,
Enumeration,
Structure.elements()public String toString()
toString in class Object
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||