public static <T>void removeFromWeakReferences(Iterable<WeakReference<T>> references,T object){
  for (Iterator<WeakReference<T>> iterator=references.iterator(); iterator.hasNext(); ) {
    WeakReference<T> reference=iterator.next();
    if (reference.get() == object) {
      iterator.remove();
    }
  }
}

public static < T > void removeFromWeakReferences ( Iterable < WeakReference < T > > references , T object ) { for ( Iterator < WeakReference < T > > iterator = references . iterator ( ) ; iterator . hasNext ( ) ; ) { WeakReference < T > reference = iterator . next ( ) ; if ( reference . get ( ) == object ) { iterator . remove ( ) ; } } }
removes an object from a list of objects contained in weak references .
