Documentation
¶
Index ¶
- type Map
- func (m *Map[K, V]) All() iter.Seq2[K, V]
- func (m *Map[K, V]) Clear()
- func (m *Map[K, V]) Clone() *Map[K, V]
- func (m *Map[K, V]) Delete(k K) bool
- func (m *Map[K, V]) First() (K, V, bool)
- func (m *Map[K, V]) Get(k K) (V, bool)
- func (m *Map[K, V]) Has(k K) bool
- func (m *Map[K, V]) Keys() []K
- func (m *Map[K, V]) Len() int
- func (m *Map[K, V]) Set(k K, v V)
- func (m *Map[K, V]) Values() []V
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 }
Key to value mapping that remembers the order keys were first stored in; storing an existing key keeps its place, deleting it forgets the place, a nil *Map reads as empty and the zero Map is ready to use
func Merge ¶
func Merge[K comparable, V any](maps ...*Map[K, V]) *Map[K, V]
New map of the inputs' pairs taken left to right, a later value for a key replacing the earlier one in its first place; nil inputs read as empty
func (*Map[K, V]) All ¶
Key value pairs in insertion order; the loop body may change the map, pairs it deletes before they are reached are skipped and pairs it adds come last
func (*Map[K, V]) Clear ¶
func (m *Map[K, V]) Clear()
Removes every key, the map keeping its identity for everyone holding it
func (*Map[K, V]) First ¶
Earliest stored key still present and its value, false when the map is empty
func (*Map[K, V]) Keys ¶
func (m *Map[K, V]) Keys() []K
Every key in insertion order as a new slice the caller owns, nil when there are none