bimap

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 License: MIT Imports: 0 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
}

func NewBiMap

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

NewBiMap returns a new empty, mutable BiMap.

func NewBiMapFromMap

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

NewBiMapFromMap returns a new BiMap from a map[K, V].

func (*BiMap[K, V]) Exists

func (b *BiMap[K, V]) Exists(k K) bool

Exists checks whether or not a key exists in the BiMap.

func (*BiMap[K, V]) ExistsInverse

func (b *BiMap[K, V]) ExistsInverse(v V) bool

ExistsInverse checks whether or not a value exists in the BiMap.

func (*BiMap[K, V]) Get

func (b *BiMap[K, V]) Get(k K) (V, bool)

Get returns the value for a given key in the BiMap and whether or not the element was present.

func (*BiMap[K, V]) GetInverse

func (b *BiMap[K, V]) GetInverse(v V) (K, bool)

GetInverse returns the key for a given value in the BiMap and whether or not the element was present.

func (*BiMap[K, V]) Insert

func (b *BiMap[K, V]) Insert(k K, v V)

Insert inserts a key and value into the BiMap, provided its mutable. Also creates the reverse mapping from value to key.

Jump to

Keyboard shortcuts

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