gstream

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package gstream Author: hyphen Copyright 2023 hyphen. All rights reserved. Create-time: 2023/12/21

Package gstream Author: hyphen Copyright 2023 hyphen. All rights reserved. Create-time: 2023/12/11

Package gstream Author: hyphen Copyright 2023 hyphen. All rights reserved. Create-time: 2023/12/11

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MapStream

type MapStream[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func AsMapStream

func AsMapStream[K comparable, V any, M ~map[K]V](m M) *MapStream[K, V]

func ToMapStream

func ToMapStream[K comparable, T, V any](s *SliceStream[T], fc func(T) (K, V)) *MapStream[K, V]

func ToOtherMapStream

func ToOtherMapStream[K1, K2 comparable, V1, V2 any](m *MapStream[K1, V1], fc func(K1, V1) (K2, V2)) *MapStream[K2, V2]

func (*MapStream[K, V]) Collect

func (m *MapStream[K, V]) Collect() map[K]V

func (*MapStream[K, V]) Convert

func (m *MapStream[K, V]) Convert(fc func(K, V) (K, V)) *MapStream[K, V]

func (*MapStream[K, V]) Filter

func (m *MapStream[K, V]) Filter(fc func(K, V) bool) *MapStream[K, V]

func (*MapStream[K, V]) ForEach

func (m *MapStream[K, V]) ForEach(fc func(K, V)) *MapStream[K, V]

func (*MapStream[K, V]) Limit

func (m *MapStream[K, V]) Limit(n int) *MapStream[K, V]

type SliceStream

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

func AsSliceStream

func AsSliceStream[T any](s []T) *SliceStream[T]

func ToOtherSliceStream

func ToOtherSliceStream[T1, T2 any](s *SliceStream[T1], fc func(T1) T2) *SliceStream[T2]

func ToSliceStream

func ToSliceStream[K comparable, T, V any](m *MapStream[K, V], fc func(K, V) T) *SliceStream[T]

func (*SliceStream[T]) Collect

func (s *SliceStream[T]) Collect() []T

func (*SliceStream[T]) Convert

func (s *SliceStream[T]) Convert(fc func(T) T) *SliceStream[T]

Convert AKA: Map

func (*SliceStream[T]) Count

func (s *SliceStream[T]) Count() int

func (*SliceStream[T]) Filter

func (s *SliceStream[T]) Filter(fc func(T) bool) *SliceStream[T]

func (*SliceStream[T]) ForEach

func (s *SliceStream[T]) ForEach(fc func(T)) *SliceStream[T]

func (*SliceStream[T]) Map

func (s *SliceStream[T]) Map(fc func(T) T) *SliceStream[T]

Map an alias of [Convert]

func (*SliceStream[T]) Sort

func (s *SliceStream[T]) Sort(less func(t1, t2 T) bool) *SliceStream[T]

Jump to

Keyboard shortcuts

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