Abstract supertype of datastructures that can be used as LIFO stacks.
A Stack
has a well-defined top
. Elements
may be added to the top of the stack by push()
,
and removed from the top of the stack by pop()
.
Note that many Stack
s are also List
s, but
there is no defined relationship between the
order of elements in the list and the direction
of the stack. In particular, the top of the stack
may be first element of the list, or it may be
the last element of the list.
LinkedList
, ArrayList
, Queue
no type hierarchy
no supertypes hierarchy
Attributes | |
top | Source Codeshared formal Element? top The element currently at the top of the stack,
or |
Inherited Attributes |
Attributes inherited from: Object |
Methods | |
pop | Source Codeshared formal Element? pop() Remove and return the element at the top of the stack. |
push | Source Codeshared formal void push(Element element) Push a new element onto the top of the stack. |
Inherited Methods |
Methods inherited from: Object |