Documentation
¶
Index ¶
- func Filter[K comparable, V any](m map[K]V, f func(K, V) bool) map[K]V
- func Get[K comparable, V any](m map[K]V, k K, def V) 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 Values[K comparable, V any](m map[K]V) []V
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Filter ¶
func Filter[K comparable, V any](m map[K]V, f func(K, V) bool) map[K]V
Filter returns a new map containing only the key-value pairs that pass the given predicate function. If the given map is nil, nil is returned.
func Get ¶
func Get[K comparable, V any](m map[K]V, k K, def V) V
Get returns the value of the given key in the given map. If the key does not exist, the default value is returned.
func Keys ¶
func Keys[K comparable, V any](m map[K]V) []K
Keys returns a slice of keys of the given map. The order of the keys is not guaranteed. If the given map is nil, nil is returned.
func Map ¶
func Map[K1, K2 comparable, V1, V2 any](m map[K1]V1, f func(K1, V1) (K2, V2)) map[K2]V2
Map returns a new map containing the results of applying the given function to each key-value pair. If the given map is nil, nil is returned.
func Values ¶
func Values[K comparable, V any](m map[K]V) []V
Values returns a slice of values of the given map. The order of the values is not guaranteed. If the given map is nil, nil is returned.
Types ¶
This section is empty.