Documentation
¶
Overview ¶
Package orderedmap provides an ordered map where keys are sorted by insertion order.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OrderedMap ¶
type OrderedMap[K comparable, V any] struct { // contains filtered or unexported fields }
OrderedMap is a map datastructure, but the keys are ordered by insertion order, making it easier when order is important
func (*OrderedMap[K, V]) Delete ¶
func (om *OrderedMap[K, V]) Delete(key K)
Delete deletes K from map
func (*OrderedMap[K, V]) Get ¶
func (om *OrderedMap[K, V]) Get(key K) (V, bool)
Get retruns value for key
func (*OrderedMap[K, V]) Keys ¶
func (om *OrderedMap[K, V]) Keys() []K
Keys returns the keys for the map. ordered by insert
func (*OrderedMap[K, V]) Range ¶
func (om *OrderedMap[K, V]) Range() iter.Seq2[K, V]
Range returns iter.Seq2 for iterating over values in insertion order
func (*OrderedMap[K, V]) Set ¶
func (om *OrderedMap[K, V]) Set(key K, v V)
Set sets V for K. if the key has been set before, the order does not get changed
func (*OrderedMap[K, V]) Values ¶
func (om *OrderedMap[K, V]) Values() []V
Values returns a list of values, ordered by insert
Click to show internal directories.
Click to hide internal directories.