slices

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Flatten

func Flatten[E any](s [][]E) []E

Flatten flattens a 2D slice into a 1D slice by merging all inner slices.

Types

type WeightedSlice

type WeightedSlice[O any, W cmp.Ordered] struct {
	// contains filtered or unexported fields
}

func NewWeightedSlice

func NewWeightedSlice[O any, W cmp.Ordered](objects []O, weights []W) *WeightedSlice[O, W]

func (*WeightedSlice[O, W]) Append

func (s *WeightedSlice[O, W]) Append(object O, weight W)

func (*WeightedSlice[O, W]) Len

func (s *WeightedSlice[O, W]) Len() int

func (*WeightedSlice[O, W]) Less

func (s *WeightedSlice[O, W]) Less(i int, j int) bool

func (*WeightedSlice[O, W]) Slice

func (s *WeightedSlice[O, W]) Slice() []O

func (*WeightedSlice[O, W]) SortFunc

func (s *WeightedSlice[O, W]) SortFunc(sortFn func(p sort.Interface)) *WeightedSlice[O, W]

func (*WeightedSlice[O, W]) Swap

func (s *WeightedSlice[O, W]) Swap(i int, j int)

Jump to

Keyboard shortcuts

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