|
© 1998-2002 McGraw-Hill | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--structure.AbstractStructure | +--structure.AbstractList
An abstract structure implementing features common to all list-like structures in this package.
Lists are typically used to store data of unknown or varying length. The structure package provides several extensions of the AbstractList class, each of which has its particular strengths and weaknesses.
Example usage: To place a copy of every unique parameter passed to a program into a List, we could use the following:
public static void main(String[]
arguments) {AbstractList
argList = newSinglyLinkedList()
; for (int i = 0; i < arguments.length; i++){ if (!argList.contains(arguments[i])
){ argList.add(arguments[i])
; } } System.out.println(argList); }
DoublyLinkedList
,
CircularList
,
SinglyLinkedList
Constructor Summary | |
AbstractList()
Default constructor for AbstractLists |
Method Summary | |
void |
add(Object value)
Add an object to tail of list. |
void |
addFirst(Object value)
Add a value to head of list. |
void |
addLast(Object value)
Add a value to tail of list. |
boolean |
contains(Object value)
Check to see if a value is in list. |
Object |
get()
Retrieves value from tail of list. |
Object |
getFirst()
Fetch first element of list. |
Object |
getLast()
Fetch last element of list. |
boolean |
isEmpty()
Determine if list is empty. |
Object |
remove()
Removes value from tail of list. |
Object |
removeFirst()
Remove a value from first element of list. |
Object |
removeLast()
Remove last value from list. |
Methods inherited from class structure.AbstractStructure |
elements, hashCode, values |
Methods inherited from class java.lang.Object |
|
Methods inherited from interface structure.List |
add, clear, get, indexOf, iterator, lastIndexOf, remove, remove, set, size |
Methods inherited from interface structure.Structure |
elements, values |
Constructor Detail |
public AbstractList()
Method Detail |
public boolean isEmpty()
isEmpty
in interface List
isEmpty
in class AbstractStructure
public void addFirst(Object value)
addFirst
in interface List
value
- The value to be added to head of list.public void addLast(Object value)
addLast
in interface List
value
- The value to be added to tail of list.public Object getFirst()
getFirst
in interface List
public Object getLast()
getLast
in interface List
public Object removeFirst()
removeFirst
in interface List
public Object removeLast()
removeLast
in interface List
public void add(Object value)
add
in interface List
value
- The value to be added to tail of list.addLast(java.lang.Object)
public Object remove()
remove
in interface List
public Object get()
get
in interface List
public boolean contains(Object value)
contains
in interface List
contains
in class AbstractStructure
value
- value sought.
|
© 1998-2002 McGraw-Hill | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |