public Task<R> latestFinishedTask(){
  if (!tasks.isEmpty()) {
    Collections.sort(tasks,new LatestFinishedTaskComparator());
    Task<R> latestTask=tasks.get(0);
    if (latestTask.getEndTime() != null) {
      return latestTask;
    }
  }
  return null;
}

public Task < R > latestFinishedTask ( ) { if ( ! tasks . isEmpty ( ) ) { Collections . sort ( tasks , new LatestFinishedTaskComparator ( ) ) ; Task < R > latestTask = tasks . get ( 0 ) ; if ( latestTask . getEndTime ( ) != null ) { return latestTask ; } } return null ; }
retrieves the latest task in the list that has finished processing .
