com.generationjava.collections
Class LimitedList

java.lang.Object
  extended bycom.generationjava.collections.ProxyList
      extended bycom.generationjava.collections.LimitedList
All Implemented Interfaces:
Collection, List
Direct Known Subclasses:
SortedLimitedList

public class LimitedList
extends ProxyList

Only allows N elements in. Once size N is reached, all new adds are ignored and inserts mean the one on the end of the list is removed.


Constructor Summary
LimitedList(int capacity)
           
LimitedList(List list, int capacity)
           
 
Method Summary
 void add(int i, Object obj)
           
 boolean add(Object obj)
           
 boolean addAll(Collection coll)
           
 boolean addAll(int i, Collection coll)
           
 boolean isFull()
           
 boolean retainAll(Collection coll)
           
 String toString()
           
 
Methods inherited from class com.generationjava.collections.ProxyList
clear, contains, containsAll, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, set, size, subList, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
equals, hashCode
 

Constructor Detail

LimitedList

public LimitedList(int capacity)

LimitedList

public LimitedList(List list,
                   int capacity)
Method Detail

isFull

public boolean isFull()

add

public boolean add(Object obj)
Specified by:
add in interface List
Overrides:
add in class ProxyList

addAll

public boolean addAll(Collection coll)
Specified by:
addAll in interface List
Overrides:
addAll in class ProxyList

addAll

public boolean addAll(int i,
                      Collection coll)
Specified by:
addAll in interface List
Overrides:
addAll in class ProxyList

retainAll

public boolean retainAll(Collection coll)
Specified by:
retainAll in interface List
Overrides:
retainAll in class ProxyList

add

public void add(int i,
                Object obj)
Specified by:
add in interface List
Overrides:
add in class ProxyList

toString

public String toString()
Overrides:
toString in class ProxyList


Copyright © 2000-2005 OSJava. All Rights Reserved.