stream

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package stream provides helper functions for transforming a slice to a stream

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert[FS ~[]From, From, To any](elements FS, by func(From) To) stream.Iter[To]

Convert returns a stream that applies the 'converter' function to the 'elements' slice

func Filter

func Filter[TS ~[]T, T any](elements TS, filter func(T) bool) stream.Iter[T]

Filter instantiates a stream that checks elements by the 'filter' function and returns successful ones

func FilterAndConvert

func FilterAndConvert[FS ~[]From, From, To any](elements FS, filter func(From) bool, converter func(From) To) stream.Iter[To]

FilterAndConvert returns a stream that filters source elements and converts them

func FilterAndFlatt

func FilterAndFlatt[FS ~[]From, From, To any](elements FS, filter func(From) bool, flattener func(From) []To) stream.Iter[To]

FilterAndFlatt filters source elements and extracts slices of 'To' by the 'flattener' function

func Flatt

func Flatt[FS ~[]From, From, To any](elements FS, by func(From) []To) stream.Iter[To]

Flatt returns a stream that converts the collection elements into slices and then flattens them to one level

func NotNil

func NotNil[T any, TRS ~[]*T](elements TRS) stream.Iter[*T]

NotNil instantiates a stream that filters nullable elements

Types

This section is empty.

Jump to

Keyboard shortcuts

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