stream

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Distinct

func Distinct[T comparable]() func(T) bool

func DistinctBy

func DistinctBy[T any, B comparable](extractor func(T) B) func(T) bool

func ExtractVal1

func ExtractVal1[A, B any]() func(Pair[A, B]) A

func ExtractVal2

func ExtractVal2[A, B any]() func(Pair[A, B]) B

func IsEmpty

func IsEmpty[T emtyable](t T) bool

func IsNotEmpty

func IsNotEmpty[T emtyable](t T) bool

func NonNil

func NonNil[T any]() func(v T) bool

func NonNilPair

func NonNilPair[A, B any]() func(Pair[A, B]) bool

Types

type Pair

type Pair[A, B any] struct {
	Val1 A
	Val2 B
}

type Stream

type Stream[T any] struct {
	// contains filtered or unexported fields
}

func FlatMap

func FlatMap[T, E any](s Stream[T], f func(T) []E) Stream[E]

func Map

func Map[T, E any](s Stream[T], f func(T) E) Stream[E]

func MapPair

func MapPair[T, E any](s Stream[T], f func(T) E) Stream[Pair[T, E]]

func OfMap

func OfMap[K comparable, V any](m map[K]V) Stream[Pair[K, V]]

func OfSlice

func OfSlice[T any](v []T) Stream[T]

func (Stream[T]) Filter

func (s Stream[T]) Filter(f func(T) bool) Stream[T]

func (Stream[T]) FlatMap

func (s Stream[T]) FlatMap(f func(T) []T) Stream[T]

func (Stream[T]) Map

func (s Stream[T]) Map(f func(T) T) Stream[T]

func (Stream[T]) One

func (s Stream[T]) One() T

func (Stream[T]) Range

func (s Stream[T]) Range(f func(T))

func (Stream[T]) RangeErr

func (s Stream[T]) RangeErr(f func(T) error) error

func (Stream[T]) ToSlice

func (s Stream[T]) ToSlice() []T

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL