|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object structure.AbstractStructure<ELTTYPE> structure.AbstractList<ELTTYPE>
public abstract class AbstractList<ELTTYPE>
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(ELTTYPE value)
Add an object to tail of list. |
void |
addFirst(ELTTYPE value)
Add a value to head of list. |
void |
addLast(ELTTYPE value)
Add a value to tail of list. |
boolean |
contains(ELTTYPE value)
Check to see if a value is in list. |
ELTTYPE |
get()
Retrieves value from tail of list. |
ELTTYPE |
getFirst()
Fetch first element of list. |
ELTTYPE |
getLast()
Fetch last element of list. |
boolean |
isEmpty()
Determine if list is empty. |
ELTTYPE |
remove()
Removes value from tail of list. |
ELTTYPE |
removeFirst()
Remove a value from first element of list. |
ELTTYPE |
removeLast()
Remove last value from list. |
Methods inherited from class structure.AbstractStructure |
---|
elements, hashCode, values |
Methods inherited from class java.lang.Object |
---|
equals, getClass, notify, notifyAll, toString, wait, wait, wait |
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<ELTTYPE>
isEmpty
in interface Structure<ELTTYPE>
isEmpty
in class AbstractStructure<ELTTYPE>
public void addFirst(ELTTYPE value)
addFirst
in interface List<ELTTYPE>
value
- The value to be added to head of list.public void addLast(ELTTYPE value)
addLast
in interface List<ELTTYPE>
value
- The value to be added to tail of list.public ELTTYPE getFirst()
getFirst
in interface List<ELTTYPE>
public ELTTYPE getLast()
getLast
in interface List<ELTTYPE>
public ELTTYPE removeFirst()
removeFirst
in interface List<ELTTYPE>
public ELTTYPE removeLast()
removeLast
in interface List<ELTTYPE>
public void add(ELTTYPE value)
add
in interface List<ELTTYPE>
add
in interface Structure<ELTTYPE>
value
- The value to be added to tail of list.addLast(ELTTYPE)
public ELTTYPE remove()
remove
in interface List<ELTTYPE>
public ELTTYPE get()
get
in interface List<ELTTYPE>
public boolean contains(ELTTYPE value)
contains
in interface List<ELTTYPE>
contains
in interface Structure<ELTTYPE>
contains
in class AbstractStructure<ELTTYPE>
value
- value sought.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |