top property

T get top

Returns the top element of the stack without removing it. Throws a StateError if the stack is empty.

Implementation

T get top {
  if (empty) {
    throw StateError('Cannot access top of an empty Stack');
  }
  return _container.getRear();
}