Skip to content

Commit 7c37b67

Browse files
author
AmiyahJo
committed
feat: add implementation to stack pop and push
1 parent a08470d commit 7c37b67

File tree

1 file changed

+9
-2
lines changed
  • lesson_12/structs_java/structs_app/src/main/java/com/codedifferently/lesson12

1 file changed

+9
-2
lines changed

lesson_12/structs_java/structs_app/src/main/java/com/codedifferently/lesson12/Stack.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,18 @@ public void push(int value) {
1616
}
1717

1818
public int pop() {
19-
return 0;
19+
if (top == null){
20+
//do stuff
21+
}
22+
return 1;
2023
}
2124

2225
public int peek() {
23-
return 0;
26+
if(top == null){
27+
//do stuff
28+
}
29+
30+
return 1;
2431
}
2532

2633
public boolean isEmpty() {

0 commit comments

Comments
 (0)