From JavaDoc for Stack, we could see: "A more complete and consistent set of LIFO stack operations is provided by the Deque interface and its implementations, which should be used in preference to this class. For example:" Deque<Integer> stack = new ArrayDeque<>(); Here are some answers from Why should I use Deque over Stack?. Inconsistency: …