org.rapla.components.util
Class WeakReferenceList

java.lang.Object
  extended by org.rapla.components.util.WeakReferenceList

public class WeakReferenceList
extends Object

This list internaly uses WeakReferences that doesnt prevent the list-entrys from being garbage-collected. Use this list if you cannot determine when the objects in the list are no longer in use and should be taken out of the list.
Parts taken from QueuedWRVectorModel.java written by Raimond Reichert for JavaWorld

Author:
Christopher Kohlhaas

Constructor Summary
WeakReferenceList()
           
 
Method Summary
 void add(Object o)
          add an object to the list.
 void cleanUp()
          Polls the reference queue, and removes all references on it from the list
 Iterator iterator()
          Use this Iterator to safely iterate the list.
 void remove(Object o)
          remove an Object from list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WeakReferenceList

public WeakReferenceList()
Method Detail

cleanUp

public void cleanUp()
Polls the reference queue, and removes all references on it from the list


add

public void add(Object o)
add an object to the list. Note, that adding an object to this list, will not add an additional reference to the object. So adding an Object to this list does not prevent it from beeing garbage-collected. If the object is garbage-collected it will be removed from the list upon the next call of cleanUp(),add(),remove() or iterator()


remove

public void remove(Object o)
remove an Object from list. Note: Objects will be automatically be removed if they are garbage-collected. If you are able to call the remove method for every-object, you will not need this Class.


iterator

public Iterator iterator()
Use this Iterator to safely iterate the list. All references to garbage-collected-objects will be skipped.



Copyright © 2000-2006 Rapla Team. All Rights Reseserved.