stack = new LinkedList (); 为什么不直接用java里的stack呢？
分享一下我是如何寻找答案的，我会google关键词：deque stack java
For one thing, it’s more sensible in terms of inheritance. The fact that Stack extends Vector is really strange, in my view. Early in Java, inheritance was overused IMO - Properties being another example.
For me, the crucial word in the docs you quoted is consistent. Deque exposes a set of operations which is all about being able to fetch/add/remove items from the start or end of a collection, iterate etc - and that’s it. There’s deliberately no way to access an element by position, which Stack exposes because it’s a subclass of Vector.
Oh, and also Stack has no interface, so if you know you need Stack operations you end up committing to a specific concrete class, which isn’t usually a good idea.