bimap

package
v1.0.4-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BiMap

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

BiMap represents a bidirectional map

func NewBiMap

func NewBiMap[K comparable, V comparable]() *BiMap[K, V]

NewBiMap creates a new BiMap

func NewBiMapFromMap

func NewBiMapFromMap[K comparable, V comparable](m map[K]V) *BiMap[K, V]

NewBiMapFromMap NewBiMap creates a new BiMap from a map.

func (*BiMap[K, V]) Delete

func (b *BiMap[K, V]) Delete(key K)

Delete removes a key-value pair

func (*BiMap[K, V]) GetByKey

func (b *BiMap[K, V]) GetByKey(key K) (V, bool)

GetByKey retrieves the value for a given key

func (*BiMap[K, V]) GetByValue

func (b *BiMap[K, V]) GetByValue(value V) (K, bool)

GetByValue retrieves the key for a given value

func (*BiMap[K, V]) GetKeys

func (b *BiMap[K, V]) GetKeys() []K

GetKeys returns all keys of the BiMap

func (*BiMap[K, V]) GetValues

func (b *BiMap[K, V]) GetValues() []V

GetValues returns all the values of the BiMap

func (*BiMap[K, V]) Put

func (b *BiMap[K, V]) Put(key K, value V)

Put adds a key-value pair to the BiMap

Jump to

Keyboard shortcuts

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