iterator

package
v2.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Iterable

type Iterable[T any] interface {
	// Iterator returns a new iterator for the collection
	Iterator() Iterator[T]
}

Iterable is an interface for collections that can provide an iterator

type Iterator

type Iterator[T any] interface {
	// HasNext returns true if there are more elements to iterate over
	HasNext() bool

	// Next returns the next element in the iteration.
	// Second return value is false if there are no more elements.
	Next() (T, bool)

	// Reset restarts the iteration from the beginning
	Reset()
}

Iterator is a generic interface for iterating over collections

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL