bimap

package
v1.0.0-preview.20 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 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 an empty, mutable, biMap

func (*BiMap[K, V]) Delete

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

Delete removes a key-value pair from the BiMap for a given key. Returns if the key doesn't exist

func (*BiMap[K, V]) DeleteInverse

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

DeleteInverse removes a key-value pair from the BiMap for a given value. Returns if the value doesn't exist

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(k 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 puts a key and value into the BiMap, and creates the reverse mapping from value to key.

func (*BiMap[K, V]) Size

func (b *BiMap[K, V]) Size() int

Size returns the number of elements in the bimap

Jump to

Keyboard shortcuts

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