Documentation ¶
Index ¶
- type CompFunc
- type OrderedMap
- func (m *OrderedMap[K, V]) Delete(key K)
- func (m *OrderedMap[K, V]) Get(key K) (V, bool)
- func (m *OrderedMap[K, V]) IterateKeys(f func(K) bool)
- func (m *OrderedMap[K, V]) IterateValues(f func(V) bool)
- func (m *OrderedMap[K, V]) Keys() []K
- func (m *OrderedMap[K, V]) Set(key K, value V)
- func (m *OrderedMap[K, V]) Values() []V
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OrderedMap ¶
type OrderedMap[K, V any] struct { // contains filtered or unexported fields }
a map that keeps it's keys sorted in ascending order
func New ¶
func New[K, V any](eq, less CompFunc[K]) *OrderedMap[K, V]
create a new OrderedMap with the given equality and less functions
func (*OrderedMap[K, V]) Delete ¶
func (m *OrderedMap[K, V]) Delete(key K)
delete the given key from the map
func (*OrderedMap[K, V]) Get ¶
func (m *OrderedMap[K, V]) Get(key K) (V, bool)
returns the value for the given key and wether it exists
func (*OrderedMap[K, V]) IterateKeys ¶
func (m *OrderedMap[K, V]) IterateKeys(f func(K) bool)
iterate over all Keys in the map until f returns false
func (*OrderedMap[K, V]) IterateValues ¶
func (m *OrderedMap[K, V]) IterateValues(f func(V) bool)
iterate over all Values in the map until f returns false
func (*OrderedMap[K, V]) Keys ¶
func (m *OrderedMap[K, V]) Keys() []K
collects all the keys in the map
func (*OrderedMap[K, V]) Set ¶
func (m *OrderedMap[K, V]) Set(key K, value V)
set or insert a key value pair into the map
func (*OrderedMap[K, V]) Values ¶
func (m *OrderedMap[K, V]) Values() []V
collects all the values in the map
Click to show internal directories.
Click to hide internal directories.