Documentation
¶
Index ¶
- func All[K comparable, V any](m map[K]V, f func(K, V) bool) bool
- func Any[K comparable, V any](m map[K]V, f func(K, V) bool) bool
- func Clear[M ~map[K]V, K comparable, V any](m M)
- func Clone[M ~map[K]V, K comparable, V any](m M) M
- func CopyTo[K comparable, V any](dst, src map[K]V)
- func Equal[M ~map[K]V, K, V comparable](m1, m2 M) bool
- func EqualWith[M1 ~map[K]V1, M2 ~map[K]V2, K comparable, V1, V2 any](m1 M1, m2 M2, equaller func(V1, V2) bool) bool
- func Expand[K1, K2 comparable, V1, V2 any](m map[K1]V1, f func(K1, V1) []xtuple.Tuple[K2, V2]) map[K2]V2
- func Filter[M ~map[K]V, K comparable, V any](m M, f func(K, V) bool) M
- func Foreach[K comparable, V any](m map[K]V, f func(K, V))
- func FromKeyValues[K comparable, V any](slice []xtuple.Tuple[K, V]) map[K]V
- func FromKeys[K comparable, V any](slice []K, f func(int, K) V) map[K]V
- func FromValues[K comparable, V any](slice []V, f func(int, V) K) map[K]V
- func KeyValues[K comparable, V any](m map[K]V) []xtuple.Tuple[K, V]
- func Keys[K comparable, V any](m map[K]V) []K
- func Map[K1, K2 comparable, V1, V2 any](m map[K1]V1, f func(K1, V1) (K2, V2)) map[K2]V2
- func Reduce[K comparable, V, U any](m map[K]V, initial U, f func(U, K, V) U) U
- func Values[K comparable, V any](m map[K]V) []V
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶
func All[K comparable, V any](m map[K]V, f func(K, V) bool) bool
All checks whether key-value pairs from given map that all satisfied given predicate function.
func Any ¶
func Any[K comparable, V any](m map[K]V, f func(K, V) bool) bool
Any checks whether given map contains a key-value pair that satisfied given predicate function.
func Clear ¶
func Clear[M ~map[K]V, K comparable, V any](m M)
Clear removes all entries from given map, leaving it empty.
func Clone ¶
func Clone[M ~map[K]V, K comparable, V any](m M) M
Clone returns a copy of given map, and the elements are copied using assignment.
func CopyTo ¶
func CopyTo[K comparable, V any](dst, src map[K]V)
CopyTo copies all key-value pairs in src to dst.
func Equal ¶
func Equal[M ~map[K]V, K, V comparable](m1, m2 M) bool
Equal reports whether two maps contain the same key/value pairs. Values are compared using `==`.
func EqualWith ¶
func EqualWith[M1 ~map[K]V1, M2 ~map[K]V2, K comparable, V1, V2 any](m1 M1, m2 M2, equaller func(V1, V2) bool) bool
EqualWith is like Equal, but compares values using given equaller.
func Expand ¶
func Expand[K1, K2 comparable, V1, V2 any](m map[K1]V1, f func(K1, V1) []xtuple.Tuple[K2, V2]) map[K2]V2
Expand maps and expands given map to another map using expand function.
func Filter ¶
func Filter[M ~map[K]V, K comparable, V any](m M, f func(K, V) bool) M
Filter filters given map and returns a new map using given predicate function.
func Foreach ¶
func Foreach[K comparable, V any](m map[K]V, f func(K, V))
Foreach invokes given function for each key-value of given map.
func FromKeyValues ¶
func FromKeyValues[K comparable, V any](slice []xtuple.Tuple[K, V]) map[K]V
FromKeyValues generates a map, its keys and values are from given kv-tuple slice.
func FromKeys ¶
func FromKeys[K comparable, V any](slice []K, f func(int, K) V) map[K]V
FromKeys generates a map, its keys are from given slice, values are generated by given mapper function.
func FromValues ¶
func FromValues[K comparable, V any](slice []V, f func(int, V) K) map[K]V
FromValues generates a map, its values are from given slice, keys are generated by given mapper function.
func KeyValues ¶
func KeyValues[K comparable, V any](m map[K]V) []xtuple.Tuple[K, V]
KeyValues returns a key-value tuple slice of given map. Note that returned slice has no order.
func Keys ¶
func Keys[K comparable, V any](m map[K]V) []K
Keys returns a key slice of given map. Note that returned slice has no order.
func Map ¶
func Map[K1, K2 comparable, V1, V2 any](m map[K1]V1, f func(K1, V1) (K2, V2)) map[K2]V2
Map maps given map to another map using mapper function.
func Reduce ¶
func Reduce[K comparable, V, U any](m map[K]V, initial U, f func(U, K, V) U) U
Reduce reduces given map to a single value using initial value and left reducer function.
func Values ¶
func Values[K comparable, V any](m map[K]V) []V
Values returns a value slice of given map. Note that returned slice has no order.
Types ¶
This section is empty.