Documentation ¶
Index ¶
- type BiMap
- func (m *BiMap[K, V]) DeleteKey(key K) (V, bool)
- func (m *BiMap[K, V]) DeleteValue(val V) (K, bool)
- func (m *BiMap[K, V]) GetKey(val V) (K, bool)
- func (m *BiMap[K, V]) GetValue(key K) (V, bool)
- func (m *BiMap[K, _]) HasKey(key K) bool
- func (m *BiMap[_, V]) HasValue(val V) bool
- func (m *BiMap[K, _]) Keys() []K
- func (m *BiMap[K, V]) Len() int
- func (m *BiMap[K, V]) MarshalJSON() ([]byte, error)
- func (m *BiMap[K, V]) Put(key K, val V) []Entry[K, V]
- func (m *BiMap[K, V]) UnmarshalJSON(b []byte) error
- func (m *BiMap[_, V]) Values() []V
- type Entry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BiMap ¶
type BiMap[K, V comparable] struct { // contains filtered or unexported fields }
BiMap is a bi-directional map.
func (*BiMap[K, V]) DeleteKey ¶
DeleteKey removes [key] from the map and returns the value it mapped to.
func (*BiMap[K, V]) DeleteValue ¶
DeleteValue removes [val] from the map and returns the key that mapped to it.
func (*BiMap[K, _]) Keys ¶ added in v1.11.0
func (m *BiMap[K, _]) Keys() []K
Keys returns the keys of the map. The keys will be in an indeterminate order.
func (*BiMap[K, V]) MarshalJSON ¶ added in v1.10.18
func (*BiMap[K, V]) Put ¶
Put the key value pair into the map. If either [key] or [val] was previously in the map, the previous entries will be removed and returned.
Note: Unlike normal maps, it's possible that Put removes 0, 1, or 2 existing entries to ensure that mappings are one-to-one.
func (*BiMap[K, V]) UnmarshalJSON ¶ added in v1.10.18
Click to show internal directories.
Click to hide internal directories.