1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-09 07:02:29 +08:00

feat: add FilterConcurrent

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

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}