From charlesreid1

Revision as of 05:43, 4 June 2017 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

When implementing a Stack class, according to the Abstract Data Types page, you'll want to use an interface in Java.

Here's an example Stack interface to enforce a set of uniform methods. This is much simpler than the Stack interface in the Java API.

public interface Stack<E> { 
    int size();
    boolean isEmpty();
    void push(E e);
    E pop();
    E peek();
}


Flags