All Packages Class Hierarchy This Package Previous Next Index
Class DataStructures.LinkedList
java.lang.Object
|
+----DataStructures.LinkedList
- public class LinkedList
- extends Object
Linked list implementation of the list
using a header node.
Access to the list is via LinkedListItr.
- See Also:
- LinkedListItr
LinkedList()
- Construct the list
find(Object)
- Return iterator corresponding to the first node containing an item.
findPrevious(Object)
- Return iterator prior to the first node containing an item.
first()
- Return an iterator representing the first node in the list.
insert(Object, LinkedListItr)
- Insert after p.
isEmpty()
- Test if the list is logically empty.
main(String[])
-
makeEmpty()
- Make the list logically empty.
printList(LinkedList)
-
remove(Object)
- Remove the first occurrence of an item.
zeroth()
- Return an iterator representing the header node.
LinkedList
public LinkedList()
- Construct the list
isEmpty
public boolean isEmpty()
- Test if the list is logically empty.
- Returns:
- true if empty, false otherwise.
makeEmpty
public void makeEmpty()
- Make the list logically empty.
zeroth
public LinkedListItr zeroth()
- Return an iterator representing the header node.
first
public LinkedListItr first()
- Return an iterator representing the first node in the list.
This operation is valid for empty lists.
insert
public void insert(Object x,
LinkedListItr p)
- Insert after p.
- Parameters:
- x - the item to insert.
- p - the position prior to the newly inserted item.
find
public LinkedListItr find(Object x)
- Return iterator corresponding to the first node containing an item.
- Parameters:
- x - the item to search for.
- Returns:
- an iterator; iterator isPastEnd if item is not found.
findPrevious
public LinkedListItr findPrevious(Object x)
- Return iterator prior to the first node containing an item.
- Parameters:
- x - the item to search for.
- Returns:
- appropriate iterator if the item is found. Otherwise, the
iterator corresponding to the last element in the list is returned.
remove
public void remove(Object x)
- Remove the first occurrence of an item.
- Parameters:
- x - the item to remove.
printList
public static void printList(LinkedList theList)
main
public static void main(String[] args)
All Packages Class Hierarchy This Package Previous Next Index