counter

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

type Counter[A any] struct {
	AddN           func(A, int) int
	RemoveN        func(A, int) int
	Get            func(A) int
	Len            func() int
	ToSlice        func() []*base.Pair[A, int]
	Union          func(*Counter[A]) *Counter[A]
	Intersect      func(*Counter[A]) *Counter[A]
	Difference     func(*Counter[A]) *Counter[A]
	Iterator       func() iterable.Iterator[*base.Pair[A, int]]
	KeysIterator   func() iterable.Iterator[A]
	CountsIterator func() iterable.Iterator[int]
}

func FromSlice added in v0.2.3

func FromSlice[A comparable](elems []*base.Pair[A, int]) *Counter[A]

func FromSliceBy added in v0.2.3

func FromSliceBy[A any, K comparable](projection func(A) K, elems []*base.Pair[A, int]) *Counter[A]

func NewCounter

func NewCounter[A comparable](elems iterable.Iterable[*base.Pair[A, int]]) *Counter[A]

func NewCounterBy added in v0.2.3

func NewCounterBy[A any, K comparable](projection func(A) K, initialElements iterable.Iterable[*base.Pair[A, int]]) *Counter[A]

func (*Counter[A]) Add

func (c *Counter[A]) Add(a A) int

func (*Counter[A]) Remove

func (c *Counter[A]) Remove(a A) int

Jump to

Keyboard shortcuts

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