Documentation
¶
Index ¶
- type BiMap
- func (m *BiMap[K, V]) Delete(k K)
- func (m *BiMap[K, V]) DeleteBackwards(v V)
- func (m *BiMap[K, V]) Exists(k K) bool
- func (m *BiMap[K, V]) ExistsBackwards(v V) bool
- func (m *BiMap[K, V]) Get(k K) (V, bool)
- func (m *BiMap[K, V]) GetBackwards(v V) (K, bool)
- func (m *BiMap[K, V]) Insert(k K, v V)
- func (m *BiMap[K, V]) Size() int
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 a bi-directional map which is safe to use concurently.
func NewFromMap ¶
func NewFromMap[K comparable, V comparable](values map[K]V) *BiMap[K, V]
NewFromMap creates a new BiMap from a normal map.
func (*BiMap[K, V]) Delete ¶
func (m *BiMap[K, V]) Delete(k K)
Delete removes an element from the map by key in the forward direction.
func (*BiMap[K, V]) DeleteBackwards ¶
func (m *BiMap[K, V]) DeleteBackwards(v V)
DeleteBackwards deltes an element from the map by key in the backward direction.
func (*BiMap[K, V]) ExistsBackwards ¶
ExistsBackwards checks if an element exists in backward direction.
func (*BiMap[K, V]) GetBackwards ¶
GetBackwards returns an element form the map in backward direction if exists.
Click to show internal directories.
Click to hide internal directories.