Documentation
¶
Index ¶
- func AllMatch[T any](seq iter.Seq[T], test funcs.Predicate[T]) bool
- func AnyMatch[T any](seq iter.Seq[T], test funcs.Predicate[T]) bool
- func Count[T any](seq iter.Seq[T]) (count int64)
- func Distinct[T any, Cmp comparable](seq iter.Seq[T], getUniqKey funcs.Function[T, Cmp]) iter.Seq[T]
- func Filter[T any](seq iter.Seq[T], test funcs.Predicate[T]) iter.Seq[T]
- func FlatMap[T, R any](seq iter.Seq[T], flatten funcs.Function[T, iter.Seq[R]]) iter.Seq[R]
- func ForEach[T any](seq iter.Seq[T], accept funcs.Consumer[T])
- func Limit[T any, Number nums.Int](seq iter.Seq[T], limit Number) iter.Seq[T]
- func Map[T, R any](seq iter.Seq[T], apply funcs.Function[T, R]) iter.Seq[R]
- func NoneMatch[T any](seq iter.Seq[T], test funcs.Predicate[T]) bool
- func Peek[T any](seq iter.Seq[T], accept funcs.Consumer[T]) iter.Seq[T]
- func Reduce[T, R any](seq iter.Seq[T], initVal R, acc funcs.BiFunction[R, T, R]) (result R)
- func Skip[T any, Number nums.Int](seq iter.Seq[T], skip Number) iter.Seq[T]
- func Sorted[T any](seq iter.Seq[T], cmp order.Comparator[T]) iter.Seq[T]
- func ToSlice[T any](seq iter.Seq[T]) (result []T)
- type Entry
- type Seq
- func Generate[T any](get funcs.Supplier[T]) Seq[T]
- func Of[T any](elements ...T) Seq[T]
- func OfSeq[T any](s iter.Seq[T]) Seq[T]
- func OfSlice[T any](s []T) Seq[T]
- func Range[T nums.Number](fromInclude, toExclude T) Seq[T]
- func RangeStep[T, S nums.Number](fromInclude, toExclude T, step S) Seq[T]
- func Repeat[T any](e T) Seq[T]
- func (it Seq[T]) AllMatch(test funcs.Predicate[T]) bool
- func (it Seq[T]) AnyMatch(test funcs.Predicate[T]) bool
- func (it Seq[T]) Count() int64
- func (it Seq[T]) Distinct(getUniqKey funcs.Function[T, int]) Stream[T]
- func (it Seq[T]) Filter(test funcs.Predicate[T]) Stream[T]
- func (it Seq[T]) FlatMap(flatten funcs.Function[T, iter.Seq[T]]) Stream[T]
- func (it Seq[T]) ForEach(accept funcs.Consumer[T])
- func (it Seq[T]) Limit(n int64) Stream[T]
- func (it Seq[T]) Map(apply funcs.Function[T, T]) Stream[T]
- func (it Seq[T]) NoneMatch(test funcs.Predicate[T]) bool
- func (it Seq[T]) Peek(accept funcs.Consumer[T]) Stream[T]
- func (it Seq[T]) Reduce(initVal T, acc funcs.BinaryOperator[T]) T
- func (it Seq[T]) Seq() iter.Seq[T]
- func (it Seq[T]) Seq2() iter.Seq2[int, T]
- func (it Seq[T]) Skip(n int64) Stream[T]
- func (it Seq[T]) Sorted(cmp order.Comparator[T]) Stream[T]
- func (it Seq[T]) ToSlice() []T
- type Seq2
- type Stream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Distinct ¶
func Distinct[T any, Cmp comparable](seq iter.Seq[T], getUniqKey funcs.Function[T, Cmp]) iter.Seq[T]
Distinct remove duplicate elements. 对序列中的元素去重
func FlatMap ¶
FlatMap transform each element in Seq[T] to a new Seq[R]. 将原本序列中的每个元素都转换为一个新的序列, 并将所有转换后的序列依次连接起来生成一个新的序列
func Reduce ¶
func Reduce[T, R any](seq iter.Seq[T], initVal R, acc funcs.BiFunction[R, T, R]) (result R)
Reduce accumulate each element using the BiFunction starting from the initial value. 从初始值开始, 通过 acc 函数累加每个元素
Types ¶
type Seq ¶
func RangeStep ¶
RangeStep build a Seq count from fromInclude to toExclude. step may negetive. 按指定步进大小构造一个左闭右开的序列, 步进大小可以是负数
func Repeat ¶
Repeat create an infinite Seq, which all elements is same as the input element. 使用输入的单个元素创建一个无限序列
func (Seq[T]) Reduce ¶
func (it Seq[T]) Reduce(initVal T, acc funcs.BinaryOperator[T]) T
type Stream ¶
type Stream[T any] interface { Seq() iter.Seq[T] Filter(test funcs.Predicate[T]) Stream[T] Map(apply funcs.Function[T, T]) Stream[T] FlatMap(flatten funcs.Function[T, iter.Seq[T]]) Stream[T] Peek(accept funcs.Consumer[T]) Stream[T] Distinct(getUniqKey funcs.Function[T, int]) Stream[T] Sorted(cmp order.Comparator[T]) Stream[T] Limit(n int64) Stream[T] Skip(n int64) Stream[T] Count() int64 ToSlice() []T ForEach(accept funcs.Consumer[T]) AllMatch(test funcs.Predicate[T]) bool AnyMatch(test funcs.Predicate[T]) bool NoneMatch(test funcs.Predicate[T]) bool Reduce(initVal T, acc funcs.BinaryOperator[T]) T }
Click to show internal directories.
Click to hide internal directories.