Documentation ¶
Overview ¶
Package iter provides generic constructors and helpers for key/value iterators
Index ¶
- func Filter[K comparable, V any, I kv.Iterator[K, V]](elements I, filter func(K, V) bool) stream.Iter[K, V, map[K]V]
- func FilterKey[K comparable, V any, I kv.Iterator[K, V]](elements I, fit func(K) bool) stream.Iter[K, V, map[K]V]
- func FilterValue[K comparable, V any, I kv.Iterator[K, V]](elements I, fit func(V) bool) stream.Iter[K, V, map[K]V]
- func FromIter[T, K, V any, I c.Iterator[T]](elements I, keyExtractor func(T) K, valExtractor func(T) V) loop.KeyValuer[T, K, V]
- func FromPairs[K, V any, I c.Iterator[c.KV[K, V]]](elements I) loop.KeyValuer[c.KV[K, V], K, V]
- func Group[K comparable, V any, I kv.Iterator[K, V]](elements I) map[K][]V
- func Map[K comparable, V any, KOUT comparable, VOUT any, I kv.Iterator[K, V]](elements I, by func(K, V) (KOUT, VOUT)) stream.Iter[KOUT, VOUT, map[KOUT]VOUT]
- func OfPairs[K, V any](pairs ...c.KV[K, V]) loop.KeyValuer[c.KV[K, V], K, V]
- func Reduce[K comparable, V any, I kv.Iterator[K, V]](elements I, merge func(K, V, K, V) (K, V)) (K, V)
- func WrapPairs[K, V any, P ~[]c.KV[K, V]](pairs P) loop.KeyValuer[c.KV[K, V], K, V]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Filter ¶
func Filter[K comparable, V any, I kv.Iterator[K, V]](elements I, filter func(K, V) bool) stream.Iter[K, V, map[K]V]
Filter instantiates key/value iterator that iterates only over filtered elements
func FilterKey ¶
func FilterKey[K comparable, V any, I kv.Iterator[K, V]](elements I, fit func(K) bool) stream.Iter[K, V, map[K]V]
FilterKey instantiates key/value iterator that iterates only over elements that filtered by the key
func FilterValue ¶
func FilterValue[K comparable, V any, I kv.Iterator[K, V]](elements I, fit func(V) bool) stream.Iter[K, V, map[K]V]
FilterValue instantiates key/value iterator that iterates only over elements that filtered by the value
func FromIter ¶
func FromIter[T, K, V any, I c.Iterator[T]](elements I, keyExtractor func(T) K, valExtractor func(T) V) loop.KeyValuer[T, K, V]
FromIter converts a c.Iterator to a kv.KVIterator using key and value extractors
func Group ¶
func Group[K comparable, V any, I kv.Iterator[K, V]](elements I) map[K][]V
Group collects sets of values grouped by keys obtained by passing a key/value iterator
func Map ¶
func Map[K comparable, V any, KOUT comparable, VOUT any, I kv.Iterator[K, V]](elements I, by func(K, V) (KOUT, VOUT)) stream.Iter[KOUT, VOUT, map[KOUT]VOUT]
Map instantiates key/value iterator that converts elements with a converter and returns them
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.