Documentation ¶
Overview ¶
Package stream provides a stream implementation and helper functions
Index ¶
- type Iter
- func (t Iter[T]) Append(out []T) []T
- func (t Iter[T]) Conv(converter func(T) (T, error)) breakStream.Iter[T]
- func (t Iter[T]) Convert(converter func(T) T) Iter[T]
- func (t Iter[T]) Filt(predicate func(T) (bool, error)) breakStream.Iter[T]
- func (t Iter[T]) Filter(predicate func(T) bool) Iter[T]
- func (t Iter[T]) First(predicate func(T) bool) (T, bool)
- func (t Iter[T]) For(walker func(T) error) error
- func (t Iter[T]) ForEach(walker func(T))
- func (t Iter[T]) HasAny(predicate func(T) bool) bool
- func (t Iter[T]) Iter() c.Iterator[T]
- func (t Iter[T]) Loop() Iter[T]
- func (t Iter[T]) Next() (element T, ok bool)
- func (t Iter[T]) Reduce(by func(T, T) T) T
- func (t Iter[T]) Slice() []T
- func (t Iter[T]) Start() (Iter[T], T, bool)
- type Stream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Iter ¶
type Iter[T any] struct { // contains filtered or unexported fields }
Iter is the Iterator based stream implementation.
func (Iter[T]) Append ¶
func (t Iter[T]) Append(out []T) []T
Append collects the elements retrieved by the 'next' function into the specified 'out' slice
func (Iter[T]) Conv ¶
func (t Iter[T]) Conv(converter func(T) (T, error)) breakStream.Iter[T]
Conv returns a breakable stream that applies the 'converter' function to the collection elements
func (Iter[T]) Convert ¶
Convert returns a stream that applies the 'converter' function to the collection elements
func (Iter[T]) Filt ¶
func (t Iter[T]) Filt(predicate func(T) (bool, error)) breakStream.Iter[T]
Filt returns a breakable stream consisting of elements that satisfy the condition of the 'predicate' function
func (Iter[T]) Filter ¶
Filter returns a stream consisting of elements that satisfy the condition of the 'predicate' function
func (Iter[T]) First ¶
First returns the first element that satisfies the condition of the 'predicate' function
func (Iter[T]) For ¶
For applies the 'walker' function for the elements. Return the c.ErrBreak to stop.
func (Iter[T]) ForEach ¶
func (t Iter[T]) ForEach(walker func(T))
ForEach applies the 'walker' function for every element
func (Iter[T]) HasAny ¶
HasAny finds the first element that satisfies the 'predicate' function condition and returns true if successful