From ba2efffd8ebea961d9a5cae9694365281e9879cf Mon Sep 17 00:00:00 2001 From: milarin Date: Mon, 19 Dec 2022 18:07:43 +0100 Subject: [PATCH] HasAny introduced --- find.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/find.go b/find.go index fea56ef..b5c3f06 100644 --- a/find.go +++ b/find.go @@ -30,3 +30,11 @@ func FindLast[T any](source <-chan T) *T { return last } + +func HasAny[T any](source <-chan T) bool { + return FindFirst(source) != nil +} + +func HasAnyAndFlush[T any](source <-chan T) bool { + return FindFirstAndFlush(source) != nil +}