Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Remove the top item from the stack, and return its data */
- public Data pop() {
- if (isEmpty()) { // 1
- throw new NoSuchElementException("The stack is empty."); // 1
- } // 1
- Data item = top.data; // 2
- top = top.next; // 3
- size--; // 4
- return item; // 5
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement