Documentation
¶
Index ¶
- func Group[K comparable, V any](s []V, key func(V) K) map[K][]V
- func KeySlice[M ~map[K]V, K comparable, V any](m M) []K
- func SameKeys[K comparable, V1, V2 any](x map[K]V1, y map[K]V2) bool
- func Sorted[M ~map[K]V, K cmp.Ordered, V any](m M) iter.Seq2[K, V]
- func SortedFunc[M ~map[K]V, K comparable, V any](m M, cmp func(x, y K) int) iter.Seq2[K, V]
- func ValueSlice[M ~map[K]V, K comparable, V any](m M) []V
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Group ¶
func Group[K comparable, V any](s []V, key func(V) K) map[K][]V
Group returns a new non-nil map containing the elements of s grouped by the keys returned from the key func.
func KeySlice ¶
func KeySlice[M ~map[K]V, K comparable, V any](m M) []K
KeySlice returns the keys of the map M, like slices.Collect(maps.Keys(m)).
func SameKeys ¶
func SameKeys[K comparable, V1, V2 any](x map[K]V1, y map[K]V2) bool
SameKeys reports whether x and y have equal sets of keys.
func SortedFunc ¶ added in v0.18.0
func SortedFunc[M ~map[K]V, K comparable, V any](m M, cmp func(x, y K) int) iter.Seq2[K, V]
SortedFunc returns an iterator over the entries of m in the key order determined by cmp.
func ValueSlice ¶
func ValueSlice[M ~map[K]V, K comparable, V any](m M) []V
ValueSlice returns the values of the map M, like slices.Collect(maps.Values(m)).
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.