Object removed = null;
for( Iterator iter = controlledObjects.iterator(); iter.hasNext(); ) {
WeakReference ref = (WeakReference) iter.next();
Authorizable controlledObject = (Authorizable) ref.get();
if( controlledObject == null ) {
// Has been GCed, remove from our list
iter.remove();
} else if( controlledObject.equals( object ) ) {
removed = controlledObject;
iter.remove();
}
}
return removed;