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