IsEmpty returns true if the stack is empty, false otherwise.
()
| 39 | |
| 40 | // IsEmpty returns true if the stack is empty, false otherwise. |
| 41 | func (s *Array[T]) IsEmpty() bool { |
| 42 | return len(s.elements) == 0 |
| 43 | } |
| 44 | |
| 45 | // Pop removes and returns the top element from the stack. |
| 46 | func (s *Array[T]) Pop() T { |