Documentation
¶
Index ¶
- type Collector
- type Stream
- func (s *Stream[T]) Collect() []T
- func (s *Stream[T]) CollectToMap(mapper func(*T) (any, any)) map[any]any
- func (s *Stream[T]) Filter(predicate func(*T) bool) *Stream[T]
- func (s *Stream[T]) FilterOut(predicate func(*T) bool) *Stream[T]
- func (s *Stream[T]) Map(mapper func(*T) any) *TerminalStream[any]
- func (s *Stream[T]) ToTerminal() *TerminalStream[T]
- type TerminalStream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Stream ¶
type Stream[T any] struct { // contains filtered or unexported fields }
func (*Stream[T]) CollectToMap ¶
CollectToMap uses the uarray.ToMultiMap function to collect elements of the Stream into a map.
func (*Stream[T]) Map ¶
func (s *Stream[T]) Map(mapper func(*T) any) *TerminalStream[any]
Map wraps the uarray.Map function in the stream API. This operation can only be the last in a pipeline.
func (*Stream[T]) ToTerminal ¶
func (s *Stream[T]) ToTerminal() *TerminalStream[T]
type TerminalStream ¶
type TerminalStream[T any] struct { // contains filtered or unexported fields }
TerminalStream represents a stream that can only be collected.
func NewTerminalStream ¶
func NewTerminalStream[T any](values []T) *TerminalStream[T]
func (*TerminalStream[T]) Collect ¶
func (s *TerminalStream[T]) Collect() []T
func (*TerminalStream[T]) CollectToMap ¶
func (s *TerminalStream[T]) CollectToMap(mapper func(*T) (any, T)) map[any][]T
CollectToMap uses the uarray.ToMultiMap function to collect elements of the Stream into a map.
func (*TerminalStream[T]) ParallelExecute ¶
func (s *TerminalStream[T]) ParallelExecute(fn func(int, *T), parallelism int)
ParallelExecute executes the given function concurrently on each element of the stream's values using the specified level of parallelism.