private static <T>void gcDeadReferences(Iterable<WeakReference<T>> references){
  for (Iterator<WeakReference<T>> iterator=references.iterator(); iterator.hasNext(); ) {
    WeakReference reference=iterator.next();
    if (reference.get() == null || reference.isEnqueued()) {
      iterator.remove();
    }
  }
}

private static < T > void gcDeadReferences ( Iterable < WeakReference < T > > references ) { for ( Iterator < WeakReference < T > > iterator = references . iterator ( ) ; iterator . hasNext ( ) ; ) { WeakReference reference = iterator . next ( ) ; if ( reference . get ( ) == null || reference . isEnqueued ( ) ) { iterator . remove ( ) ; } } }
removes from a list of weak references those that have been garbage collected or are enqueued .
