Openfire 3.9.3 Javadoc

org.jivesoftware.util
Class LinkedList<E>

java.lang.Object
  extended by org.jivesoftware.util.LinkedList<E>
Type Parameters:
E -

public class LinkedList<E>
extends Object

Simple LinkedList implementation. The main feature is that list nodes are public, which allows very fast delete operations when one has a reference to the node that is to be deleted.

Author:
Jive Software

Constructor Summary
LinkedList()
          Creates a new linked list.
 
Method Summary
 LinkedListNode<E> addFirst(E object)
          Adds an object to the beginning of the list by automatically creating a a new node and adding it to the beginning of the list.
 LinkedListNode<E> addFirst(LinkedListNode<E> node)
          Adds a node to the beginning of the list.
 LinkedListNode<E> addLast(E object)
          Adds an object to the end of the list by automatically creating a a new node and adding it to the end of the list.
 LinkedListNode<E> addLast(LinkedListNode<E> node)
          Adds a node to the end of the list.
 void clear()
          Erases all elements in the list and re-initializes it.
 LinkedListNode<E> getFirst()
          Returns the first linked list node in the list.
 LinkedListNode<E> getLast()
          Returns the last linked list node in the list.
 String toString()
          Returns a String representation of the linked list with a comma delimited list of all the elements in the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LinkedList

public LinkedList()
Creates a new linked list.

Method Detail

getFirst

public LinkedListNode<E> getFirst()
Returns the first linked list node in the list.

Returns:
the first element of the list.

getLast

public LinkedListNode<E> getLast()
Returns the last linked list node in the list.

Returns:
the last element of the list.

addFirst

public LinkedListNode<E> addFirst(LinkedListNode<E> node)
Adds a node to the beginning of the list.

Parameters:
node - the node to add to the beginning of the list.

addFirst

public LinkedListNode<E> addFirst(E object)
Adds an object to the beginning of the list by automatically creating a a new node and adding it to the beginning of the list.

Parameters:
object - the object to add to the beginning of the list.
Returns:
the node created to wrap the object.

addLast

public LinkedListNode<E> addLast(LinkedListNode<E> node)
Adds a node to the end of the list.

Parameters:
node - the node to add to the beginning of the list.

addLast

public LinkedListNode<E> addLast(E object)
Adds an object to the end of the list by automatically creating a a new node and adding it to the end of the list.

Parameters:
object - the object to add to the end of the list.
Returns:
the node created to wrap the object.

clear

public void clear()
Erases all elements in the list and re-initializes it.


toString

public String toString()
Returns a String representation of the linked list with a comma delimited list of all the elements in the list.

Overrides:
toString in class Object
Returns:
a String representation of the LinkedList.

Openfire 3.9.3 Javadoc

Copyright © 2003-2008 Jive Software.