iter

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllMatch2 added in v1.9.3

func AllMatch2[K, V any](seq iter.Seq2[K, V], test Predicate2[K, V]) bool

func AnyMatch2 added in v1.9.3

func AnyMatch2[K, V any](seq iter.Seq2[K, V], test Predicate2[K, V]) bool

func Collect2 added in v1.9.3

func Collect2[K, V any](seq iter.Seq2[K, V]) (ks []K, vs []V)

func Count2 added in v1.9.3

func Count2[K, V any](seq iter.Seq2[K, V]) (count int64)

func Distinct2 added in v1.9.3

func Distinct2[K, V any, C comparable](seq iter.Seq2[K, V], f Function2[K, V, C]) iter.Seq2[K, V]

func Enumerate2 added in v1.9.3

func Enumerate2[K, V any](seq iter.Seq2[K, V]) iter.Seq2[int, *types.Pair[K, V]]

func Filter2 added in v1.9.3

func Filter2[K, V any](seq iter.Seq2[K, V], test Predicate2[K, V]) iter.Seq2[K, V]

func FlatMap2 added in v1.9.3

func FlatMap2[K, V, R any](seq iter.Seq2[K, V], flatten Function2[K, V, iter.Seq[R]]) iter.Seq[R]

func FlatMap3 added in v1.9.3

func FlatMap3[K, V, RK, RV any](seq iter.Seq2[K, V], flatten Function2[K, V, iter.Seq2[RK, RV]]) iter.Seq2[RK, RV]

func Fold2 added in v1.9.3

func Fold2[K, V, R any](seq iter.Seq2[K, V], initVal R, acc BiFunction2[R, K, V, R]) (result R)

func Fold3 added in v1.9.3

func Fold3[K, V, RK, RV any](seq iter.Seq2[K, V], initKey RK, initVal RV, acc BiFunction3[RK, RV, K, V, RK, RV]) (resultKey RK, resultVal RV)

func ForEach2 added in v1.9.3

func ForEach2[K, V any](seq iter.Seq2[K, V], accept Consumer2[K, V])

func IsSorted2 added in v1.9.3

func IsSorted2[K, V any](seq iter.Seq2[K, V], cmp Comparator2[K, V]) bool

func Limit2 added in v1.9.3

func Limit2[K, V any, Number constraints.Number](seq iter.Seq2[K, V], limit Number) iter.Seq2[K, V]

func Map2 added in v1.9.3

func Map2[K, V, R any](seq iter.Seq2[K, V], f Function2[K, V, R]) iter.Seq[R]

func Map3 added in v1.9.3

func Map3[K, V, RK, RV any](seq iter.Seq2[K, V], f Function3[K, V, RK, RV]) iter.Seq2[RK, RV]

func NoneMatch2 added in v1.9.3

func NoneMatch2[K, V any](seq iter.Seq2[K, V], test Predicate2[K, V]) bool

func Peek2 added in v1.9.3

func Peek2[K, V any](seq iter.Seq2[K, V], accept Consumer2[K, V]) iter.Seq2[K, V]

func Reduce2 added in v1.9.3

func Reduce2[K, V any](seq iter.Seq2[K, V], acc BinaryOperator2[K, V]) (K, V, bool)

func Seq2Seq added in v1.9.3

func Seq2Seq[K, V any](seq2 iter.Seq2[K, V]) iter.Seq[*types.Pair[K, V]]

func Skip2 added in v1.9.3

func Skip2[K, V any, Number constraints.Number](seq iter.Seq2[K, V], skip Number) iter.Seq2[K, V]

func Sorted2 added in v1.9.3

func Sorted2[K, V any](it iter.Seq2[K, V], cmp Comparator2[K, V]) iter.Seq2[K, V]

func Zip2 added in v1.9.3

func Zip2[K, V any](seq1 iter.Seq2[K, V], seq2 iter.Seq2[K, V]) iter.Seq2[K, V]

Types

type BiFunction2 added in v1.9.3

type BiFunction2[K, V, R, U any] func(K, V, R) U

type BiFunction3 added in v1.9.3

type BiFunction3[K, V, RK, RV, UK, UV any] func(K, V, RK, RV) (UK, UV)

type BinaryOperator2 added in v1.9.3

type BinaryOperator2[K, V any] func(K, V, K, V) (K, V)

type Comparator2 added in v1.9.3

type Comparator2[K, V any] func(K, V, K, V) bool

Comparator 比较两个元素. 第一个元素大于第二个元素时,返回正数; 第一个元素小于第二个元素时,返回负数; 否则返回 0.

type Consumer2 added in v1.9.3

type Consumer2[K, V any] func(K, V)

Consumer 消费一个元素

type Function2 added in v1.9.3

type Function2[K, V, R any] func(K, V) R

Function 将一个类型转为另一个类型

type Function3 added in v1.9.3

type Function3[K, V, RK, RV any] func(K, V) (RK, RV)

type Predicate2 added in v1.9.3

type Predicate2[K, V any] func(K, V) bool

Predicate 断言是否满足指定条件

type Seq2 added in v1.9.3

type Seq2[K, V any] iter.Seq2[K, V]

func ChannelAll2 added in v1.9.3

func ChannelAll2[T any](c chan T) Seq2[int, T]

func HashMapAll2 added in v1.9.3

func HashMapAll2[K comparable, V any](m map[K]V) Seq2[K, V]

func RangeAll2 added in v1.9.3

func RangeAll2[T constraints.Number](begin, end, step T) Seq2[int, T]

func SliceAll2 added in v1.9.3

func SliceAll2[T any](input []T) Seq2[int, T]

func SliceBackward2 added in v1.9.3

func SliceBackward2[T any](input []T) Seq2[int, T]

func StringAll2 added in v1.9.3

func StringAll2(input string) Seq2[int, rune]

func (Seq2[K, V]) Seq added in v1.9.3

func (s Seq2[K, V]) Seq() iter.Seq[*types.Pair[K, V]]

type Stream2 added in v1.9.3

type Stream2[K, V any] interface {
	Seq2() iter.Seq2[K, V]

	Filter(Predicate2[K, V]) Stream2[K, V]
	Peek(Consumer2[K, V]) Stream2[K, V]

	Distinct(Function2[K, V, int]) Stream2[K, V]
	SortedByKeys(Comparator[K]) Stream2[K, V]
	SortedByValues(Comparator[V]) Stream2[K, V]
	Limit(int64) Stream2[K, V]
	Skip(int64) Stream2[K, V]

	ForEach(Consumer2[K, V])
	Collect() ([]K, []V)
	AllMatch(Predicate2[K, V]) bool
	NoneMatch(Predicate2[K, V]) bool
	AnyMatch(Predicate2[K, V]) bool

	First() (K, V)
	Count() int64
}

type Supplier2 added in v1.9.3

type Supplier2[K, V any] func() (K, V)

Supplier 产生一个元素

type UnaryOperator2 added in v1.9.3

type UnaryOperator2[K, V any] func(K, V) (K, V)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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