Skip to content

Commit 3c9740c

Browse files
committed
feat: List 기반의 스택 push 메서드 구현
1 parent a27759d commit 3c9740c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

yoonexample/src/main/java/stack/ListStack.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ public boolean isEmpty() {
1717

1818
@Override
1919
public void push(E data) {
20-
20+
Node<E> newNode = new Node<>(data);
21+
newNode.next = this.head;
22+
this.head = newNode;
23+
this.size++;
2124
}
2225

2326
@Override

0 commit comments

Comments
 (0)