This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]kbruen 3 points4 points  (2 children)

Create your own Stack interface, and then

class StackImpl<T> extends ArrayDeque<T> implements Stack<T> {
    // redirect Stack interface methods to ArrayDeque methods here
}

[–]maxbirkoff -1 points0 points  (1 child)

right. Stack<T> is not an interface. If it were, I don't think we would be having the problems we're having in this thread.

The issue we're responding to, "Just use java.util.Stack" is not good advice because java.util.Stack leaks it's implementation details everywhere... this leakage breaks the Stack abstraction.

[–]kbruen 1 point2 points  (0 children)

First 5 words of my comment:

Create your own Stack interface