Skip to content

Commit 77ecfc5

Browse files
author
AmiyahJo
committed
fix: replace stack.java 'top == null' to isEmpty() for if statements
1 parent 9a74b59 commit 77ecfc5

File tree

1 file changed

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

1 file changed

+3
-3
lines changed

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

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

1818
public int pop() {
19-
if (top == null){
20-
//do stuff
19+
if (isEmpty()){
20+
System.out.println("EMPTY");
2121
}
2222
return 1;
2323
}
2424

2525
public int peek() {
26-
if(top == null){
26+
if(isEmpty()){
2727
//do stuff
2828
}
2929
return 1;

0 commit comments

Comments
 (0)