iter

package
v0.0.0-...-10654a8 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Absent

func Absent[T any](iter hie.Iter[T], predicate Predicate[T]) bool

Absent returns true if the predicate returns false for all the elements in the collection or if the collection is empty

func All

func All[T any](iter hie.Iter[T], predicate Predicate[T]) bool

All returns true if the predicate returns true for all of the elements in the collection or if the collection is empty.

func Clone

func Clone[T any](i hie.Iter[T]) (hie.Iter[T], bool)

func Cloned

func Cloned[T hie.Clonable[T]](in hie.Iter[T]) hie.Iter[T]

func Close

func Close[T any](i hie.Iter[T]) error

func CloseAll

func CloseAll[T io.Closer](in hie.Iter[T]) error

func Collect

func Collect[T any](iter hie.Iter[T]) []T

func Concat

func Concat[T any](left hie.Iter[T], right hie.Iter[T], others ...hie.Iter[T]) hie.Iter[T]

func Contains

func Contains[T comparable](iter hie.Iter[T], elem T) bool

Contains returns true if an element is present in the collection

func Difference

func Difference[T comparable](first hie.Iter[T], second hie.Iter[T]) hie.Iter[T]

Difference returns the difference between two collections. The returned slice are the elements that are in the first collection but not in the second

func Empty

func Empty[T any]() hie.Iter[T]

func Exists

func Exists[T any](iter hie.Iter[T], predicate Predicate[T]) bool

Exists returns true if predicate function return true.

func Filter

func Filter[T any](iter hie.Iter[T], predicate Predicate[T]) hie.Iter[T]

func FilterMap

func FilterMap[T, R any](iter hie.Iter[T], fn FilterMapper[T, R]) hie.Iter[R]

func Find

func Find[T any](iter hie.Iter[T], predicate Predicate[T]) opt.Option[T]

Find returns the first match in the iterator, or none if it can't be found

func First

func First[T any](iter hie.Iter[T]) opt.Option[T]

func FlatMap

func FlatMap[T, R any](iter hie.Iter[T], fn FlatMapper[T, R]) hie.Iter[R]

func Flatten

func Flatten[T any](iter hie.Iter[hie.Iter[T]]) hie.Iter[T]

func Fold

func Fold[A, T any](iter hie.Iter[T], initialValue A, folder AccumulatorLeft[A, T]) A

func ForEach

func ForEach[T any](iter hie.Iter[T], fn hie.Iterator[T])

func Intersect

func Intersect[T comparable](first hie.Iter[T], second hie.Iter[T]) hie.Iter[T]

Intersect returns the intersection between two collections.

func IsClonable

func IsClonable[T any](i hie.Iter[T]) bool

func IsClosable

func IsClosable[T any](i hie.Iter[T]) bool

func IsDisjoint

func IsDisjoint[T comparable](iter hie.Iter[T], other hie.Iter[T]) bool

IsDisjoint returns true if none of the elements of the subset set are contained by the superset

func IsSubset

func IsSubset[T comparable](iter hie.Iter[T], subset hie.Iter[T]) bool

IsSubset returns true if all elements of a subset are contained into a collection or if the subset is empty.

func Map

func Map[T, R any](iter hie.Iter[T], fn Mapper[T, R]) hie.Iter[R]

func SymmetricDifference

func SymmetricDifference[T comparable](first hie.Iter[T], second hie.Iter[T]) hie.Iter[T]

SymmetricDifference removes the overlap between the 2 collections The returned slice are the elements that are in either the first or the second collection, but not in both

func TakeN

func TakeN[T any](iter hie.Iter[T], n int) hie.Iter[T]

func Union

func Union[T comparable](left hie.Iter[T], right hie.Iter[T], others ...hie.Iter[T]) hie.Iter[T]

Union returns all distinct elements from given collections. result returns will not change the order of elements relatively.

Types

type AccumulatorLeft

type AccumulatorLeft[A, T any] func(A, T) (A, bool)

type FilterMapper

type FilterMapper[T, R any] func(T) (R, bool)

type FlatMapper

type FlatMapper[T, R any] func(T) hie.Iter[R]

type Mapper

type Mapper[T, R any] func(T) R

type Predicate

type Predicate[T any] func(T) bool

Jump to

Keyboard shortcuts

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