Skip to content

Commit ff09ef0

Browse files
authored
isEmpty() method correction.
Empty stack is at -1 index position. Index position 0 indicates that the stack has one element in it.
1 parent 093c03a commit ff09ef0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/com/mehmetpekdemir/stack/arraystack/ArrayStack.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public Employee peek() {
4949
}
5050

5151
public boolean isEmpty() {
52-
return top == 0;
52+
return top == -1;
5353
}
5454

5555
public int size() {

0 commit comments

Comments
 (0)