Documentation ¶
Index ¶
- type Map
- func (m *Map[K, V]) Clear()
- func (m *Map[K, V]) Delete(key K)
- func (m *Map[K, V]) Keys() []K
- func (m *Map[K, V]) Len() int
- func (m *Map[K, V]) Load(key K) (V, bool)
- func (m *Map[K, V]) Pairs() []Pair[K, V]
- func (m *Map[K, V]) Range(yield func(key K, value V) bool)
- func (m *Map[K, V]) Store(key K, value V)
- func (m *Map[K, V]) Value(key K) V
- func (m *Map[K, V]) Values() []V
- type Pair
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Map ¶
type Map[K comparable, V any] struct { // contains filtered or unexported fields }
Map represents an ordered map.
func NewMap ¶
func NewMap[K comparable, V any](initialData ...Pair[K, V]) *Map[K, V]
NewMap creates a new ordered map with optional initial data.
func (*Map[K, V]) Delete ¶
func (m *Map[K, V]) Delete(key K)
Delete removes a key-value pair from the map.
func (*Map[K, V]) Keys ¶
func (m *Map[K, V]) Keys() []K
Keys returns a slice of all keys in the map in order.
func (*Map[K, V]) Load ¶
Load returns the value associated with the key, and a boolean indicating if the key was found.
func (*Map[K, V]) Range ¶
Range calls the given function for each key-value pair in the map in order.
func (*Map[K, V]) Store ¶
func (m *Map[K, V]) Store(key K, value V)
Store adds or updates a key-value pair in the map.
type Pair ¶
type Pair[K comparable, V any] struct { Key K Value V // contains filtered or unexported fields }
Pair represents a key-value pair in the ordered map.
Click to show internal directories.
Click to hide internal directories.