202108160716 - Deque的实现类

graph LR A[Deque] --> B1[ArrayQueue] A --> B2[ConcurrentLinkedDeque] A --> B3[LinkedBlockingDeque] A --> B4[LinkedList]

Deque接口的实现类LinkedList模拟栈,而不用java原生的栈?

Deques can also be used as LIFO (Last-In-First-Out) stacks. This interface should be used in preference to the legacy [`Stack`](https://docs.oracle.com/javase/8/docs/api/java/util/Stack.html "class in java.util") class. When a deque is used as a stack, elements are pushed and popped from the beginning of the deque. Stack methods are precisely equivalent to `Deque` methods as indicated in the table below:

Deque优于原生的Stack类,为什么?

posted @ 2025-03-20 18:48  钱塘江畔  阅读(6)  评论(0)    收藏  举报