Returns to the beginning of the iteration.
508052
public void reset()
  {
    try
    {
      if(rs.getType() == ResultSet.TYPE_FORWARD_ONLY)
      {
        throw new UnsupportedOperationException("Can not reset iterator for a ResultSet that is of type \"forward only\"");
      }
      hasNext = rs.first();
    }
    catch (SQLException ex)
    {
      log.error(null, ex);
    }
  }
724750
@Override
  public T next() {
    Assert.isTrue(hasNext(), new NoSuchElementException("The iteration has no more elements!"));
    T value = iterators.peek().next();
    nextCalled.set(true);
    return value;
  }
914722
def next(self, timeout=None):
        """"""
        try:
            apply_result = self._collector._get_result(self._idx, timeout)
        except IndexError:
            # Reset for next time
            self._idx = 0
            raise StopIteration
        except:
            self._idx = 0
            raise
        self._idx += 1
        assert apply_result.ready()
        return apply_result.get(0)
234262
def run(self):
        
        iterations = 0
        queue = self.queue.tick()
        while True:
            try:
                next(queue)
            except StopIteration:
                break

            iterations += 1
            sleep(self.sleep_time)
        return iterations
482269
def first(self, **kwargs):
        
        result = result = self._get(limit=1, **kwargs)
        if result:
            return result[0]
        else:
            raise self.source_class.DoesNotExist(repr(kwargs))
75946
@Override
  public int nextStartPosition() throws IOException {
    if (currentStartPosition < minPosition) {
      currentStartPosition = minPosition;
      currentEndPosition = currentStartPosition + 1;
    } else {
      currentStartPosition++;
      currentEndPosition = currentStartPosition + 1;
      if (currentStartPosition > maxPosition) {
        currentStartPosition = NO_MORE_POSITIONS;
        currentEndPosition = NO_MORE_POSITIONS;
      }
    }
    return currentStartPosition;
  }
381344
public Range<T> reset() {
		lock.lock();
		try {
			this.current = this.start;
			this.index = 0;
		} finally {
			lock.unlock();
		}
		return this;
	}
871342
def first(self, x):
        """"""

        def _find(x):
            try:
                return self.all.index(str(x))
            except ValueError:
                return None

        if _is_collection(x):
            for item in x:
                found = _find(item)
                if found is not None:
                    return found
            return None
        else:
            return _find(x)
1130900
def first(self, n=1):
        
        res = self.obj[0:n]
        if len(res) is 1:
            res = res[0]
        return self._wrap(res)
467167
def next(self):
        
        # need new iterable?
        if self.r == self.repeats:
            self.i = (self.i + 1) % self.lenght
            self.r = 0

        self.r += 1
        if self.stopping and self.i == 0 and self.r == 1:
            self.stopped = True
        if self.i == 0 and self.stopped:
            raise StopIteration
        else:
            iterator = self.iterators[self.i]
            return iterator.next()
919686
def first(self):
        """"""
        with self.lock:
            try:
                return self.data[0][0]
            except IndexError as ex:
                ex.args = ('DEPQ is empty',)
                raise
869874
private void seekToRestartPosition(int restartPosition)
    {
        checkPositionIndex(restartPosition, restartCount, "restartPosition");

        // seek data readIndex to the beginning of the restart block
        int offset = restartPositions.getInt(restartPosition * SIZE_OF_INT);
        data.setPosition(offset);

        // clear the entries to assure key is not prefixed
        nextEntry = null;

        // read the entry
        nextEntry = readEntry(data, null);
    }
953598
public function rewind()
	{
		// Set the current position to the first object.
		if (empty($this->objects))
		{
			$this->current = false;
		}
		else
		{
			$keys = $this->keys();
			$this->current = array_shift($keys);
		}
	}
80917
def restart(self, start_from=1, occupied=[]):
        

        # initial ID
        self.top = start_from - 1

        # occupied IDs
        self._occupied = sorted(occupied, key=lambda x: x[0])

        # main dictionary storing the mapping from objects to variable IDs
        self.obj2id = collections.defaultdict(lambda: self._next())

        # mapping back from variable IDs to objects
        # (if for whatever reason necessary)
        self.id2obj = {}
754635
int getNextTransition(int start, int limit) {
        for (int i = 0; i < numberOfSpans; i++) {
            final int spanStart = spanStarts[i];
            final int spanEnd = spanEnds[i];
            if (spanStart > start && spanStart < limit) limit = spanStart;
            if (spanEnd > start && spanEnd < limit) limit = spanEnd;
        }
        return limit;
    }
656693
def iterate(f, n=None, last=__unique):
    
    if n is not None:
        def funciter(start):
            for i in xrange(n): yield start; start = f(start)
    else:
        def funciter(start):
            while True:
                yield start
                last = f(start)
                if last == start: return
                last, start = start, last
    return funciter
968181
private boolean toBoundedFirst() throws FetchException {
        if (mStartBound == null) {
            if (!toFirst()) {
                return false;
            }
        } else {
            if (!toFirst(mStartBound.clone())) {
                return false;
            }
            if (!mInclusiveStart) {
                byte[] currentKey = getCurrentKey();
                if (currentKey == null) {
                    return false;
                }
                if (compareKeysPartially(mStartBound, currentKey) == 0) {
                    if (!toNextKey()) {
                        return false;
                    }
                }
            }
        }

        if (mEndBound != null) {
            byte[] currentKey = getCurrentKey();
            if (currentKey == null) {
                return false;
            }
            int result = compareKeysPartially(currentKey, mEndBound);
            if (result >= 0) {
                if (result > 0 || !mInclusiveEnd) {
                    return false;
                }
            }
        }

        return prefixMatches();
    }