Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public T peek()
- throws NoSuchElementException {
- if (items.size() == 0) {
- throw new NoSuchElementException("can't peek into an empty stack");
- }
- return items.get(items.size()-1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement