Documentation
¶
Overview ¶
Package bimap provides a threadsafe bidirectional map
Index ¶
- type BiMap
- func (b *BiMap) Delete(k interface{})
- func (b *BiMap) DeleteInverse(v interface{})
- func (b *BiMap) Exists(k interface{}) bool
- func (b *BiMap) ExistsInverse(k interface{}) bool
- func (b *BiMap) Get(k interface{}) (interface{}, bool)
- func (b *BiMap) GetForwardMap() map[interface{}]interface{}
- func (b *BiMap) GetInverse(v interface{}) (interface{}, bool)
- func (b *BiMap) GetInverseMap() map[interface{}]interface{}
- func (b *BiMap) Insert(k interface{}, v interface{})
- func (b *BiMap) Lock()
- func (b *BiMap) MakeImmutable()
- func (b *BiMap) Size() int
- func (b *BiMap) Unlock()
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BiMap ¶
type BiMap struct {
Value
// contains filtered or unexported fields
}
BiMapSafe is a BiMap, is thread safe and supports immutability
func (*BiMap) Delete ¶
func (b *BiMap) Delete(k interface{})
Delete removes a key-value pair from the BiMap for a given key. Returns if the key doesn't exist
func (*BiMap) DeleteInverse ¶
func (b *BiMap) DeleteInverse(v interface{})
DeleteInverse emoves a key-value pair from the BiMap for a given value. Returns if the value doesn't exist
func (*BiMap) ExistsInverse ¶
ExistsInverse checks whether or not a value exists in the BiMap
func (*BiMap) Get ¶
Get returns the value for a given key in the BiMap and whether or not the element was present.
func (*BiMap) GetForwardMap ¶
func (b *BiMap) GetForwardMap() map[interface{}]interface{}
GetForwardMap returns a regular go map mapping from the BiMap's keys to its values
func (*BiMap) GetInverse ¶
GetInverse returns the key for a given value in the BiMap and whether or not the element was present.
func (*BiMap) GetInverseMap ¶
func (b *BiMap) GetInverseMap() map[interface{}]interface{}
GetInverseMap returns a regular go map mapping from the BiMap's values to its keys
func (*BiMap) Insert ¶
func (b *BiMap) Insert(k interface{}, v interface{})
Insert puts a key and value into the BiMap, provided its mutable. Also creates the reverse mapping from value to key.
func (*BiMap) MakeImmutable ¶
func (b *BiMap) MakeImmutable()
MakeImmutable freezes the BiMap preventing any further write actions from taking place