collections

package
v0.98.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrObjectNotFound = errors.New("object does not exist")

Functions

func FindFirst added in v0.95.0

func FindFirst[T any](collection []T, condition func(T) bool) (*T, error)

func Map added in v0.95.0

func Map[T any, R any](collection []T, mapper func(T) R) []R

func MergeMaps added in v0.98.0

func MergeMaps[M ~map[K]V, K comparable, V any](src ...M) M

TODO(SNOW-1479870): Test MergeMaps takes any number of maps (of the same type) and concatenates them. In case of key collision, the value will be selected from the map that is provided later in the src function parameter.

Types

type Queue added in v0.95.0

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

func NewQueue added in v0.95.0

func NewQueue[T any]() Queue[T]

func (*Queue[T]) Head added in v0.95.0

func (s *Queue[T]) Head() *T

func (*Queue[T]) Pop added in v0.95.0

func (s *Queue[T]) Pop() *T

func (*Queue[T]) Push added in v0.95.0

func (s *Queue[T]) Push(elem T)

Jump to

Keyboard shortcuts

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