CountBy¶
func CountBy[T any, K comparable](slice []T, keySelector func(T) K) map[K]int
CountBy counts the occurrences of each key extracted using the keySelector function. Returns a map where keys are the extracted keys and values are the counts.
func CountBy[T any, K comparable](slice []T, keySelector func(T) K) map[K]int
CountBy counts the occurrences of each key extracted using the keySelector function. Returns a map where keys are the extracted keys and values are the counts.