Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FilterFunc ¶
FilterFunc is a custom func that will be applied to items on an iterator
type Iterator ¶
type Iterator[T any] []T
Iterator is the central backbone that used within this project
func NewIterator ¶
NewIterator creates a new iterator without any len or cap
func NewIteratorFromExistingSlice ¶ added in v0.1.2
func NewIteratorWithCapacity ¶
NewIteratorWithCapacity Creates a new iterator with capacity of type T
func NewIteratorWithLength ¶
NewIteratorWithLength Creates a new iterator with length of type T with 0 value types of type T
func (Iterator[T]) Collect ¶
func (iter Iterator[T]) Collect() []T
Collect method is used to return the slice of type T is the users do not want an iterator type
func (Iterator[T]) Filter ¶
func (iter Iterator[T]) Filter(filterFunc FilterFunc[T]) Iterator[T]
Filter is a receiver method on the Iterator that takes in a FilterFunc and applies on the slice elements and returns a new Iterator with the filtered elements
func (Iterator[T]) Map ¶
Map is a receiver method on the Iterator that takes in a MapFunc and applies on the slice elements and returns a new Iterator with the filtered elements
func (Iterator[T]) Reduce ¶
func (iter Iterator[T]) Reduce(reducerFunc ReducerFunc[T], initialValue T) T
Reduce is a receiver method on the Iterator that takes in a ReducerFunc and applies on the slice elements and returns a reduced value of type T
type MapFunc ¶
type MapFunc[T any] func(T) T
MapFunc is a custom func that will be applied to items on an iterator
type ReducerFunc ¶
type ReducerFunc[T any] func(accumulator, element T) T
ReducerFunc is a custom func that will be applied to items on an iterator