Iterator implementation which attempts to move through the 2D structure
attempting to skip onto the next sequence as & when it is asked to
966508
@Override
	public Iterator<C> iterator() {
		final List<Sequence<C>> localSequences = sequences;
		return new Iterator<C>() {

			private Iterator<C> currentSequenceIterator = null;
			private int currentPosition = 0;


			@Override
			public boolean hasNext() {
				//If the current iterator is null then see if the Sequences object has anything
				if (currentSequenceIterator == null) {
					return !localSequences.isEmpty();
				}

				//See if we had any compounds
				boolean hasNext = currentSequenceIterator.hasNext();
				if (!hasNext) {
					hasNext = currentPosition < sequences.size();
				}
				return hasNext;
			}


			@Override
			public C next() {
				if (currentSequenceIterator == null) {
					if (localSequences.isEmpty()) {
						throw new NoSuchElementException("No sequences to iterate over; make sure you call hasNext() before next()");
					}
					currentSequenceIterator = localSequences.get(currentPosition).iterator();
					currentPosition++;
				}
				if (!currentSequenceIterator.hasNext()) {
					currentSequenceIterator = localSequences.get(currentPosition).iterator();
					currentPosition++;
				}
				return currentSequenceIterator.next();
			}


			@Override
			public void remove() throws UnsupportedOperationException {
				throw new UnsupportedOperationException("Cannot remove from this Sequence");
			}
		};
	}
1220346
@Override
  public Iterator<Row> iterator()
  {
    return new MovingAverageIterator(seq, dims, factories, emptyEvents, aggMap);
  }
250057
function iterateElements(array) {
  return {
    __iterator__: function() {
      var index = 0;
      var current;
      return {
        get current() {
          return current;
        },
        moveNext: function() {
          if (index < array.length) {
            current = array[index++];
            return true;
          }
          return false;
        }
      };
    }
  };
}
136553
protected function _next()
    {
        try {
            $this->_setIteration($this->_loop());
        } catch (RootException $exception) {
            $this->_throwIteratorException(
                $this->__('An error occurred while iterating'),
                null,
                $exception
            );
        }
    }
964361
def Skip(self: Iterable, n):
    
    con = iter(self)
    for i, _ in enumerate(con):
        if i == n:
            break
    return con
727587
def next(self):
    ''''''

    # if iteration has not begun, begin it.
    if not self._iterator:
      self.__iter__()

    next = self._iterator.next()
    if next is not StopIteration:
      self._returned_inc(next)
    return next
790620
function(v, i) {
      if (v === undefined || v === null) return;
      failed += !iterator.call(context, v, type, level, i);
    }
956991
private int next() throws IOException, UnterminatedCommentException {
		int c = get();
		if (c == '/') {
			switch (peek()) {
			case '/':
				for (;;) {
					c = get();
					if (c <= '\n') {
						break;
					}
				}
				break;
			case '*':
				get();
				while (c != ' ') {
					switch (get()) {
					case '*':
						if (peek() == '/') {
							get();
							c = ' ';
						}
						break;
					case EOF:
						throw new UnterminatedCommentException(currentByteIndex, line, column);
					}
				}
				break;
			}
		}
		theY = theX;
		theX = c;
		return c;
	}
321942
function ReferenceIterator(iterable) {
            _classCallCheck(this, ReferenceIterator);

            this.iterator = null;
            var artifacts = new IterationArtifacts(iterable);
            this.artifacts = artifacts;
        }
901949
def peek(self, steps=1):
        """"""
        try:
            tokens = iter(self)
            for _ in six.moves.range(steps):
                next(tokens)

            return next(tokens)
        except StopIteration:
            return None
667521
function iterator(iterId, conn) {
      var nextElems = [];
      var done = false;

      function nextPromise() {
        var kv = nextElems.pop();
        return new Promise(function (fulfill, reject) {
          fulfill(f.merge({done: done}, kv));
        });
      }

      function donePromise() {
        return new Promise(function (fulfill, reject) {
          fulfill({done: done});
        });
      }

      return {
        /**
         * Iterator next object returned from completed Iterator.next() calls.
         *
         * @typedef {Object} IteratorNext
         * @property {?(String|Object)} key -
         * If iteration not done, entry's key, otherwise undefined.
         * @property {?(String|Object)} value -
         * If iteration not done, entry's value, otherwise undefined.
         * @property {Boolean} done -
         * Indicates whether iteration has been completed.
         * When true, key and value will be undefined.
         * When false, key and value will be non-null.
         * @since 0.3
         */
        /**
         * Returns the next entry being iterated over.
         *
         * @returns {module:promise.Promise.<IteratorNext>}
         * It returns a Promise which will be completed with an instance that
         * provides the next element.
         * @memberof Iterator#
         * @since 0.3
         */
        next: function() {
          if (done) {
            logger.tracef('Iterator(iteratorId=%s) already exhausted', iterId);
            return donePromise();
          } else if (_.isEmpty(nextElems)) {
            var ctx = u.context(SMALL);
            logger.tracef(
                'Invoke iterator.next(msgId=%d,iteratorId=%s) on %s'
                , ctx.id, iterId, conn.toString()
            );
            var remote = futurePinned(ctx, 0x33, p.encodeIterId(iterId), p.decodeNextEntries(), conn);
            return remote.then(function(entries) {
              if (_.isEmpty(entries)) {
                done = true;
                return donePromise();
              } else {
                _.each(entries, function(entry) {
                  nextElems.push(entry);
                });
                return nextPromise();
              }
            });
          }
          logger.tracef('Return next from locally cached entries for iterator(iteratorId=%s)', iterId);
          return nextPromise();
        },
        /**
         * Close the iteration.
         *
         * @returns {module:promise.Promise}
         * A Promise which will be completed once the iteration has been closed.
         * @memberof Iterator#
         * @since 0.3
         */
        close: function() {
          var ctx = u.context(SMALL);
          logger.debugf('Invoke iterator.close(msgId=%d,iteratorId=%s) on %s', ctx.id, iterId, conn.toString());
          return futurePinned(
              ctx, 0x35, p.encodeIterId(iterId), p.complete(p.hasSuccess), conn);
        }
      }
    }
353002
protected void skipLinesAlreadyRead(Iterator it) {
        long linesRead = getItemsRead();
        if (linesRead > 0) {
            for (long i = 0; i < linesRead; i++) {
                if (it.hasNext()) {
                    it.next();
                }
            }
        }
    }
233814
private void moveToNext(final int i) {
    final int next = iterators.length + i;
    timestamps[i] = timestamps[next];
    values[i] = values[next];
    //LOG.debug("Moving #" + next + " -> #" + i
    //          + ((timestamps[i] & FLAG_FLOAT) == FLAG_FLOAT
    //             ? " float " + Double.longBitsToDouble(values[i])
    //             : " long " + values[i])
    //          + " @ time " + (timestamps[i] & TIME_MASK));
    final SeekableView it = iterators[i];
    if (it.hasNext()) {
      putDataPoint(next, it.next());
    } else {
      endReached(i);
    }
  }
355854
public void calcOccurrences() {
        State state;
        Iterator iter;
        boolean changes;

        iter = states.iterator();
        while (iter.hasNext()) {
            state = (State) iter.next();
            state.minOcc = 1;
            state.maxOcc = 1;
        }
        do {
            // TODO: iterating in reverse order might be faster
            changes = false;
            iter = states.iterator();
            while (iter.hasNext()) {
                state = (State) iter.next();
                if (state.recalcOccurrence(this)) {
                    changes = true;
                }
            }
        } while (changes);
    }
1281303
function iteratorFor(items) {
  const iterator = {
    next() {
      const value = items.shift();
      return {
        done: value === undefined,
        value
      };
    }
  };

  if (isSupportIterable) {
    iterator[Symbol.iterator] = () => iterator;
  }

  return iterator;
}
879714
function Iterator() {
    var items = Array.prototype.slice.call(arguments, 0);

    this.items = (items.length == 1 && Array.isArray(items[0])) ? items[0] : items;
    this.reset();
}
1239161
function iterator ()
            {
                for (var i=0; i<obj.data.length; ++i) {
                    
                    // This produces a very slight easing effect
                    obj.data[i] = data[i] * RG.Effects.getEasingMultiplier(frames, numFrame);
                }
                
                RGraph.clear(obj.canvas);
                RGraph.redrawCanvas(obj.canvas);
    
                if (++numFrame < frames) {
                    RGraph.Effects.updateCanvas(iterator);
                } else {
                    callback(obj);
                }
            }