This commit is contained in:
Mike Schwörer 2023-01-28 22:29:21 +01:00
parent ae952b2166
commit e46f8019ec
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF

View File

@ -96,3 +96,12 @@ func (s *Stack[T]) OptPeek() *T {
return langext.Ptr(s.data[l-1]) 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)
}