Skip to content

Commit a27759d

Browse files
committed
feat: List 기반의 스택 초기화 예제 코드 작성
1 parent cf8c663 commit a27759d

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package stack;
2+
3+
public class ListStack<E> implements Stack<E> {
4+
5+
private int size;
6+
private Node<E> head;
7+
8+
@Override
9+
public int size() {
10+
return this.size;
11+
}
12+
13+
@Override
14+
public boolean isEmpty() {
15+
return this.size == 0;
16+
}
17+
18+
@Override
19+
public void push(E data) {
20+
21+
}
22+
23+
@Override
24+
public E pop() {
25+
return null;
26+
}
27+
28+
@Override
29+
public E peek() {
30+
return null;
31+
}
32+
33+
private static class Node<T> {
34+
35+
private T data;
36+
private Node<T> next;
37+
38+
public Node(T data) {
39+
this.data = data;
40+
}
41+
}
42+
}

0 commit comments

Comments
 (0)