pop method
E
pop()
Removes and returns the top element of the stack.
Throws NoGuaranteeException if the stack is empty.
Example:
final stack = Stack<String>();
stack.push('hello');
final popped = stack.pop(); // 'hello'
Implementation
E pop() {
if (empty()) {
throw InvalidArgumentException('Stack is empty');
}
return _elements.removeLast();
}