Documentation ¶
Index ¶
- func New[T OrderedMap[K, V], K comparable, V any](size int) *T
- type OrderedMap
- func (om *OrderedMap[K, V]) Clear()
- func (om *OrderedMap[K, V]) Contains(key K) (present bool)
- func (om *OrderedMap[K, V]) Delete(key K) (oldValue V, present bool)
- func (om *OrderedMap[K, V]) ForAllKeys(predicate func(key K) bool) bool
- func (om *OrderedMap[K, V]) ForAnyKey(predicate func(key K) bool) bool
- func (om *OrderedMap[K, V]) Foreach(f func(key K, value V))
- func (om *OrderedMap[K, V]) ForeachWithError(f func(key K, value V) error) error
- func (om *OrderedMap[K, V]) ForeachWithIndex(f func(index int, key K, value V))
- func (om *OrderedMap[K, V]) Get(key K) (result V, present bool)
- func (om *OrderedMap[K, V]) GetPair(key K) *Pair[K, V]
- func (om *OrderedMap[K, V]) KeySetIsDisjointFrom(other *OrderedMap[K, V]) bool
- func (om *OrderedMap[K, V]) Len() int
- func (om *OrderedMap[K, V]) Newest() *Pair[K, V]
- func (om *OrderedMap[K, V]) Oldest() *Pair[K, V]
- func (om *OrderedMap[K, V]) Set(key K, value V) (oldValue V, present bool)
- func (om *OrderedMap[K, V]) SetAll(other *OrderedMap[K, V])
- type Pair
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶ added in v0.26.0
func New[T OrderedMap[K, V], K comparable, V any](size int) *T
New returns a new OrderedMap of the given size
Types ¶
type OrderedMap ¶ added in v0.25.0
type OrderedMap[K comparable, V any] struct { // contains filtered or unexported fields }
OrderedMap
func KeySetIntersection ¶ added in v1.0.0
func KeySetIntersection[K comparable, V any](om *OrderedMap[K, V], other *OrderedMap[K, V]) *OrderedMap[K, V]
KeySetIntersection returns a map containing the intersection of the keys in the two maps this is only well defined for sets (i.e. maps without meaningful values)
func KeySetUnion ¶ added in v1.0.0
func KeySetUnion[K comparable, V any](om *OrderedMap[K, V], other *OrderedMap[K, V]) *OrderedMap[K, V]
KeySetUnion returns a map containing the union of the keys in the two maps this is only well defined for sets (i.e. maps without meaningful values)
func (*OrderedMap[K, V]) Clear ¶ added in v0.25.0
func (om *OrderedMap[K, V]) Clear()
Clear removes all entries from this ordered map.
func (*OrderedMap[K, V]) Contains ¶ added in v0.28.0
func (om *OrderedMap[K, V]) Contains(key K) (present bool)
Contains returns true if the key is present in the map and false otherwise.
func (*OrderedMap[K, V]) Delete ¶ added in v0.25.0
func (om *OrderedMap[K, V]) Delete(key K) (oldValue V, present bool)
Delete removes the key-value pair, and returns what `Get` would have returned on that key prior to the call to `Delete`.
func (*OrderedMap[K, V]) ForAllKeys ¶ added in v1.0.0
func (om *OrderedMap[K, V]) ForAllKeys(predicate func(key K) bool) bool
ForAllKeys iterates over the keys of the map, and returns whether the provided predicate is true for all of them
func (*OrderedMap[K, V]) ForAnyKey ¶ added in v1.0.0
func (om *OrderedMap[K, V]) ForAnyKey(predicate func(key K) bool) bool
ForAnyKey iterates over the keys of the map, and returns whether the provided predicate is true for any of them
func (*OrderedMap[K, V]) Foreach ¶ added in v0.25.0
func (om *OrderedMap[K, V]) Foreach(f func(key K, value V))
Foreach iterates over the entries of the map in the insertion order, and invokes the provided function for each key-value pair.
func (*OrderedMap[K, V]) ForeachWithError ¶ added in v0.25.0
func (om *OrderedMap[K, V]) ForeachWithError(f func(key K, value V) error) error
ForeachWithError iterates over the entries of the map in the insertion order, and invokes the provided function for each key-value pair. If the passed function returns an error, iteration breaks and the error is returned.
func (*OrderedMap[K, V]) ForeachWithIndex ¶ added in v1.0.0
func (om *OrderedMap[K, V]) ForeachWithIndex(f func(index int, key K, value V))
ForeachWithIndex iterates over the entries of the map in the insertion order, and invokes the provided function for each key-value pair.
func (*OrderedMap[K, V]) Get ¶ added in v0.25.0
func (om *OrderedMap[K, V]) Get(key K) (result V, present bool)
Get returns the value associated with the given key. Returns nil if not found. The second return value indicates if the key is present in the map.
func (*OrderedMap[K, V]) GetPair ¶ added in v0.25.0
func (om *OrderedMap[K, V]) GetPair(key K) *Pair[K, V]
GetPair returns the key-value pair associated with the given key. Returns nil if not found.
func (*OrderedMap[K, V]) KeySetIsDisjointFrom ¶ added in v1.0.0
func (om *OrderedMap[K, V]) KeySetIsDisjointFrom(other *OrderedMap[K, V]) bool
KeySetIsDisjointFrom checks whether the key set of the receiver is disjoint from of the argument map's key set
func (*OrderedMap[K, V]) Len ¶ added in v0.25.0
func (om *OrderedMap[K, V]) Len() int
Len returns the length of the ordered map.
func (*OrderedMap[K, V]) Newest ¶ added in v0.25.0
func (om *OrderedMap[K, V]) Newest() *Pair[K, V]
Newest returns a pointer to the newest pair.
func (*OrderedMap[K, V]) Oldest ¶ added in v0.25.0
func (om *OrderedMap[K, V]) Oldest() *Pair[K, V]
Oldest returns a pointer to the oldest pair.
func (*OrderedMap[K, V]) Set ¶ added in v0.25.0
func (om *OrderedMap[K, V]) Set(key K, value V) (oldValue V, present bool)
Set sets the key-value pair, and returns what `Get` would have returned on that key prior to the call to `Set`.
func (*OrderedMap[K, V]) SetAll ¶ added in v1.0.0
func (om *OrderedMap[K, V]) SetAll(other *OrderedMap[K, V])
SetAll sets all the values in the input map in the receiver map, overrwriting any previous entries