push method

void push(
  1. T e
)

push element in top of the stack.

Implementation

void push(T e) {
  if(_sizeMax == noLimit || _list.length < _sizeMax) {
    _list.addLast(e);
  }
  else {
    throw IllegalOperationException(
      'Error: cannot add element. Stack already at maximum size of: ${_sizeMax} elements');
  }
}