com.mongodb.util
Class WeakBag<T>

java.lang.Object
  extended by com.mongodb.util.WeakBag<T>
All Implemented Interfaces:
Iterable<T>

public class WeakBag<T>
extends Object
implements Iterable<T>

if its not obvious what a weak bag should do, then, well... very very not thread safe


Constructor Summary
WeakBag()
          Initializes a new weak bag.
 
Method Summary
 void add(T t)
          Adds an element to the bag.
 void clean()
          Removes any null objects from the bag.
 void clear()
          Removes all object from the bag.
 boolean contains(T t)
           
 List<T> getAll()
           
 Iterator<T> iterator()
           
 boolean remove(T t)
           
 int size()
          Returns the size of the bag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WeakBag

public WeakBag()
Initializes a new weak bag.

Method Detail

add

public void add(T t)
Adds an element to the bag.

Parameters:
t - Element to add

remove

public boolean remove(T t)

contains

public boolean contains(T t)

size

public int size()
Returns the size of the bag.

Returns:
the size of the bag

clear

public void clear()
Removes all object from the bag.


clean

public void clean()
Removes any null objects from the bag.


iterator

public Iterator<T> iterator()
Specified by:
iterator in interface Iterable<T>

getAll

public List<T> getAll()