collections

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainMap

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

func NewChainMap

func NewChainMap[K comparable, V any](maps ...*dict.Dict[K, V]) *ChainMap[K, V]

func (*ChainMap[K, V]) Get

func (cm *ChainMap[K, V]) Get(key K) (value V, ok bool)

func (*ChainMap[K, V]) Items

func (cm *ChainMap[K, V]) Items() *dict.Dict[K, V]

func (*ChainMap[K, V]) Maps

func (cm *ChainMap[K, V]) Maps() []*dict.Dict[K, V]

func (*ChainMap[K, V]) NewChild

func (cm *ChainMap[K, V]) NewChild() *ChainMap[K, V]

func (*ChainMap[K, V]) Parent

func (cm *ChainMap[K, V]) Parent() *ChainMap[K, V]

func (*ChainMap[K, V]) Parents

func (cm *ChainMap[K, V]) Parents() []*ChainMap[K, V]

func (*ChainMap[K, V]) Set

func (cm *ChainMap[K, V]) Set(key K, value V) *ChainMap[K, V]

type Counter

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

func MergeCounts

func MergeCounts[T comparable](counters ...*Counter[T]) *Counter[T]

func NewCounter

func NewCounter[T comparable](items arraylist.ArrayList[T], defaultCounts ...int) *Counter[T]

func (*Counter[T]) Clear

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

func (Counter[T]) Copy

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

func (*Counter[T]) Elements

func (c *Counter[T]) Elements() arraylist.ArrayList[T]

func (Counter[T]) Equal

func (c Counter[T]) Equal(another Counter[T]) bool

func (*Counter[T]) Get

func (c *Counter[T]) Get(item T) int

func (*Counter[T]) Increment

func (c *Counter[T]) Increment(item T, counts ...int) *Counter[T]

func (*Counter[T]) LeastCommon

func (c *Counter[T]) LeastCommon() arraylist.ArrayList[T]

func (*Counter[T]) MostCommon

func (c *Counter[T]) MostCommon() arraylist.ArrayList[T]

func (*Counter[T]) Remove

func (c *Counter[T]) Remove(item T) (exist bool)

func (*Counter[T]) Reset

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

func (*Counter[T]) Set

func (c *Counter[T]) Set(item T, count int) *Counter[T]

func (*Counter[T]) SetDefault

func (c *Counter[T]) SetDefault(count int) *Counter[T]

func (*Counter[T]) Subtract

func (c *Counter[T]) Subtract(item T, counts ...int) *Counter[T]

func (*Counter[T]) Total

func (c *Counter[T]) Total() (total int)

type DefaultDict

type DefaultDict[K comparable, V any] struct {
	dict.Dict[K, V]
	// contains filtered or unexported fields
}

func NewDefaultDict

func NewDefaultDict[K comparable, V any](items dict.Dict[K, V], defaultVal V) *DefaultDict[K, V]

func (*DefaultDict[K, V]) Clear

func (d *DefaultDict[K, V]) Clear() *DefaultDict[K, V]

func (DefaultDict[K, V]) Copy

func (d DefaultDict[K, V]) Copy() DefaultDict[K, V]

func (DefaultDict[K, V]) Equal

func (d DefaultDict[K, V]) Equal(another DefaultDict[K, V]) bool

func (*DefaultDict[K, V]) Get

func (d *DefaultDict[K, V]) Get(key K) (value V)

func (DefaultDict[K, V]) MarshalJSON

func (d DefaultDict[K, V]) MarshalJSON() ([]byte, error)

func (*DefaultDict[K, V]) Pop

func (d *DefaultDict[K, V]) Pop(key K) (value V)

func (*DefaultDict[K, V]) Set

func (d *DefaultDict[K, V]) Set(key K, value V) *DefaultDict[K, V]

func (*DefaultDict[K, V]) SetDefault

func (d *DefaultDict[K, V]) SetDefault(value V) *DefaultDict[K, V]

func (DefaultDict[K, V]) String

func (d DefaultDict[K, V]) String() string

func (*DefaultDict[K, V]) UnmarshalJSON

func (d *DefaultDict[K, V]) UnmarshalJSON(data []byte) error

func (*DefaultDict[K, V]) Update

func (d *DefaultDict[K, V]) Update(another DefaultDict[K, V]) *DefaultDict[K, V]

type Stack

type Stack[T any] interface {
	Push(element T) (ok bool)
	Pop() (element T, ok bool)
	Peek() (element T, ok bool)
	Empty() bool
	Full() bool
}

func NewStack

func NewStack[T any](capacity int) Stack[T]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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