feat: add FilterConcurrent

This commit is contained in:
dudaodong committed 2024-08-14 11:19:10 +08:00
1 parent 7f78a6b11e
commit a360372aa9
5 files changed
+141 -1

No files matched your search

+15
View File
@@ -247,6 +247,21 @@ func ExampleFilter() {
// [2 4]
}
func ExampleFilterConcurrent() {
nums := []int{1, 2, 3, 4, 5}
isEven := func(i, num int) bool {
return num%2 == 0
}
result := FilterConcurrent(nums, 2, isEven)
fmt.Println(result)
// Output:
// [2 4]
}
func ExampleCount() {
nums := []int{1, 2, 3, 3, 4}