iter

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllMatch2

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

func AnyMatch2

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

func Collect2

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

func Count2

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

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

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

func FlatMap3

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

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

func Fold3

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

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

func IsSorted2

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

func Limit2

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

func Map2

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

func Map3

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

func NoneMatch2

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

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

func Seq2Seq

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

func Skip2

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

func Sorted2

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

func Zip2

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

Types

type BiFunction2

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

type BiFunction3

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

type BinaryOperator2

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

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 ChannelAll2

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

func HashMapAll2

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

func RangeAll2

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

func SliceAll2

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

func SliceBackward2

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

func StringAll2

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

func (Seq2[K, V]) Seq

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

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