Returns an iterator over all the contained {@link Counter} instances for all groups.
Note that the {@code remove()} operation <emphasis>is not supported</emphasis> in the returned
{@code Iterator}.
@return
342636
@Override
  public Iterator<Counter> iterator() {
    return new Iterator<Counter>() {
      private Iterator<Map.Entry<String,Map<String,Counter>>> groupIter =
          internalMap.entrySet().iterator();
      private Iterator<Map.Entry<String,Counter>> currentGroupIter = null;

      @Override
      public boolean hasNext() {
        // advance current group if necessary
        if ((currentGroupIter == null || !currentGroupIter.hasNext()) && groupIter.hasNext()) {
          currentGroupIter = groupIter.next().getValue().entrySet().iterator();
        }
        return currentGroupIter != null && currentGroupIter.hasNext();
      }

      @Override
      public Counter next() {
        if (!hasNext()) {
          throw new NoSuchElementException("No more elements in iterator");
        }
        return currentGroupIter.next().getValue();
      }

      @Override
      public void remove() {
        throw new UnsupportedOperationException("remove() is not supported by CounterMap");
      }
    };
  }
242608
public Iterator<Row> iterator()
    {
        if (this.rows != null)
        {
            return Arrays.asList(this.rows).iterator();
        }
        else
        {
            return ConvertibleIteratorUtils.iterateAsRow(this.pbRows.iterator(), this.pbColumnDescriptions);
        }
    }
1367172
public static <E> Set<E> retainNonZeros(Counter<E> counter) {
    Set<E> removed = new HashSet<E>();
    for (E key : counter.keySet()) {
      if (counter.getCount(key) == 0.0) {
        removed.add(key);
      }
    }
    for (E key : removed) {
      counter.remove(key);
    }
    return removed;
  }
788785
public Iterator iterator()
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass,
                        "iterator");

        Iterator iterator = subList(null, null).iterator();

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass,
                       "iterator",
                       new Object[] { iterator });
        return iterator;
    }
880475
@Override
    public Iterator<T> iterator() {
        return new Iterator<T>() {
            private int cursor = 0;

            @Override
            public boolean hasNext() {
                return size == INFINITE_SIZE || cursor < size;
            }

            @Override
            public T next() {
                if (!hasNext()) {
                    throw new NoSuchElementException();
                }
                cursor++;
                return generator.next();
            }

            @Override
            public void remove() {
                throw new UnsupportedOperationException("remove() operation is not supported");
            }
        };
    }
312629
public Iterator<Long> iterator() {
    final LongIterator it = getLongIterator();

    return new Iterator<Long>() {

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

      @Override
      public Long next() {
        return it.next();
      }

      @Override
      public void remove() {
        // TODO?
        throw new UnsupportedOperationException();
      }
    };
  }
468142
public T max() {
        TObjectIntIterator<T> iter = counts.iterator();
        int maxCount = -1;
        T max = null;
        while (iter.hasNext()) {
            iter.advance();
            int count = iter.value();
            if (count > maxCount) {
                max = iter.key();
                maxCount = count;
            }
        }
        return max;
    }
492374
@SuppressWarnings("NullableProblems")
  @Override
  public Iterator<T> iterator() {
    return new Iterator<T>() {
      private int index = 0;

      @Override
      public boolean hasNext() {
        return this.index < size();
      }

      @Override
      public T next() {
        if (this.index >= size()) {
          throw new NoSuchElementException(this.index + ">=" + size());
        }
        return getElementAt(this.index++);
      }

      @Override
      public void remove() {
        throw new UnsupportedOperationException("Removing is unsupported here");
      }

    };
  }
639770
public Iterator iterator() {
        return new Iterator() {
            private ObjectSinkNode currentNode = null;
            private ObjectSinkNode nextNode    = getFirst();

            public boolean hasNext() {
                return (this.nextNode != null);
            }

            public Object next() {
                this.currentNode = this.nextNode;
                if ( this.currentNode != null ) {
                    this.nextNode = this.currentNode.getNextObjectSinkNode();
                } else {
                    throw new NoSuchElementException( "No more elements to return" );
                }
                return this.currentNode;
            }

            public void remove() {
                if ( this.currentNode != null ) {
                    ObjectSinkNodeList.this.remove( this.currentNode );
                    this.currentNode = null;
                } else {
                    throw new IllegalStateException( "No item to remove. Call next() before calling remove()." );
                }
            }
        };
    }
486782
@Override
    public Iterator<String> iterator() {
        this.reset();
        Iterator<String> ret = new Iterator<String>() {
            @Override
            public boolean hasNext() {
                return BasicLineIterator.this.hasNext();
            }

            @Override
            public String next() {
                return BasicLineIterator.this.nextSentence();
            }

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

        return ret;
    }
468249
@Override
    public Iterator<T> iterator()
    {
        writeLock.lock();
        if (iterator == null)
        {
            iterator = new Iter();
        }
        else
        {
            iterator.reset();
        }
        return iterator;
    }
1109101
public Iterator<E> iterator() {
        final Iterator<? extends E> itr = core.iterator();
        return new Iterator<E>() {
            private E last;
            public boolean hasNext() {
                return itr.hasNext();
            }

            public E next() {
                return last=itr.next();
            }

            public void remove() {
                CopyOnWriteList.this.remove(last);
            }
        };
    }
32696
@Override
	@SuppressWarnings("unchecked")
	public Iterator<V> iterator() {
		CacheObjIterator<K, V> copiedIterator = (CacheObjIterator<K, V>) this.cacheObjIterator();
		return new CacheValuesIterator<V>(copiedIterator);
	}
1286949
public Iterator<String> list() {
        try {
            final Enumeration<String> keys = pathRegistry.keys();
            return new Iterator<String>() {
                public boolean hasNext() { return keys.hasMoreElements(); }
                public String next() { return keys.nextElement(); }
                public void remove() { throw new UnsupportedOperationException(); }
            };
        } catch (LowlevelStorageException e) {
            throw new FaultException(e);
        }
    }
487691
@Override
  public Iterator<Zone> iterator() {
    final Iterator<String> delegate = api.getZonesOfAccount(account.get()).iterator();
    return new Iterator<Zone>() {
      @Override
      public boolean hasNext() {
        return delegate.hasNext();
      }

      @Override
      public Zone next() {
        return fromSOA(delegate.next());
      }

      @Override
      public void remove() {
        throw new UnsupportedOperationException();
      }
    };
  }
175855
private Iterator<String> getIterator() {
		final Set<String> copy = getPrefixes();
		final Iterator<String> copyIt = copy.iterator();
		return new Iterator<String>() {
			private String lastOne = null;

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

			@Override
			public String next() {
				if (copyIt.hasNext()) {
					lastOne = copyIt.next();
				} else {
					throw new NoSuchElementException();
				}
				return lastOne;
			}

			@Override
			public void remove() {
				try {
					lock.writeLock().lock();
					prefixes.remove(lastOne);
				} finally {
					lock.writeLock().unlock();
				}
			}

		};
	}
544086
public Iterable<Integer> index() {
        return () -> new Iterator<Integer>() {
            private final Iterator<Integer> it = data.records.keySet().iterator();

            /** {@inheritDoc} */
            @Override
            public boolean hasNext() {
                return it.hasNext();
            }

            /** {@inheritDoc} */
            @Override
            public Integer next() {
                return it.next();
            }

            /** {@inheritDoc} */
            @Override
            public void remove() {
                throw new UnsupportedOperationException("This is a read-only iterator, remove operation is not supported.");
            }
        };
    }