Documentation ¶
Overview ¶
Package iter provides generic constructors and helpers for iterators
Index ¶
- func Convert[From, To any, I c.Iterator[From]](elements I, converter func(From) To) loop.ConvertIter[From, To]
- func Filter[T any, I c.Iterator[T]](elements I, filter func(T) bool) loop.FitIter[T]
- func FilterAndConvert[From, To any, I c.Iterator[From]](elements I, filter func(From) bool, converter func(From) To) loop.ConvertFitIter[From, To]
- func FilterAndFlatt[From, To any, I c.Iterator[From]](elements I, filter func(From) bool, flattener func(From) []To) *loop.FlattenFitIter[From, To]
- func First[T any, I c.Iterator[T]](elements I, filter func(T) bool) (T, bool)
- func Flatt[From, To any, I c.Iterator[From]](elements I, flatt func(From) []To) *loop.FlatIter[From, To]
- func Group[T any, K comparable, I c.Iterator[T]](elements I, by func(T) K) stream.Iter[K, T, map[K][]T]
- func NotNil[T any, I c.Iterator[*T]](elements I) loop.FitIter[*T]
- func Of[T any](elements ...T) *slice.Iter[T]
- func Reduce[T any, I c.Iterator[T]](elements I, by func(T, T) T) T
- func ToKV[T, K, V any, IT c.Iterator[T]](elements IT, keyExtractor func(T) K, valExtractor func(T) V) loop.KeyValuer[T, K, V]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Convert ¶
func Convert[From, To any, I c.Iterator[From]](elements I, converter func(From) To) loop.ConvertIter[From, To]
Convert instantiates an iterator that converts elements with a converter and returns them
func Filter ¶
Filter instantiates an iterator that checks elements by a filter and returns successful ones
func FilterAndConvert ¶
func FilterAndConvert[From, To any, I c.Iterator[From]](elements I, filter func(From) bool, converter func(From) To) loop.ConvertFitIter[From, To]
FilterAndConvert returns a stream that filters source elements and converts them
func FilterAndFlatt ¶
func FilterAndFlatt[From, To any, I c.Iterator[From]](elements I, filter func(From) bool, flattener func(From) []To) *loop.FlattenFitIter[From, To]
FilterAndFlatt filters source elements and extracts slices of 'To' by the 'flattener' function
func Flatt ¶
func Flatt[From, To any, I c.Iterator[From]](elements I, flatt func(From) []To) *loop.FlatIter[From, To]
Flatt instantiates an iterator that converts the collection elements into slices and then flattens them to one level
func Group ¶
func Group[T any, K comparable, I c.Iterator[T]](elements I, by func(T) K) stream.Iter[K, T, map[K][]T]
Group transforms iterable elements to the MapPipe based on applying key extractor to the elements
Types ¶
This section is empty.