HTTPClient
Class LinkedList

java.lang.Object
  extended byHTTPClient.LinkedList

class LinkedList
extends Object

This class implements a singly linked list.


Constructor Summary
(package private) LinkedList()
           
 
Method Summary
 void addToEnd(Object elem)
          Add the specified element to the end of the list.
 void addToHead(Object elem)
          Add the specified element to the head of the list.
 Object enumerate()
          Starts an enumeration of all the elements in this list.
 Object getFirst()
          Return the first element in the list.
static void main(String[] args)
           
 Object next()
          Gets the next element in the enumeration.
 void remove(Object elem)
          Remove the specified element from the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinkedList

LinkedList()
Method Detail

addToHead

public void addToHead(Object elem)
Add the specified element to the head of the list.

Parameters:
elem - the object to add to the list.

addToEnd

public void addToEnd(Object elem)
Add the specified element to the end of the list.

Parameters:
elem - the object to add to the list.

remove

public void remove(Object elem)
Remove the specified element from the list. Does nothing if the element is not in the list.

Parameters:
elem - the object to remove from the list.

getFirst

public Object getFirst()
Return the first element in the list. The list is not modified in any way.

Returns:
the first element

enumerate

public Object enumerate()
Starts an enumeration of all the elements in this list. Note that only one enumeration can be active at any time.

Returns:
the first element, or null if the list is empty

next

public Object next()
Gets the next element in the enumeration. The enumeration must have been first initalized with a call to enumerate().

Returns:
the next element, or null if none left
See Also:
enumerate()

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception