Precalculate index stats

This commit is contained in:
Pijus Kamandulis
2025-06-23 17:52:20 +03:00
parent d801debaf6
commit be637f4540
13 changed files with 243 additions and 81 deletions
+10
View File
@@ -12,3 +12,13 @@ func UniqueBy[T any, K comparable](items []T, keySelector func(T) K) []T {
}
return result
}
func Where[T any](items []T, predicate func(T) bool) []T {
result := make([]T, 0)
for _, item := range items {
if predicate(item) {
result = append(result, item)
}
}
return result
}