Esempio n. 1
0
  @Override
  protected void reduce_(K key, SuspendableIterator<Long> counters, Context context)
      throws Exception {
    long counterSum = 0;
    while (counters.hasNext()) {
      counterSum += counters.next();
    }

    emit(key, counterSum);
  }
Esempio n. 2
0
  public T next() throws SuspendExecution {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }

    counter++;
    return wrapped.next();
  }
Esempio n. 3
0
 public boolean hasNext() throws SuspendExecution {
   return counter < loopLimit && wrapped.hasNext();
 }