seek to the provided position to initialise the iterator

@param scalar scalar position
@return resultant iterator state
553924
private State seek(int scalar)
        {
            if (scalar == 0)
            {
                this.currentRow[0] = -1;
                clusteringComponents[0].addFirst(this);
                return setHasNext(advance(0, true));
            }

            int[] position = this.currentRow;
            decompose(scalar, position);
            for (int i = 0 ; i < position.length ; i++)
            {
                if (i != 0)
                    fill(i);
                for (int c = position[i] ; c > 0 ; c--)
                    clusteringComponents[i].poll();

                // we can have started from a position that does not exist, in which
                // case we need to ascend back up our clustering components, advancing as we go
                if (clusteringComponents[i].isEmpty())
                {
                    int j = i;
                    while (true)
                    {
                        // if we've exhausted the whole partition, we're done
                        if (--j < 0)
                            return setHasNext(false);

                        clusteringComponents[j].poll();
                        if (!clusteringComponents[j].isEmpty())
                            break;
                    }

                    // we don't check here to see if we've exceeded our lastRow,
                    // because if we came to a non-existent position and generated a lastRow
                    // we want to at least find the next real position, and set it on the seed
                    // in this case we do then yield false and select a different seed to continue with
                    position[j]++;
                    Arrays.fill(position, j + 1, position.length, 0);
                    while (j < i)
                        fill(++j);
                }

                row.row[i] = clusteringComponents[i].peek();
            }

            if (compareToLastRow(currentRow.length - 1) > 0)
                return setHasNext(false);

            // call advance so we honour any select chance
            position[position.length - 1]--;
            clusteringComponents[position.length - 1].addFirst(this);
            return setHasNext(advance(position.length - 1, true));
        }
175283
@SuppressWarnings({"unchecked"})
    public static <T> Iterator<T> cast(Iterator<? extends T> itr) {
        return (Iterator)itr;
    }
154464
@Override
    public IntIterator iterator() {

        return new IntIterator() {

            private final org.roaringbitmap.IntIterator iterator = bitmap.getIntIterator();

            @Override
            public int nextInt() {
                return iterator.next();
            }

            @Override
            public int skip(int k) {
                throw new UnsupportedOperationException("Views do not support skipping in the iterator");
            }

            @Override
            public boolean hasNext() {
                return iterator.hasNext();
            }
        };
    }
704226
public SDVariable scalarMin(SDVariable in, Number value) {
        return scalarMin(null, in, value);
    }
791062
@Override
    public void findNext(String str) {
        int startLine = getLine();
        int startColumn = getColumn();
        highLight(str);
        delegate.findNext(str);
        int targetLine = getLine();
        int targetColumn = getColumn();
        //Rest the actual pointer
        delegate.move(startLine, startColumn);
        int verticalOffset = targetLine - getLine();
        moveVertical(verticalOffset);
        int horizontalOffset = targetColumn - getColumn();
        moveHorizontally(horizontalOffset);
        redrawText();

    }
920138
private <T> Iterator<T> touch(Iterator<T> iter) {
        // Could return a Guava PeekingIterator after "if (iter.hasNext()) iter.peek()", but simply calling hasNext()
        // is sufficient for the iterator implementations used by this DAO class...
        iter.hasNext();
        return iter;
    }
1372053
@Override
	public Iterator<Map.Entry<K, V>> iterator() {
		return Collections.unmodifiableSet(state.entrySet()).iterator();
	}
104480
@Override
    public Iterator<E> iterator() {
        return new Iterator<E>() {

            private int index = start;
            private int lastReturnedIndex = -1;
            private boolean isFirst = full;

            @Override
            public boolean hasNext() {
                return isFirst || index != end;
            }

            @Override
            public E next() {
                if (!hasNext()) {
                    throw new NoSuchElementException();
                }
                isFirst = false;
                lastReturnedIndex = index;
                index = increment(index);
                return elements[lastReturnedIndex];
            }

            @Override
            public void remove() {
                if (lastReturnedIndex == -1) {
                    throw new IllegalStateException();
                }

                // First element can be removed quickly
                if (lastReturnedIndex == start) {
                    CircularFifoQueue.this.remove();
                    lastReturnedIndex = -1;
                    return;
                }

                int pos = lastReturnedIndex + 1;
                if (start < lastReturnedIndex && pos < end) {
                    // shift in one part
                    System.arraycopy(elements, pos, elements, lastReturnedIndex, end - pos);
                } else {
                    // Other elements require us to shift the subsequent elements
                    while (pos != end) {
                        if (pos >= maxElements) {
                            elements[pos - 1] = elements[0];
                            pos = 0;
                        } else {
                            elements[decrement(pos)] = elements[pos];
                            pos = increment(pos);
                        }
                    }
                }

                lastReturnedIndex = -1;
                end = decrement(end);
                elements[end] = null;
                full = false;
                index = decrement(index);
            }

        };
    }
97632
public Iterator iterator()
   {
      if (tc.isEntryEnabled()) SibTr.entry(tc, "iterator");
      if (tc.isEntryEnabled()) SibTr.exit(tc, "iterator");

      return map.values().iterator();
   }
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();
            }
        };
    }
631163
@Override
  public int nextStartPosition() throws IOException {
    if (findMatches()) {
      currentMatch = queueMatches.get(0);
      currentPosition = currentMatch.startPosition();
      queueMatches.remove(0);
      return currentMatch.startPosition();
    } else {
      currentMatch = new Match(NO_MORE_POSITIONS, NO_MORE_POSITIONS);
      currentPosition = NO_MORE_POSITIONS;
      return NO_MORE_POSITIONS;
    }
  }
963265
public Iterator<Entry<String, Object>> entryIterator() {
        final Iterator<String> iter = keyIterator();
        return new Iterator<Entry<String, Object>>() {
            @Override
            public boolean hasNext() {
                return iter.hasNext();
            }

            @Override
            public Entry<String, Object> next() {
                String key = iter.next();
                Object value = get(key);
                return new MyMapEntry(BeanMap.this, key, value);
            }

            @Override
            public void remove() {
                throw new UnsupportedOperationException("remove() not supported for BeanMap");
            }
        };
    }
983057
@Benchmark
  public int iter(IterState state)
  {
    ImmutableBitmap bitmap = state.bitmap;
    return iter(bitmap);
  }
1348918
public Iterator<Object> valueIterator() {
        final Iterator<String> iter = keyIterator();
        return new Iterator<Object>() {
            public boolean hasNext() {
                return iter.hasNext();
            }

            public Object next() {
                String key = iter.next();
                return get(key);
            }

            public void remove() {
                throw new UnsupportedOperationException("remove() not supported for BeanMap");
            }
        };
    }
32696
@Override
	@SuppressWarnings("unchecked")
	public Iterator<V> iterator() {
		CacheObjIterator<K, V> copiedIterator = (CacheObjIterator<K, V>) this.cacheObjIterator();
		return new CacheValuesIterator<V>(copiedIterator);
	}
488619
public synchronized Iterator idIterator()
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "idIterator");

      final LinkedList<Integer> linkedList = new LinkedList<Integer>();
      final Iterator iterator = table.values().iterator();

      while(iterator.hasNext())
      {
         final RequestIdTableEntry tableEntry = (RequestIdTableEntry)iterator.next();
         linkedList.add(Integer.valueOf(tableEntry.requestId));
      }

      final Iterator result = linkedList.iterator();
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "idIterator", result);
      return result;
   }
334539
@Override
	public Iterator<Entry<K, V>> iterator() {
		return new Iterator<Entry<K, V>>() {

			private final Entry<K, V>[] tab = KeyMap.this.table;

			private Entry<K, V> nextEntry;

			private int nextPos = 0;

			@Override
			public boolean hasNext() {
				if (nextEntry != null) {
					return true;
				}
				else {
					while (nextPos < tab.length) {
						Entry<K, V> e = tab[nextPos++];
						if (e != null) {
							nextEntry = e;
							return true;
						}
					}
					return false;
				}
			}

			@Override
			public Entry<K, V> next() {
				if (nextEntry != null || hasNext()) {
					Entry<K, V> e = nextEntry;
					nextEntry = nextEntry.next;
					return e;
				}
				else {
					throw new NoSuchElementException();
				}
			}

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