code: @Override
      public boolean hasNext() {
          if (iterationsCounter.get() >= totalIterations)
              return false;
  
          if (newEpoch) {
              log.info("Epoch " + epochs + ", number of batches completed " + lastBatch);
              newEpoch = false;
          }
          if (iter == null)
              return (epochs < numEpochs) && ((!batchedDS.isEmpty() && batchedDS.size() > batch) || batchedDS.isEmpty());
          else
              // either there are still epochs to complete or its the first epoch
              return (epochs < numEpochs) || (iter.hasNext() && (epochs == 0 || epochs == numEpochs));
      }
docs: Returns {@code true} if the iteration has more elements.
  (In other words, returns {@code true} if {@link #next} would
  return an element rather than throwing an exception.)
  
  @return {@code true} if the iteration has more elements