From e46f8019ece5e471960cb4bdc094524d60e5c415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Sat, 28 Jan 2023 22:29:21 +0100 Subject: [PATCH] v0.0.62 --- dataext/stack.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dataext/stack.go b/dataext/stack.go index 6211334..d25d653 100644 --- a/dataext/stack.go +++ b/dataext/stack.go @@ -96,3 +96,12 @@ func (s *Stack[T]) OptPeek() *T { return langext.Ptr(s.data[l-1]) } + +func (s *Stack[T]) Length() int { + if s.lock != nil { + s.lock.Lock() + defer s.lock.Unlock() + } + + return len(s.data) +}