slicesext

package
v0.1.40 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapKeysToSlice

func MapKeysToSlice[K comparable, V any](m map[K]V) []K

MapKeysToSlice converts the map's keys to a slice.

func MapKeysToSortedSlice

func MapKeysToSortedSlice[M ~map[K]V, K cmp.Ordered, V any](m M) []K

MapKeysToSortedSlice converts the map's keys to a sorted slice.

func ToStructMap

func ToStructMap[T comparable](s []T) map[T]struct{}

ToStructMap converts the slice to a map with struct{} values.

Types

type Slice

type Slice[T any] []T

func (*Slice[T]) Clone

func (s *Slice[T]) Clone() *Slice[T]

func (*Slice[T]) Filter

func (s *Slice[T]) Filter(fn func(T) bool) *Slice[T]

func (*Slice[T]) Find

func (s *Slice[T]) Find(fn func(T) bool) (res T, ok bool)

func (*Slice[T]) Len

func (s *Slice[T]) Len() int

func (*Slice[T]) Pop

func (s *Slice[T]) Pop() (res T)

func (*Slice[T]) Push

func (s *Slice[T]) Push(v T)

func (*Slice[T]) Traverse

func (s *Slice[T]) Traverse(fn func(int, T))

Jump to

Keyboard shortcuts

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