iter

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: May 15, 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.6.8

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

func AnyMatch2 added in v1.6.8

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

func Collect2 added in v1.6.8

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

func Count2 added in v1.6.8

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

func Distinct2

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.6.6

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

func Filter2

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

func FlatMap2 added in v1.6.8

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.6.8

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.6.8

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.6.8

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.6.8

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

func IsSorted2 added in v1.6.8

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

func Limit2 added in v1.6.8

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

func Map2 added in v1.6.8

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

func Map3 added in v1.6.8

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.6.8

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

func Peek2

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

func Reduce2 added in v1.6.8

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

func Seq2Seq added in v1.6.8

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

func Skip2 added in v1.6.8

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

func Sorted2 added in v1.6.8

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

func Zip2 added in v1.6.8

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.6.8

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

type BiFunction3 added in v1.6.8

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

type BinaryOperator2 added in v1.6.8

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

type Comparator2

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

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

type Consumer2

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

Consumer 消费一个元素

type Function2

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

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

type Function3 added in v1.6.8

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

type Predicate2

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

Predicate 断言是否满足指定条件

type Seq2

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

func ChannelSeq2Of added in v1.6.9

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

func HashMapSeq2Of added in v1.6.5

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

func RangeSeq2Of added in v1.6.9

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

func SliceSeq2Of added in v1.6.5

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

func StringSeq2Of added in v1.6.9

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

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

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

type Stream2

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

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

Supplier 产生一个元素

type UnaryOperator2 added in v1.6.8

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

Jump to

Keyboard shortcuts

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