tutorials
tutorials copied to clipboard
[ISSUE] Wrong explanation for "ArrayDeque for stack"
Article and Module Links Java ArrayDeque
Describe the Issue
When ArrayDeque is used to implement a stack, it acts as LIFO(Last In First Out). So the element which is added at the last should be removed first. So in the above mentioned link, we are inserting two elements into stack. "first" and "second" . When we call the pop function, the element "second" should be removed first but the explanation says "first" will be removed which is wrong.
To Reproduce Steps to reproduce the behavior:
- Go to this link
- Read the description and the text in the image
- The description is wrong
Expected Behavior
When pop method is called on stack, it should return "second" as the value and set the index 1 to null