xiter

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package xiter provides simple iterator helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter added in v0.7.0

func Filter[V any](seq iter.Seq[V], test func(v V) bool) iter.Seq[V]

Filter iterates of the values of seq for which test returns true.

func Filter2 added in v0.7.0

func Filter2[K, V any](seq iter.Seq2[K, V], test func(k K, v V) bool) iter.Seq2[K, V]

Filter2 iterates of the (k,v) pairs of seq for which test returns true.

func First2Ok

func First2Ok[K, V any](seq iter.Seq2[K, V]) (K, V, bool)

First2Ok returns the first (K, V) element produced by the it iterator as well as true; otherwise, if the iterator produced no values, it returns zero K and V, as well as false.

func FirstOk

func FirstOk[V any](seq iter.Seq[V]) (V, bool)

FirstOk returns the first element produced by the it iterator as well as true; otherwise, if the iterator produced no values, it returns the zero value and false.

func Map added in v0.8.0

func Map[E, F any](seq iter.Seq[E], fn func(e E) F) iter.Seq[F]

Map transforms the passed sequence into a different sequence using the specified function. It preserves nil-ness.

func Swap added in v0.5.0

func Swap[K any, V any](seq iter.Seq2[K, V]) iter.Seq2[V, K]

Swap the key-value pairs of a sequence into value-key pairs.

Types

This section is empty.

Jump to

Keyboard shortcuts

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