Question
In Java, which comparison about ArrayDeque as a Stack is accurate?
- There is no practical difference in behavior, performance, or API design when ArrayDeque as a Stack is involved.
- The oldest option related to ArrayDeque as a Stack is always the right production choice regardless of context.
- Differences around ArrayDeque as a Stack are mostly cosmetic, so correctness and maintainability do not change.
- ArrayDeque avoids the legacy baggage of Stack and is typically faster than linked alternatives for stack-style operations.
Hint
Focus on the behavior or tradeoff, not just the keyword.
Answer and rationale
Correct answer: D. ArrayDeque avoids the legacy baggage of Stack and is typically faster than linked alternatives for stack-style operations.
ArrayDeque avoids the legacy baggage of Stack and is typically faster than linked alternatives for stack-style operations. This is the comparison that usually separates memorization from understanding.
Track: Java