org.apache.jcs.utils.struct
Class SingleLinkedList<T>

java.lang.Object
  extended by org.apache.jcs.utils.struct.SingleLinkedList<T>

public class SingleLinkedList<T>
extends Object

This is an basic thread safe single linked list. It provides very limited functionality. It is small and fast.

Author:
Aaron Smuts

Nested Class Summary
protected static class SingleLinkedList.Node<T>
          The list is composed of nodes.
 
Constructor Summary
SingleLinkedList()
           
 
Method Summary
 void addLast(T payload)
          Adds an item to the end of the list.
 void clear()
          Removes everything.
 int size()
          Returns the number of elements in the list.
 T takeFirst()
          Takes the first item off the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleLinkedList

public SingleLinkedList()
Method Detail

takeFirst

public T takeFirst()
Takes the first item off the list.

Returns:
null if the list is empty.

addLast

public void addLast(T payload)
Adds an item to the end of the list.

Parameters:
payload -

clear

public void clear()
Removes everything.


size

public int size()
Returns the number of elements in the list.

Returns:
number of items in the list.


Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.