public synchronized void addProgress(Progress p){
  Iterator<WeakReference<Progress>> iter=progresses.iterator();
  while (iter.hasNext()) {
    WeakReference<Progress> ref=iter.next();
    if (ref.get() == null) {
      iter.remove();
    }
 else {
      if (ref.get() == p) {
        return;
      }
    }
  }
  progresses.add(new WeakReference<>(p));
}

public synchronized void addProgress ( Progress p ) { Iterator < WeakReference < Progress > > iter = progresses . iterator ( ) ; while ( iter . hasNext ( ) ) { WeakReference < Progress > ref = iter . next ( ) ; if ( ref . get ( ) == null ) { iter . remove ( ) ; } else { if ( ref . get ( ) == p ) { return ; } } } progresses . add ( new WeakReference < > ( p ) ) ; }
add a new progress to the tracker .
