Skip to content

[ISSUE] Wrong explanation for "ArrayDeque for stack"  #17355

Open
@ravening

Description

@ravening

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:

  1. Go to this link
  2. Read the description and the text in the image
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    on-jiratriagedIssues reviewed by a dev and considered valid. Will be added in Jira.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions