public boolean hasActiveTasks(){
  boolean doesHaveTasks=false;
synchronized (asyncTasks) {
    if (asyncTasks.isEmpty())     return false;
    Iterator<RunnableScheduledFuture<?>> i=asyncTasks.iterator();
    while (i.hasNext()) {
      RunnableScheduledFuture<?> task=i.next();
      if (task.isDone())       i.remove();
 else       doesHaveTasks=true;
    }
  }
  return doesHaveTasks;
}

public boolean hasActiveTasks ( ) { boolean doesHaveTasks = false ; synchronized ( asyncTasks ) { if ( asyncTasks . isEmpty ( ) ) return false ; Iterator < RunnableScheduledFuture < ? > > i = asyncTasks . iterator ( ) ; while ( i . hasNext ( ) ) { RunnableScheduledFuture < ? > task = i . next ( ) ; if ( task . isDone ( ) ) i . remove ( ) ; else doesHaveTasks = true ; } } return doesHaveTasks ; }
determines whether there are tasks which have started and not completed . as a side effect , this method removes all tasks which are done but are still in the tracking list .
