size method

int size()

Returns the number of elements in this stack.

Example:

final stack = LinkedStack<String>();
print(stack.size()); // 0
stack.push('a');
stack.push('b');
print(stack.size()); // 2

Implementation

int size() {
  return _size;
}