dict

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: Artistic-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BiDict

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

BiDict is goroutine safe bidirectional map

func NewBiDict

func NewBiDict[K comparable, V comparable]() *BiDict[K, V]

func (*BiDict[K, V]) Clear

func (p *BiDict[K, V]) Clear()

func (*BiDict[K, V]) Clone

func (p *BiDict[K, V]) Clone() (k2v map[K]V, v2k map[V]K)

func (*BiDict[K, V]) DeleteByKey

func (p *BiDict[K, V]) DeleteByKey(key K)

func (*BiDict[K, V]) DeleteByVal

func (p *BiDict[K, V]) DeleteByVal(val V)

func (*BiDict[K, V]) GetByKey

func (p *BiDict[K, V]) GetByKey(key K) (val V, found bool)

func (*BiDict[K, V]) GetByVal

func (p *BiDict[K, V]) GetByVal(val V) (key K, found bool)

func (*BiDict[K, V]) Len

func (p *BiDict[K, V]) Len() int

func (*BiDict[K, V]) Range

func (p *BiDict[K, V]) Range(f func(K, V) bool)

Range iter element of p with f if f return false, then break the range note: do not call any p's function inside f, otherwise will occur deadlock

func (*BiDict[K, V]) Set

func (p *BiDict[K, V]) Set(key K, val V)

type Dict

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

Dict is goroutine safe map

func New

func New[K comparable, V any]() *Dict[K, V]

func (*Dict[K, V]) Clear

func (p *Dict[K, V]) Clear()

func (*Dict[K, V]) Clone

func (p *Dict[K, V]) Clone() (m map[K]V)

func (*Dict[K, V]) Delete

func (p *Dict[K, V]) Delete(key K)

func (*Dict[K, V]) Get

func (p *Dict[K, V]) Get(key K) (val V, found bool)

func (*Dict[K, V]) Len

func (p *Dict[K, V]) Len() int

func (*Dict[K, V]) Range

func (p *Dict[K, V]) Range(f func(K, V) bool)

Range iter element of p with f if f return false, then break the range note: do not call any p's function inside f, otherwise will occur deadlock

func (*Dict[K, V]) Set

func (p *Dict[K, V]) Set(key K, val V)

Jump to

Keyboard shortcuts

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