Documentation ¶
Index ¶
- func DeepCopy[M ~map[K]V, K comparable, V interfaces.DeepCopier[V]](m M) M
- func DeepEqual[M ~map[K]V, K comparable, V interfaces.Equaler[V]](a, b M) bool
- func Filter[M ~map[K]V, K comparable, V any](m M, predicate func(K, V) bool) M
- func FilterKeys[M ~map[K]V, K comparable, V any](m M, predicate func(K) bool) M
- func FromSlice[S []E, E any, K comparable, V any](slice S, keyFunc func(E) K, valueFunc func(E) V) map[K]V
- func Keys[K comparable, V any](m map[K]V) []K
- func Map[M ~map[KA]VA, KA comparable, VA any, KB comparable, VB any](m M, keyFunc func(KA) KB, valueFunc func(VA) VB) map[KB]VB
- func MapKeys[M ~map[KA]V, KA comparable, KB comparable, V any](m M, keyFunc func(KA) KB) map[KB]V
- func MapValues[M ~map[K]VA, K comparable, VA any, VB any](m M, valueFunc func(VA) VB) map[K]VB
- func RemoveInPlace[K comparable, V any](m map[K]V, keySelector func(K) bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeepCopy ¶
func DeepCopy[M ~map[K]V, K comparable, V interfaces.DeepCopier[V]](m M) M
DeepCopy returns a deep copy of M.
func DeepEqual ¶ added in v0.3.54
func DeepEqual[M ~map[K]V, K comparable, V interfaces.Equaler[V]](a, b M) bool
DeepEqual compares two maps for equality using the Equals() method defined on the values.
func Filter ¶ added in v0.3.59
func Filter[M ~map[K]V, K comparable, V any](m M, predicate func(K, V) bool) M
Filter returns a copy of the provided map with any keys for which predicate returns false removed.
func FilterKeys ¶ added in v0.3.53
func FilterKeys[M ~map[K]V, K comparable, V any](m M, predicate func(K) bool) M
FilterKeys returns a copy of the provided map with any keys for which predicate returns false removed.
func FromSlice ¶ added in v0.8.7
func FromSlice[S []E, E any, K comparable, V any](slice S, keyFunc func(E) K, valueFunc func(E) V) map[K]V
FromSlice maps element e of slice into map entry keyFunc(e): valueFunc(e)
func Keys ¶ added in v0.8.7
func Keys[K comparable, V any](m map[K]V) []K
func Map ¶
func Map[M ~map[KA]VA, KA comparable, VA any, KB comparable, VB any](m M, keyFunc func(KA) KB, valueFunc func(VA) VB) map[KB]VB
Map maps the keys and values of m into keyFunc(k) and valueFunc(v), respectively. Duplicate keys are overwritten.
func MapKeys ¶
func MapKeys[M ~map[KA]V, KA comparable, KB comparable, V any](m M, keyFunc func(KA) KB) map[KB]V
MapKeys maps the keys of m into keyFunc(k). Duplicate keys are overwritten.
func MapValues ¶
func MapValues[M ~map[K]VA, K comparable, VA any, VB any](m M, valueFunc func(VA) VB) map[K]VB
MapValues maps the values of m into valueFunc(v).
func RemoveInPlace ¶ added in v0.8.7
func RemoveInPlace[K comparable, V any](m map[K]V, keySelector func(K) bool)
RemoveInPlace removes elements that match keySelector
Types ¶
This section is empty.