collection

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

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

func NewMap

func NewMap[T any]() *Map[T]

func (*Map[T]) Delete

func (m *Map[T]) Delete(key string)

func (*Map[T]) Get

func (m *Map[T]) Get(key string) (val T, ok bool)

func (*Map[T]) GetAndUpdate added in v1.2.0

func (m *Map[T]) GetAndUpdate(key string, update func(old T, found bool) T) (val T)

func (*Map[T]) Len

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

func (*Map[T]) Put

func (m *Map[T]) Put(key string, val T)

type Set

type Set[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewSet

func NewSet[K comparable, V any]() *Set[K, V]

func (*Set[K, V]) Contains

func (s *Set[K, V]) Contains(key K) bool

func (*Set[K, V]) Get

func (s *Set[K, V]) Get(key K) (val V, ok bool)

func (*Set[K, V]) Iterate

func (s *Set[K, V]) Iterate(fn func(key K, val V) bool)

func (*Set[K, V]) Len added in v1.2.0

func (s *Set[K, V]) Len() int

func (*Set[K, V]) Put

func (s *Set[K, V]) Put(key K, val V)

func (*Set[K, V]) Random

func (s *Set[K, V]) Random() (V, bool)

func (*Set[K, V]) Remove

func (s *Set[K, V]) Remove(key K) (remaining int)

type Slice

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

func NewSlice

func NewSlice[T any]() *Slice[T]

func (*Slice[T]) Delete

func (s *Slice[T]) Delete(i int)

func (*Slice[T]) Get

func (s *Slice[T]) Get(i int) (val T, ok bool)

func (*Slice[T]) Index

func (s *Slice[T]) Index(fn func(item T) bool) int

func (*Slice[T]) Len

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

func (*Slice[T]) Put

func (s *Slice[T]) Put(val T)

type Trie

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

func NewTrie

func NewTrie[T any]() *Trie[T]

func (*Trie[T]) Get

func (t *Trie[T]) Get(key []rune) (found T, ok bool)

func (*Trie[T]) Put

func (t *Trie[T]) Put(key []rune, val T)

Jump to

Keyboard shortcuts

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