iter

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FiniteIterable

type FiniteIterable[T any] interface {
	Iterable[T]
	// Size returns the number of elements in the collection.
	Size() int
}

A FiniteIterable is a finite collection of elements. It can be iterated through using an Iterator. Useful for passing to data structures constructors.

type Iterable

type Iterable[T any] interface {
	// Iterator creates and returns a new Iterator.
	Iterator() Iterator[T]
}

An Iterable is a finite or infinite collection of elements. It can be iterated through using an Iterator.

type Iterator

type Iterator[T any] interface {
	// Valid returns true if the end has not been reached.
	Valid() bool
	// Move fetches the next element.
	Move()
	// Get returns the current element.
	Get() T
}

An Iterator is used to iterate through elements. It fits well with the for-loop syntax.

Jump to

Keyboard shortcuts

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