21
0
Fork 0
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
1 changed files with 9 additions and 0 deletions

View File

@ -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)
}