Documentation ¶
Index ¶
- func Average[T comparable, N constraints.Integer | constraints.Float](lst Goalist[T], averageFunc func(x T) N) *N
- func Max[T comparable, N constraints.Ordered](lst Goalist[T], maxFunc func(x T) N) *N
- func Min[T comparable, N constraints.Ordered](lst Goalist[T], minFunc func(x T) N) *N
- func Sum[T comparable, N constraints.Integer | constraints.Float | constraints.Complex](lst Goalist[T], sumFunc func(x T) N) *N
- type Goalist
- func (l *Goalist[T]) Add(item T)
- func (l *Goalist[T]) AddRange(lst Goalist[T])
- func (l Goalist[T]) All(predicate func(x T) bool) bool
- func (l Goalist[T]) Any(predicate func(x T) bool) bool
- func (l *Goalist[T]) Clear()
- func (l Goalist[T]) Contains(item T) bool
- func (l Goalist[T]) Count(predicate func(x T) bool) int
- func (l Goalist[T]) Distinct() Goalist[T]
- func (l Goalist[T]) Except(exceptList Goalist[T]) Goalist[T]
- func (l Goalist[T]) First(predicate func(x T) bool) *T
- func (l Goalist[T]) ForEach(function func(x T))
- func (l Goalist[T]) GetEnumerator() func() *T
- func (l Goalist[T]) GoForEach(function func(x T))
- func (l Goalist[T]) IndexOf(value T) *int
- func (l *Goalist[T]) Insert(index int, value T)
- func (l Goalist[T]) Intersect(intersectList Goalist[T]) Goalist[T]
- func (l *Goalist[T]) Order(predicate func(a, b T) int)
- func (l *Goalist[T]) Remove(predicate func(x T) bool)
- func (l *Goalist[T]) RemoveAt(index int)
- func (l *Goalist[T]) Reverse()
- func (l Goalist[T]) SkipWhile(predicate func(x T) bool) Goalist[T]
- func (l Goalist[T]) TakeWhile(predicate func(x T) bool) Goalist[T]
- func (l Goalist[T]) Union(unionList Goalist[T]) Goalist[T]
- func (l Goalist[T]) Where(predicate func(x T) bool) Goalist[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Average ¶ added in v0.1.7
func Average[T comparable, N constraints.Integer | constraints.Float](lst Goalist[T], averageFunc func(x T) N) *N
func Max ¶ added in v0.1.7
func Max[T comparable, N constraints.Ordered](lst Goalist[T], maxFunc func(x T) N) *N
func Min ¶ added in v0.1.7
func Min[T comparable, N constraints.Ordered](lst Goalist[T], minFunc func(x T) N) *N
func Sum ¶ added in v0.1.7
func Sum[T comparable, N constraints.Integer | constraints.Float | constraints.Complex](lst Goalist[T], sumFunc func(x T) N) *N
Types ¶
type Goalist ¶
type Goalist[T comparable] []T
func (Goalist[T]) ForEach ¶
func (l Goalist[T]) ForEach(function func(x T))
Iterate over the goalist and call the function from parameter on each one
func (Goalist[T]) GoForEach ¶ added in v0.1.6
func (l Goalist[T]) GoForEach(function func(x T))
Iterate over the goalist and call the function from parameter on each one
func (Goalist[T]) IndexOf ¶
Returns index of first item If the item is not in the goalist, then returns nil
func (Goalist[T]) Intersect ¶
Return items that are in both actual Goalist and Goalist from parameter
func (*Goalist[T]) Order ¶
Order golist Return values of predicate 1, 0, -1 > 0 sort a after b < osort a before b 0 keep original order of a and b
func (*Goalist[T]) Remove ¶
Remove element according to predicate numbers := goalist.Goalist[int]{1, 2 } numbers.Remove(func(x int) bool { return x == 1 }) will mutate list and remove 1
func (*Goalist[T]) Reverse ¶
func (l *Goalist[T]) Reverse()
Reverse list reversing goalist.Goalist[int]{1, 2, 3, 4, 5} will result to goalist.Goalist[int]{5, 4, 3, 2, 1}