|
|
@ -286,22 +286,12 @@ func (v Slice[T]) ContainsFunc(f func(T) bool) bool {
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// As it runs in O(n) time, use with care.
|
|
|
|
// As it runs in O(n) time, use with care.
|
|
|
|
func SliceContains[T comparable](v Slice[T], e T) bool {
|
|
|
|
func SliceContains[T comparable](v Slice[T], e T) bool {
|
|
|
|
for _, x := range v.ж {
|
|
|
|
return slices.Contains(v.ж, e)
|
|
|
|
if x == e {
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SliceContainsFunc reports whether f reports true for any element in v.
|
|
|
|
// SliceContainsFunc reports whether f reports true for any element in v.
|
|
|
|
func SliceContainsFunc[T any](v Slice[T], f func(T) bool) bool {
|
|
|
|
func SliceContainsFunc[T any](v Slice[T], f func(T) bool) bool {
|
|
|
|
for _, x := range v.ж {
|
|
|
|
return slices.ContainsFunc(v.ж, f)
|
|
|
|
if f(x) {
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SliceEqual is like the standard library's slices.Equal, but for two views.
|
|
|
|
// SliceEqual is like the standard library's slices.Equal, but for two views.
|
|
|
|