collections

package
v0.0.0-...-f68c1a0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: MIT Imports: 3 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[T comparable] struct {
	// contains filtered or unexported fields
}

Counter is a map of values to their counts.

func NewCounter

func NewCounter[T comparable]() *Counter[T]

func (*Counter[T]) Add

func (c *Counter[T]) Add(value T)

func (*Counter[T]) AddAll

func (c *Counter[T]) AddAll(values ...T)

func (*Counter[T]) Clear

func (c *Counter[T]) Clear()

func (*Counter[T]) Copy

func (c *Counter[T]) Copy() *Counter[T]

func (*Counter[T]) Delete

func (c *Counter[T]) Delete(value T)

func (*Counter[T]) Get

func (c *Counter[T]) Get(value T) int64

func (*Counter[T]) Items

func (c *Counter[T]) Items() map[T]int64

func (*Counter[T]) Keys

func (c *Counter[T]) Keys() iter.Seq[T]

func (*Counter[T]) LeastCommon

func (c *Counter[T]) LeastCommon(n int) iter.Seq2[T, int64]

func (*Counter[T]) Len

func (c *Counter[T]) Len() int

func (*Counter[T]) MostCommon

func (c *Counter[T]) MostCommon(n int) iter.Seq2[T, int64]

func (*Counter[T]) Sorted

func (c *Counter[T]) Sorted() []T

func (*Counter[T]) Subtract

func (c *Counter[T]) Subtract(other *Counter[T])

func (*Counter[T]) Update

func (c *Counter[T]) Update(other *Counter[T])

type Set

type Set[T comparable] struct {
	// contains filtered or unexported fields
}

Set is a collection of unique items.

func NewSet

func NewSet[T comparable]() *Set[T]

func NewSetFromSlice

func NewSetFromSlice[T comparable](items []T) *Set[T]

func (*Set[T]) Add

func (s *Set[T]) Add(items ...T)

func (*Set[T]) Clear

func (s *Set[T]) Clear()

func (*Set[T]) Contains

func (s *Set[T]) Contains(item T) bool

func (*Set[T]) Difference

func (s *Set[T]) Difference(other *Set[T]) *Set[T]

func (*Set[T]) Intersection

func (s *Set[T]) Intersection(other *Set[T]) *Set[T]

func (*Set[T]) IsDisjoint

func (s *Set[T]) IsDisjoint(other *Set[T]) bool

func (*Set[T]) IsEmpty

func (s *Set[T]) IsEmpty() bool

func (*Set[T]) IsSubset

func (s *Set[T]) IsSubset(other *Set[T]) bool

func (*Set[T]) IsSuperset

func (s *Set[T]) IsSuperset(other *Set[T]) bool

func (*Set[T]) Len

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

func (*Set[T]) Remove

func (s *Set[T]) Remove(items ...T)

func (*Set[T]) ToSeq

func (s *Set[T]) ToSeq() iter.Seq[T]

func (*Set[T]) ToSlice

func (s *Set[T]) ToSlice() []T

func (*Set[T]) Union

func (s *Set[T]) Union(other *Set[T]) *Set[T]

Jump to

Keyboard shortcuts

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