Documentation
¶
Index ¶
- Constants
- func AllMatch[T any](predicate func(T) bool, it Sequence[T]) bool
- func AnyMatch[T any](predicate func(T) bool, it Sequence[T]) bool
- func At[T any](index int, it Sequence[T]) option.Option[T]
- func Average[T constraints.Integer | constraints.Float](it Sequence[T]) float64
- func Collect[T any, S any, R any](collector Collector[S, T, R], it Sequence[T]) R
- func CollectToSlice[T any](it Iterator[T]) []T
- func Contains[T comparable](target T, it Sequence[T]) bool
- func Count[T any](it Sequence[T]) int
- func Equals[T comparable](l Collection[T], r Collection[T]) bool
- func First[T any](it Sequence[T]) option.Option[T]
- func FirstIndexOf[T comparable](li Sequence[T], element T) int
- func Fold[T any, R any](initial R, operation func(R, T) R, it Sequence[T]) R
- func ForEach[T any](action func(T), it Sequence[T])
- func IsEmpty[T any](c Collection[T]) bool
- func IsNotEmpty[T any](c Collection[T]) bool
- func Last[T any](it Sequence[T]) option.Option[T]
- func Max[T constraints.Ordered](it Sequence[T]) option.Option[T]
- func MaxBy[T any](greater func(T, T) bool, it Sequence[T]) option.Option[T]
- func Min[T constraints.Ordered](it Sequence[T]) option.Option[T]
- func MinBy[T any](less func(T, T) bool, it Sequence[T]) option.Option[T]
- func NoneMatch[T any](predicate func(T) bool, it Sequence[T]) bool
- func Product[T constraints.Integer | constraints.Float](it Sequence[T]) T
- func Reduce[T any](operation func(T, T) T, it Sequence[T]) option.Option[T]
- func Sum[T constraints.Integer | constraints.Float](it Sequence[T]) T
- type Collection
- type Collector
- type Iterator
- type Pair
- type Sequence
- func Concat[T any](left Sequence[T], right Sequence[T]) Sequence[T]
- func Enumerate[T any](it Sequence[T]) Sequence[Pair[int, T]]
- func Filter[T any](predicate func(T) bool, it Sequence[T]) Sequence[T]
- func Flatten[T Sequence[U], U any](it Sequence[T]) Sequence[U]
- func Limit[T any](count int, it Sequence[T]) Sequence[T]
- func Map[T any, R any](transform func(T) R, it Sequence[T]) Sequence[R]
- func Skip[T any](count int, it Sequence[T]) Sequence[T]
- func Step[T any](count int, it Sequence[T]) Sequence[T]
- func Zip[T any, U any](left Sequence[T], right Sequence[U]) Sequence[Pair[T, U]]
- type Slice
- type String
Constants ¶
const OutOfBounds = "out of bounds"
Variables ¶
This section is empty.
Functions ¶
func Average ¶
func Average[T constraints.Integer | constraints.Float](it Sequence[T]) float64
Returns the average of all the elements in the Sequence.
func CollectToSlice ¶
func Contains ¶
func Contains[T comparable](target T, it Sequence[T]) bool
Returns true if the target is included in the Sequence.
func Equals ¶
func Equals[T comparable](l Collection[T], r Collection[T]) bool
func FirstIndexOf ¶
func FirstIndexOf[T comparable](li Sequence[T], element T) int
func ForEach ¶
The action is executed for each element of the Sequence, 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 Sequence[T]) option.Option[T]
Return the maximum value of all elements of the Sequence.
func Min ¶
func Min[T constraints.Ordered](it Sequence[T]) option.Option[T]
Return the minimum value of all elements of the Sequence.
func Product ¶
func Product[T constraints.Integer | constraints.Float](it Sequence[T]) T
Returns the product of all the elements in the Sequence.
func Sum ¶
func Sum[T constraints.Integer | constraints.Float](it Sequence[T]) T
Returns the sum of all the elements in the Sequence.
Types ¶
type Collection ¶
Sequence's extended interfaces, can provide more information to optimize performance.
type Iterator ¶
By implementing Next you can perform iterations and end them when the return value is None.
type Sequence ¶
Sequence can be obtained iteratively through Iterator, and each iterator should be independent.
func Concat ¶
By connecting two Sequences in series, the new Sequence will iterate over the first Sequence before continuing with the second Sequence.