com.mongodb.util
Class WeakBag<T>

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

public class WeakBag<T>
extends java.lang.Object
implements java.lang.Iterable<T>

if its not obvious what a weak bag should do, then, well... very very not thead 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)
           
 java.util.List<T> getAll()
           
 java.util.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 java.util.Iterator<T> iterator()
Specified by:
iterator in interface java.lang.Iterable<T>

getAll

public java.util.List<T> getAll()