Documentation ¶
Index ¶
- func AllMatch[T any](predicate func(T) bool, it Iterator[T]) bool
- func AnyMatch[T any](predicate func(T) bool, it Iterator[T]) bool
- func At[T any](index int, it Iterator[T]) (T, bool)
- func Average[T constraints.Integer | constraints.Float](it Iterator[T]) float64
- func Collect[T any, S any, R any](collector Collector[S, T, R], it Iterator[T]) R
- func CollectToMap[K comparable, V any](it Iterator[types.Pair[K, V]]) map[K]V
- func CollectToSlice[T any](it Iterator[T]) []T
- func Contains[T comparable](target T, it Iterator[T]) bool
- func Count[T any](it Iterator[T]) int
- func First[T any](it Iterator[T]) (T, bool)
- func Fold[T any, R any](initial R, operation func(R, T) R, it Iterator[T]) R
- func ForEach[T any](action func(T), it Iterator[T])
- func IsEmpty[T any](c Collection[T]) bool
- func IsNotEmpty[T any](c Collection[T]) bool
- func Last[T any](it Iterator[T]) (T, bool)
- func Max[T constraints.Ordered](it Iterator[T]) (T, bool)
- func MaxBy[T any](greater func(T, T) bool, it Iterator[T]) (T, bool)
- func Min[T constraints.Ordered](it Iterator[T]) (T, bool)
- func MinBy[T any](less func(T, T) bool, it Iterator[T]) (T, bool)
- func NoneMatch[T any](predicate func(T) bool, it Iterator[T]) bool
- func Product[T constraints.Integer | constraints.Float](it Iterator[T]) T
- func Reduce[T any](operation func(T, T) T, it Iterator[T]) (T, bool)
- func Sum[T constraints.Integer | constraints.Float](it Iterator[T]) T
- func Unzip[A any, B any](it Iterator[types.Pair[A, B]]) ([]A, []B)
- type Collection
- type Collector
- type Iterable
- type Iterator
- func Concat[T any](left Iterator[T], right Iterator[T]) Iterator[T]
- func Enumerate[T any](it Iterator[T]) Iterator[*types.Pair[int, T]]
- func Filter[T any](predicate func(T) bool, it Iterator[T]) Iterator[T]
- func Flatten[T Iterable[U], U any](it Iterator[T]) Iterator[U]
- func Limit[T any](count int, it Iterator[T]) Iterator[T]
- func Map[T any, R any](transform func(T) R, it Iterator[T]) Iterator[R]
- func MapOf[T any, R any](transform func(T) R, iter Iterator[T]) Iterator[R]
- func RangeOf[T constraints.Integer](begin, end, step T) Iterator[T]
- func Skip[T any](count int, it Iterator[T]) Iterator[T]
- func Step[T any](count int, it Iterator[T]) Iterator[T]
- func StringOf(input string) Iterator[rune]
- func Zip[T any, U any](left Iterator[T], right Iterator[U]) Iterator[*types.Pair[T, U]]
- type MapIter
- type Range
- type Slice
- type String
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Average ¶
func Average[T constraints.Integer | constraints.Float](it Iterator[T]) float64
Returns the average of all the elements in the iterator.
func CollectToMap ¶
func CollectToMap[K comparable, V any](it Iterator[types.Pair[K, V]]) map[K]V
Collect to built-in map.
func CollectToSlice ¶
func Contains ¶
func Contains[T comparable](target T, it Iterator[T]) bool
Returns true if the target is included in the iterator.
func ForEach ¶
The action is executed for each element of the iterator, and the argument to the action is the element.
func IsEmpty ¶
func IsEmpty[T any](c Collection[T]) bool
Ruturns true if the count of collection is 0.
func IsNotEmpty ¶
func IsNotEmpty[T any](c Collection[T]) bool
Ruturns true if the count of collection is 0.
func Max ¶
func Max[T constraints.Ordered](it Iterator[T]) (T, bool)
Return the maximum value of all elements of the iterator.
func Min ¶
func Min[T constraints.Ordered](it Iterator[T]) (T, bool)
Return the minimum value of all elements of the iterator.
func Product ¶
func Product[T constraints.Integer | constraints.Float](it Iterator[T]) T
Returns the product of all the elements in the iterator.
func Sum ¶
func Sum[T constraints.Integer | constraints.Float](it Iterator[T]) T
Returns the sum of all the elements in the iterator.
Types ¶
type Collection ¶
type Iterator ¶
func Concat ¶
By connecting two iterators in series, the new iterator will iterate over the first iterator before continuing with the second iterator.
func RangeOf ¶
func RangeOf[T constraints.Integer](begin, end, step T) Iterator[T]
Range returns an Iterator over a range of integers.
func Step ¶
Converts an iterator to another iterator that skips a specified number of times each time.
type Range ¶
type Range[T constraints.Integer] struct { Begin T End T }