public final class MarkStack<E> extends Object
Constructor and Description |
---|
MarkStack() |
Modifier and Type | Method and Description |
---|---|
boolean |
isEmpty()
Return true iff the stack is empty.
|
void |
mark()
Record the current position in the stack for a
subsequent popMark call.
|
E |
peek()
Return the top element of the stack.
|
E |
pop()
Return the top element of the stack and remove it from the stack.
|
List<E> |
popMark()
Return an ordered list of stack elements starting with
the element that was on top of the stack when mark was
called.
|
E |
push(E elem) |
public E pop()
EmptyStackException
- is thrown if the stack is empty.IllegalStateException
- if an attempt is made to pop
past the top mark.public boolean isEmpty()
public E peek()
EmptyStackException
- is thrown if the stack is empty.public void mark()
Copyright © 2017 Oracle. All rights reserved.