Returns an iterator over elements that are left in this stream.

@return an iterator of the remaining elements in this stream
169976
@Override
    public Iterator<E> iterator() {
        return new Iterator<E>() {

            /**
             * The index to indicate the current position
             * of this iterator.
             *
             * The starting point is set to the current
             * value of this stream's offset, so that it
             * doesn't iterate over consumed elements.
             */
            private int index = offset;

            /**
             * {@inheritDoc}
             */
            @Override
            public boolean hasNext() {
                return index < elements.length;
            }

            /**
             * {@inheritDoc}
             */
            @Override
            public E next() {
                if (index >= elements.length) {
                    throw new NoSuchElementException();
                }
                return elements[index++];
            }

            /**
             * {@inheritDoc}
             */
            @Override
            public void remove() {
                throw new UnsupportedOperationException();
            }
        };
    }
1204521
public Iterator<String> iterator() throws IOException
  {
    String list[] = list();

    // Avoids NPE when subclasses override list() and
    // possibly return null, e.g. JarPath.
    if (list == null)
      list = new String[0];

    return new ArrayIterator(list);
  }
1332830
@Override
    public Iterator<Object> iterator() {
        return new Iterator<Object>() {
            Iterator<Object> iter = list.listIterator();

            @Override
            public boolean hasNext() {
                return iter.hasNext();
            }

            @Override
            public Object next() {
                return iter.next();
            }

            @Override
            public void remove() {
                iter.remove();
            }
        };
    }
673104
public Iterator iterator()
        {
        CsvPreference preferences =
                new CsvPreference.Builder(m_quoteChar, m_delimiterChar, m_endOfLineSymbols).build();
        return new CsvIterator(new CsvListReader(m_reader, preferences), m_header);
        }
512678
public Iterator iterator() {
        return new Iterator() {
            public boolean hasNext() {
                return false;
            }

            public Object next() {
                return null;
            }

            public void remove() {
                throw new UnsupportedOperationException();
            }
        };
    }
302884
public Iterator
generators() {
	if (generators != null)
		return Collections.unmodifiableList(generators).iterator();
	else
		return Collections.EMPTY_LIST.iterator();
}
1187623
public Iterator<Writable> iterator() {
    final TupleWritable t = this;
    return new Iterator<Writable>() {
      long i = written;
      long last = 0L;
      public boolean hasNext() {
        return 0L != i;
      }
      public Writable next() {
        last = Long.lowestOneBit(i);
        if (0 == last)
          throw new NoSuchElementException();
        i ^= last;
        // numberOfTrailingZeros rtn 64 if lsb set
        return t.get(Long.numberOfTrailingZeros(last) % 64);
      }
      public void remove() {
        t.written ^= last;
        if (t.has(Long.numberOfTrailingZeros(last))) {
          throw new IllegalStateException("Attempt to remove non-existent val");
        }
      }
    };
  }
1150815
public T min() {
        TObjectDoubleIterator<T> iter = counts.iterator();
        double minCount = Double.MAX_VALUE;
        T min = null;
        while (iter.hasNext()) {
            iter.advance();
            double count = iter.value();
            if (count < minCount) {
                min = iter.key();
                minCount = count;
            }
        }
        return min;
    }
1087581
@Override
  public T next() {
    Assert.isTrue(hasNext(), new NoSuchElementException("The iteration has no more elements!"));
    T nextValue = iteratorList.get(currentIteratorIndex).next();
    currentIteratorIndex = (++currentIteratorIndex % iteratorList.size());
    nextCalled.set(true);
    return nextValue;
  }
1148262
@Override
    public VectorIterator iterator() {
        return new VectorIterator(length) {
            private int i = -1;

            @Override
            public int index() {
                return i;
            }

            @Override
            public double get() {
                return Vector.this.get(i);
            }

            @Override
            public void set(double value) {
                Vector.this.set(i, value);
            }

            @Override
            public boolean hasNext() {
                return i + 1 < length;
            }

            @Override
            public Double next() {
                if(!hasNext()) {
                    throw new NoSuchElementException();
                }
                i++;
                return get();
            }
        };
    }
1335647
public Object getNextElement() {
        Object element = null;
        while (currentIndex+1 < endIndex && element == null) {
            currentIndex++;
            element = getElement();
        }
        return element;      
    }
1297610
public A next() {
        A x = elems.head;
        if (!elems.isEmpty()) {
            elems = elems.tail;
            if (elems.isEmpty()) last = null;
            count--;
        }
        return x;
    }
698739
@Override
    public Iterator<int[]> iterator() {
        final DfState lstate = new DfState(this);
        return new Iterator<int[]>() {
            boolean hasNext;

            @Override
            public boolean hasNext() {
                return hasNext || (hasNext = lstate.matchNext());
            }

            @Override
            public int[] next() {
                if (!hasNext())
                    return new int[0];
                hasNext = false;
                return lstate.amap;
            }

            @Override
            public void remove() {
                throw new IllegalArgumentException();
            }
        };
    }
1199651
public Stream<List<String>> stream() {
      return Streams.asStream(new RowIterator()).onClose(Unchecked.runnable(this::close));
   }
456751
private Iterator<ConcurrentServiceReferenceElement<T>> elements() {
        Collection<ConcurrentServiceReferenceElement<T>> set;
        synchronized (elementMap) {
            if (elementSetUnsorted) {
                elementSet = new ConcurrentSkipListSet<ConcurrentServiceReferenceElement<T>>(elementMap.values());
                elementSetUnsorted = false;
            }
            set = elementSet;
        }

        return set.iterator();
    }
403956
public Iterator<SourceUnit> iterator() {
        return new Iterator<SourceUnit>() {
            Iterator<String> nameIterator = names.iterator();

            public boolean hasNext() {
                return nameIterator.hasNext();
            }

            public SourceUnit next() {
                String name = nameIterator.next();
                return sources.get(name);
            }

            public void remove() {
                throw new UnsupportedOperationException();
            }
        };
    }
577346
@Nonnull
    public Iterator<Long> iterator() {
        return new Iterator<Long>() {
            private long base2 = base;
            private int remaining = batchSize;

            @Override
            public boolean hasNext() {
                return remaining > 0;
            }

            @Override
            public Long next() {
                if (remaining == 0) {
                    throw new NoSuchElementException();
                }
                remaining--;
                try {
                    return base2;
                } finally {
                    base2 += increment;
                }
            }

            @Override
            public void remove() {
                throw new UnsupportedOperationException();
            }
        };
    }