Package dsa.lab03.base
Interface Stack<Item>
- Type Parameters:
- Item- the item type
- All Known Implementing Classes:
- ArrayStack,- ArrayStack,- LinkedStack,- LinkedStack
A stack.
 
A LIFO (Last-In, First-Out) structure where items are added (pushed) to and removed (popped) from the top.
- 
Method SummaryMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Method Details- 
pushPush (insert) the given item onto the top.- Parameters:
- item- the new top item
 
- 
popPop (remove and return) the given item from the top.- Returns:
- the old top item
- Throws:
- NoSuchElementException- if there's no top item to remove (i.e. if this is empty)
 
- 
topGet the item on top.- Returns:
- the top item
- Throws:
- NoSuchElementException- if there's no top item to retrieve (i.e. if this is empty)
 
 
-