Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrIteratorEmpty = errors.New("iterator is empty")
Functions ¶
Types ¶
type Iterator ¶
type Iterator[T any] interface { // HasNext returns true if the iteration has more elements. HasNext() bool // Next returns the next element in the iteration. If there are no more // elements, it panics with ErrIteratorEmpty. Next() T // Collect returns a slice containing all the remaining elements in the Collect() []T }
Iterator is an interface that represents an iterator over a collection of elements of type T.
func Cycle ¶ added in v0.5.0
Cycle returns an iterator that cycles through the given items. The returned iterator will yield the items in the same order as they were given, and will repeat the cycle indefinitely.
func Filter ¶ added in v0.5.0
Filter returns an iterator that filters the items of the given iterator using the given predicate. The returned iterator will only yield items for which the predicate returns true.
Click to show internal directories.
Click to hide internal directories.