Class BoundedList<T>

All Implemented Interfaces:
Serializable, Iterable<T>, Collection<T>, Queue<T>

public class BoundedList<T> extends ConcurrentLinkedQueue<T>
A bounded subclass of LinkedList, oldest elements are removed once max capacity is exceeded. Note that this class is not synchronized (like LinkedList).
Version:
$Id: BoundedList.java,v 1.5 2007/08/08 12:02:05 belaban Exp $
Author:
Bela Ban Nov 20, 2003
See Also:
  • Constructor Details

    • BoundedList

      public BoundedList()
    • BoundedList

      public BoundedList(int size)
  • Method Details

    • add

      public boolean add(T obj)
      Adds an element at the tail. Removes an object from the head if capacity is exceeded
      Specified by:
      add in interface Collection<T>
      Specified by:
      add in interface Queue<T>
      Overrides:
      add in class ConcurrentLinkedQueue<T>
      Parameters:
      obj - The object to be added
    • removeFromHead

      public T removeFromHead()