// Next selects a node from group.
// It also selects IP if the IP list exists.
322702
func (group *NodeGroup) Next() (node Node, err error) {
	if group == nil {
		return
	}

	group.mux.RLock()
	defer group.mux.RUnlock()

	selector := group.selector
	if selector == nil {
		selector = &defaultSelector{}
	}

	// select node from node group
	node, err = selector.Select(group.nodes, group.selectorOptions...)
	if err != nil {
		return
	}

	return
}
811895
func (iter *sliceIterator) next() (string, string, int) {
	if iter.position > len(iter.slice)-1 {
		return "", "", -1
	}
	position := iter.position
	iter.position++
	return iter.slice[position], strings.Trim(iter.slice[position], " \t"), position
}
898703
func (s Slice) Next() (Slice, error) {
	size, err := s.ByteSize()
	if err != nil {
		return nil, WithStack(err)
	}
	return Slice(s[size:]), nil
}
701929
func (c *cursor) Next() (key, value []byte) {
	return (*bbolt.Cursor)(c).Next()
}
776470
func (i *TeamIter) Next() bool {
	if i.first && i.err != nil {
		i.first = false
		return true
	}
	i.first = false
	i.i++
	return i.i < len(i.page)
}
124873
func (i *Uint16) Next() uint16 {
	i.lock.Lock()
	defer i.lock.Unlock()
	i.increment++
	return i.increment
}
1161126
func (it *Or) Next(ctx context.Context) bool {
	if it.currentIterator >= len(it.internalIterators) {
		return false
	}
	graph.NextLogIn(it)
	var first bool
	for {
		if it.currentIterator == -1 {
			it.currentIterator = 0
			first = true
		}
		curIt := it.internalIterators[it.currentIterator]

		if curIt.Next(ctx) {
			it.result = curIt.Result()
			return graph.NextLogOut(it, true)
		}

		it.err = curIt.Err()
		if it.err != nil {
			return graph.NextLogOut(it, false)
		}

		if it.isShortCircuiting && !first {
			break
		}
		it.currentIterator++
		if it.currentIterator >= len(it.internalIterators) {
			break
		}
	}

	return graph.NextLogOut(it, false)
}
752326
func (e *baseExecutor) Next(ctx context.Context, req *chunk.RecordBatch) error {
	return nil
}
829862
func (it *Optional) Next(ctx context.Context) bool {
	clog.Errorf("Nexting an un-nextable iterator: %T", it)
	return false
}
1086215
func (c Connection) Next() (*Connection, error) {
	c.pool.mu.Lock()
	defer c.pool.mu.Unlock()

	for i := 0; i < len(c.pool.series)-1; i++ {
		s := c.pool.series[i]
		if s == c.series {
			ns := c.pool.series[i+1]
			nc, err := c.pool.connFromPath(c.pool.pathFromSeries(ns))
			if err != nil {
				return nil, err
			}
			return &Connection{
				Connection: nc,
				pool:       c.pool,
				series:     ns,
			}, nil
		}
	}
	return nil, ErrUnknownDB
}
447507
func (nt *NodeTree) Next() string {
	nt.mu.Lock()
	defer nt.mu.Unlock()
	if len(nt.zones) == 0 {
		return ""
	}
	numExhaustedZones := 0
	for {
		if nt.zoneIndex >= len(nt.zones) {
			nt.zoneIndex = 0
		}
		zone := nt.zones[nt.zoneIndex]
		nt.zoneIndex++
		// We do not check the exhausted zones before calling next() on the zone. This ensures
		// that if more nodes are added to a zone after it is exhausted, we iterate over the new nodes.
		nodeName, exhausted := nt.tree[zone].next()
		if exhausted {
			numExhaustedZones++
			if numExhaustedZones >= len(nt.zones) { // all zones are exhausted. we should reset.
				nt.resetExhausted()
			}
		} else {
			return nodeName
		}
	}
}
791314
func (it *Iterator) Next() bool {
	for it.nodeIt.Next(true) {
		if it.nodeIt.Leaf() {
			it.Key = it.nodeIt.LeafKey()
			it.Value = it.nodeIt.LeafBlob()
			return true
		}
	}
	it.Key = nil
	it.Value = nil
	it.Err = it.nodeIt.Error()
	return false
}
926111
func (it *Unique) Next(ctx context.Context) bool {
	graph.NextLogIn(it)
	it.runstats.Next += 1

	for it.subIt.Next(ctx) {
		curr := it.subIt.Result()
		key := graph.ToKey(curr)
		if ok := it.seen[key]; !ok {
			it.result = curr
			it.seen[key] = true
			return graph.NextLogOut(it, true)
		}
	}
	it.err = it.subIt.Err()
	return graph.NextLogOut(it, false)
}
1196642
func (t *towerListIterator) Next() (*wtdb.Tower, error) {
	t.mu.Lock()
	defer t.mu.Unlock()

	// If the next candidate is nil, we've exhausted the list.
	if t.nextCandidate == nil {
		return nil, ErrTowerCandidatesExhausted
	}

	// Propose the tower at the front of the list.
	tower := t.nextCandidate.Value.(*wtdb.Tower)

	// Set the next candidate to the subsequent element.
	t.nextCandidate = t.nextCandidate.Next()

	return tower, nil
}
308406
func (p *Pager) Next() *Pager {
	if !p.HasNext() {
		return nil
	}
	return p.pagers[p.PageNumber()]
}
920121
func (it *Skip) Next(ctx context.Context) bool {
	graph.NextLogIn(it)
	for ; it.skipped < it.skip; it.skipped++ {
		if !it.primaryIt.Next(ctx) {
			return graph.NextLogOut(it, false)
		}
	}
	if it.primaryIt.Next(ctx) {
		return graph.NextLogOut(it, true)
	}
	return graph.NextLogOut(it, false)
}
62253
func (t *tree) next() item {
	if t.peekCount > 0 {
		t.peekCount--
	} else {
		t.token[0] = t.lex.nextItem()
	}
	return t.token[t.peekCount]
}