We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a65a855 commit 71f154fCopy full SHA for 71f154f
yoonexample/src/main/java/stack/ArrayStack.java
@@ -0,0 +1,39 @@
1
+package stack;
2
+
3
+public class ArrayStack<E> implements Stack<E> {
4
5
+ private static final int INITIAL_CAPACITY = 100;
6
7
+ private int topIndex;
8
+ private Object[] arr;
9
10
+ public ArrayStack() {
11
+ this.topIndex = -1;
12
+ this.arr = new Object[INITIAL_CAPACITY];
13
+ }
14
15
+ @Override
16
+ public int size() {
17
+ return this.topIndex + 1;
18
19
20
21
+ public boolean isEmpty() {
22
+ return this.topIndex == -1;
23
24
25
26
+ public void push(E data) {
27
28
29
30
31
+ public E pop() {
32
+ return null;
33
34
35
36
+ public E peek() {
37
38
39
+}
0 commit comments