aboutsummaryrefslogtreecommitdiff
path: root/frontend/lib/utils/stack.dart
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/lib/utils/stack.dart')
-rw-r--r--frontend/lib/utils/stack.dart20
1 files changed, 20 insertions, 0 deletions
diff --git a/frontend/lib/utils/stack.dart b/frontend/lib/utils/stack.dart
new file mode 100644
index 000000000..1ddbae55c
--- /dev/null
+++ b/frontend/lib/utils/stack.dart
@@ -0,0 +1,20 @@
+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;
+}