iterate over the positions of the true values.

@return the iterator
186101
@Override
  public Iterator<Integer> iterator() {
    return new Iterator<Integer>() {
      private int hs = 0;

      private ShortIterator iter;

      private int pos = 0;

      private int x;

      @Override
      public boolean hasNext() {
        return pos < RoaringBitmap.this.highLowContainer.size();
      }

      private Iterator<Integer> init() {
        if (pos < RoaringBitmap.this.highLowContainer.size()) {
          iter = RoaringBitmap.this.highLowContainer.getContainerAtIndex(pos).getShortIterator();
          hs = RoaringBitmap.this.highLowContainer.getKeyAtIndex(pos) << 16;
        }
        return this;
      }

      @Override
      public Integer next() {
        x = iter.nextAsInt() | hs;
        if (!iter.hasNext()) {
          ++pos;
          init();
        }
        return x;
      }

      @Override
      public void remove() {
        // todo: implement
        throw new UnsupportedOperationException();
      }

    }.init();
  }
25765
public Iterator<SymbolTable> iterator()
    {
        ArrayList<SymbolTable> tables;

        synchronized (myTablesByName)
        {
            tables = new ArrayList<SymbolTable>(myTablesByName.size());

            // I don't think we can shorten the synchronization block
            // because HashMap.values() result is a live view (not a copy) and
            // thus needs to be synched too.
            Collection<TreeMap<Integer, SymbolTable>> symtabNames =
                myTablesByName.values();
            for (TreeMap<Integer,SymbolTable> versions : symtabNames)
            {
                synchronized (versions)
                {
                    tables.addAll(versions.values());
                }
            }
        }

        return tables.iterator();
    }
335811
public List<T> values() {
        List<T> result = new ArrayList<T>();
        for (Iterator<T> itr = iterator(); itr.hasNext(); ) {
            result.add(itr.next());
        }
        return result;
    }
120181
public IteratorWithAdditions iteratorWithAdditions() {
        @SuppressWarnings("unchecked")
        IteratorWithAdditions iterator = new IteratorWithAdditions();
        mIterators.put(iterator, false);
        return iterator;
    }
727191
public boolean next()
    {
        if (this.iter == null) {
            this.iter = new ArrayList<>(this.values).iterator();
        }
        final boolean ret = this.iter.hasNext();
        if (ret) {
            this.current = this.iter.next();
        }
        return ret;
    }
63416
public Iterator<DataPoint> getDataPointIterator()
    {
        Iterator<DataPoint> iteData = new Iterator<DataPoint>() 
        {
            int cur = 0;
            int to = size();

            @Override
            public boolean hasNext()
            {
                return cur < to;
            }

            @Override
            public DataPoint next()
            {
                return getDataPoint(cur++);
            }

            @Override
            public void remove()
            {
                throw new UnsupportedOperationException("This operation is not supported for DataSet");
            }
        };
        
        return iteData;
    }
369446
public Iterator<Symbol> iterator() {
        return new Iterator<Symbol>() {

            /** The next entry to examine, or null if none. */
            private Scope.Entry nextEntry = scope.elems;

            private boolean hasNextForSure = false;

            public boolean hasNext() {
                if (hasNextForSure) {
                    return true;
                }
                while (nextEntry != null && unwanted(nextEntry.sym)) {
                    nextEntry = nextEntry.sibling;
                }
                hasNextForSure = (nextEntry != null);
                return hasNextForSure;
            }

            public Symbol next() {
                if (hasNext()) {
                    Symbol result = nextEntry.sym;
                    nextEntry = nextEntry.sibling;
                    hasNextForSure = false;
                    return result;
                } else {
                    throw new NoSuchElementException();
                }
            }

            public void remove() {
                throw new UnsupportedOperationException();
            }
        };
    }
821634
@Override
    public Iterator<T> iterator() {
        if (m_items == null) {
            m_items = new TreeMap<String, T>();
        }
        return m_items.values().iterator();
    }
837481
public Iterator<R> iterator() {
        return new Iterator<R>() {
            R last = null;
            R next = newestBuild();

            public boolean hasNext() {
                return next!=null;
            }

            public R next() {
                last = next;
                if (last!=null)
                    next = last.getPreviousBuild();
                else
                    throw new NoSuchElementException();
                return last;
            }

            public void remove() {
                if (last==null)
                    throw new UnsupportedOperationException();
                removeValue(last);
            }
        };
    }
106561
@Override
    public Iterator<LeapSecondEvent> iterator() {

        final LeapSecondEvent[] events = this.getEventsInDescendingOrder();
        return Collections.unmodifiableList(Arrays.asList(events)).iterator();

    }
539557
public V[] getValues() {
		final V[] array = factory.newArray(elementCount);
		int i = 0;
		for (final V v : this) {
			array[i++] = v;
		}
		return array;
	}
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();
            }
        };
    }
1086763
public Iterator<ElementType> iterator() {
        return new Iterator<ElementType>() {
            int idx = getIdx;
            int N = size;

            public boolean hasNext() {
                return N > 0;
            }

            public ElementType next() {
                ElementType x = (ElementType) elements[idx];
                idx = (idx + 1) % elements.length;
                N--;
                return x;
            }

            public void remove() {
                throw new UnsupportedOperationException("remove");
            }
        };
    }
362824
public Collection<B> values() {
	return new AbstractCollection<B>() {
	    public int size() { return map.size(); }
	    public Iterator<B> iterator() {
		return 
		    DSUtil.<Map.Entry<A,B>,B>mapIterator
		    (BijMap.this.entrySet().iterator(),
		     new Function<Map.Entry<A,B>,B>() {
			public B f(Map.Entry<A,B> entry) {
			    return entry.getValue();
			}
		    });
	    }
	    public boolean remove(Object b) {
		return BijMap.this.rev().remove(b) != null;
	    }
	    public void clear() {
		BijMap.this.clear();
	    }
	};
    }
25062
@Override
  public Iterable<V> values() {
    if (isEmpty()) {
      return Collections.<V>emptyList();
    }
    return () -> new Iter<>(this, map -> map.value);
  }
240118
public Iterator<Symbol> iterator() {
        return scope.getSymbols(t -> !unwanted(t), NON_RECURSIVE).iterator();
    }
1234558
public Iterator<PlaceObject> enumeratePlaces ()
    {
        final Iterator<PlaceManager> itr = _pmgrs.values().iterator();
        return new Iterator<PlaceObject>() {
            public boolean hasNext () {
                return itr.hasNext();
            }
            public PlaceObject next () {
                PlaceManager plmgr = itr.next();
                return (plmgr == null) ? null : plmgr.getPlaceObject();
            }
            public void remove () {
                throw new UnsupportedOperationException();
            }
        };
    }