wyvern.util
Class FixedSizeList

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.AbstractSequentialList
              extended byjava.util.LinkedList
                  extended bywyvern.util.FixedSizeList
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, java.io.Serializable

public class FixedSizeList
extends java.util.LinkedList

A linked list that will store no more than N elements. When it reaches size N, it will remove the last element each time a new element is added to the front.

Version:
1.0, May 11, 2003
Author:
Steve Yegge
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
FixedSizeList(int size)
          Constructs a new FixedSizeList
 
Method Summary
 boolean add(java.lang.Object obj)
          Adds something to the front of the list.
 void addFirst(java.lang.Object obj)
          Adds an item to the front of the list.
 java.lang.String toString()
          Prints out the list, in order.
 
Methods inherited from class java.util.LinkedList
add, addAll, addAll, addLast, clear, clone, contains, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, remove, remove, removeFirst, removeLast, set, size, toArray, toArray
 
Methods inherited from class java.util.AbstractSequentialList
iterator
 
Methods inherited from class java.util.AbstractList
equals, hashCode, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

FixedSizeList

public FixedSizeList(int size)
Constructs a new FixedSizeList

Parameters:
size - the maximum length you want the list to grow
Method Detail

addFirst

public void addFirst(java.lang.Object obj)
Adds an item to the front of the list.


add

public boolean add(java.lang.Object obj)
Adds something to the front of the list. Different from superclass version of add.

Parameters:
obj - the object to put at the front
Returns:
true

toString

public java.lang.String toString()
Prints out the list, in order.