dict

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dict

type Dict[Tk any, Tv any] interface {
	Clear()
	Len() int
	Del(keys ...Tk)
	Put(k Tk, v Tv)
	Insert(k Tk, v Tv) bool
	Get(k Tk) (v Tv, ok bool)
	Keys() []Tk
	Items() Items[Tk, Tv]
	Iterate(f func(k Tk, v Tv) bool)
	At(k Tk) Tv
	Eq(other Dict[Tk, Tv], valuesEq func(vL, vR Tv) bool) bool
}

Dict abstact interface

type HDict

type HDict[Tk comparable, Tv any] struct {
	// contains filtered or unexported fields
}

HDict hashed dictionary

func (*HDict[Tk, Tv]) At

func (dict *HDict[Tk, Tv]) At(k Tk) Tv

At -

func (*HDict[Tk, Tv]) Clear

func (dict *HDict[Tk, Tv]) Clear()

Clear -

func (*HDict[Tk, Tv]) Del

func (dict *HDict[Tk, Tv]) Del(keys ...Tk)

Del -

func (*HDict[Tk, Tv]) Eq

func (dict *HDict[Tk, Tv]) Eq(other Dict[Tk, Tv], valuesEq func(vL, vR Tv) bool) bool

Eq -

func (*HDict[Tk, Tv]) Get

func (dict *HDict[Tk, Tv]) Get(k Tk) (v Tv, ok bool)

Get -

func (*HDict[Tk, Tv]) Insert

func (dict *HDict[Tk, Tv]) Insert(k Tk, v Tv) bool

Insert -

func (*HDict[Tk, Tv]) Items

func (dict *HDict[Tk, Tv]) Items() Items[Tk, Tv]

Items -

func (*HDict[Tk, Tv]) Iterate

func (dict *HDict[Tk, Tv]) Iterate(f func(k Tk, v Tv) bool)

Iterate -

func (*HDict[Tk, Tv]) Keys

func (dict *HDict[Tk, Tv]) Keys() []Tk

Keys -

func (*HDict[Tk, Tv]) Len

func (dict *HDict[Tk, Tv]) Len() int

Len -

func (*HDict[Tk, Tv]) Put

func (dict *HDict[Tk, Tv]) Put(k Tk, v Tv)

Put -

type HSet

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

func (*HSet) Clear

func (set *HSet) Clear()

Clear -

func (*HSet) Contains

func (set *HSet) Contains(k T) bool

Contains -

func (*HSet) Del

func (set *HSet) Del(keys ...T)

Del -

func (*HSet) Eq

func (set *HSet) Eq(other Set[T]) bool

Eq -

func (*HSet) Insert

func (set *HSet) Insert(k T) bool

Insert -

func (*HSet) Iterate

func (set *HSet) Iterate(f func(k T) bool)

Iterate -

func (*HSet) Len

func (set *HSet) Len() int

Len -

func (*HSet) Put

func (set *HSet) Put(k T)

Put -

func (*HSet) PutMany

func (set *HSet) PutMany(vals ...T)

PutMany -

func (*HSet) Values

func (set *HSet) Values() []T

Values -

type Items

type Items[K any, V any] []KV[K, V]

Items -

func (*Items[K, V]) Add

func (i *Items[K, V]) Add(k K, v V) *Items[K, V]

Add -

func (*Items[K, V]) Reserve

func (i *Items[K, V]) Reserve(n int)

Reserve -

type KV

type KV[K any, V any] struct {
	K K
	V V
}

KV -

type RBDict

type RBDict[Tk any, Tv any] struct {
	// contains filtered or unexported fields
}

RBDict red-black tree; type key 'Tk' should be Ordered or cmpOps[Tk] interface

func (*RBDict[Tk, Tv]) At

func (dict *RBDict[Tk, Tv]) At(k Tk) Tv

At -

func (*RBDict[Tk, Tv]) Clear

func (dict *RBDict[Tk, Tv]) Clear()

Clear -

func (*RBDict[Tk, Tv]) Del

func (dict *RBDict[Tk, Tv]) Del(keys ...Tk)

Del -

func (*RBDict[Tk, Tv]) Eq

func (dict *RBDict[Tk, Tv]) Eq(other Dict[Tk, Tv], valuesEq func(vL, vR Tv) bool) bool

Eq -

func (*RBDict[Tk, Tv]) Get

func (dict *RBDict[Tk, Tv]) Get(k Tk) (v Tv, ok bool)

Get -

func (*RBDict[Tk, Tv]) Insert

func (dict *RBDict[Tk, Tv]) Insert(k Tk, v Tv) bool

Insert -

func (*RBDict[Tk, Tv]) Items

func (dict *RBDict[Tk, Tv]) Items() Items[Tk, Tv]

Items -

func (*RBDict[Tk, Tv]) Iterate

func (dict *RBDict[Tk, Tv]) Iterate(f func(k Tk, v Tv) bool)

Iterate -

func (*RBDict[Tk, Tv]) Keys

func (dict *RBDict[Tk, Tv]) Keys() []Tk

Keys -

func (*RBDict[Tk, Tv]) Len

func (dict *RBDict[Tk, Tv]) Len() int

Len -

func (*RBDict[Tk, Tv]) Put

func (dict *RBDict[Tk, Tv]) Put(k Tk, v Tv)

Put -

type RBSet

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

func (*RBSet) Clear

func (set *RBSet) Clear()

Clear -

func (*RBSet) Contains

func (set *RBSet) Contains(k T) bool

Contains -

func (*RBSet) Del

func (set *RBSet) Del(keys ...T)

Del -

func (*RBSet) Eq

func (set *RBSet) Eq(other Set[T]) bool

Eq -

func (*RBSet) Insert

func (set *RBSet) Insert(k T) bool

Insert -

func (*RBSet) Iterate

func (set *RBSet) Iterate(f func(k T) bool)

Iterate -

func (*RBSet) Len

func (set *RBSet) Len() int

Len -

func (*RBSet) Put

func (set *RBSet) Put(k T)

Put -

func (*RBSet) PutMany

func (set *RBSet) PutMany(vals ...T)

PutMany -

func (*RBSet) Values

func (set *RBSet) Values() []T

Values -

type Set

type Set[T any] interface {
	Clear()
	Len() int
	Del(keys ...T)
	Put(k T)
	PutMany(vals ...T)
	Insert(k T) bool
	Contains(k T) bool
	Iterate(f func(k T) bool)
	Values() []T
	Eq(Set[T]) bool
}

Set -

type StringCiKey

type StringCiKey string

StringCiKey - compare no case string key

func (StringCiKey) Cmp

func (a StringCiKey) Cmp(b StringCiKey) int

Cmp -

Jump to

Keyboard shortcuts

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