File size: 314 Bytes
b225a21 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
class Stack<T> {
final List<T> _list = [];
void push(T element) {
_list.add(element);
}
T pop() {
var element = _list.last;
_list.removeLast();
return element;
}
T peek() {
return _list.last;
}
bool get isEmpty => _list.isEmpty;
bool get isNotEmpty => _list.isNotEmpty;
}
|