The data type should be stored in the stack will not affect the stack operations.
So use a generic type variable, say E, for this data.
The UML diagram below gives the syntactic specification of the Stack class, but nothing about the actual meaning; i.e., the last-in, first-out property.
What is needed is additional documentation of the method properties.
| Stack<E> |
|---|
| .. private data .. |
| +Stack() +void push(E x) +E pop() +E peek() +boolean isEmpty() +int size() |