feat: add Frequency in slice package

This commit is contained in:
dudaodong committed 2024-09-06 15:06:35 +08:00
1 parent 90e5a0bfb2
commit c3372e18b1
5 files changed
+140 -8

No files matched your search

+10
View File
@@ -1251,3 +1251,13 @@ func ExampleMapConcurrent() {
// Output:
// [1 4 9 16 25 36]
}
func ExampleFrequency() {
strs := []string{"a", "b", "b", "c", "c", "c"}
result := Frequency(strs)
fmt.Println(result)
// Output:
// map[a:1 b:2 c:3]
}