|
Jumpi v1.2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jumpi.impl.util.Stack
A Stack collection class which exhibits unbounded, synchronous first-in-last-out ( FILO ) behaviour.
Elements are placed on the top of the Stack using the pushElement(java.lang.Object)
operation. Elements are taken off the top of the Stack using the popElement()
operation. The popElement operation blocks until there is an
element on the Stack. Use peekElement()
or size()
to check if
there are elements on the Stack to avoid blocking.
Constructor Summary | |
Stack()
Creates a new Stack object. |
|
Stack(int capacity)
Creates a new Stack object. |
Method Summary | |
void |
close()
Close the Stack. |
java.lang.Object |
peekElement()
Peek to see if there is an element on the Stack, without removing it. |
java.lang.Object |
popElement()
Pop the top element off the Stack. |
java.lang.Object |
popElement(long timeout)
Pop the top element off the Stack. |
void |
pushElement(java.lang.Object o)
Put an Object on the top of the Stack. |
int |
size()
Return the number of elements on the Stack. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Stack()
public Stack(int capacity)
capacity
- the initial capacity of the stackMethod Detail |
public void pushElement(java.lang.Object o)
o
- the Object to put on the top of the Stack.
java.lang.IllegalArgumentException
- if o is null
java.lang.IllegalStateException
- if the Stack is closed.public java.lang.Object peekElement()
java.lang.IllegalStateException
- if the Stack is closed.public java.lang.Object popElement()
java.lang.IllegalStateException
- if the Stack is closed on entry.public java.lang.Object popElement(long timeout)
timeout
- maximum time in milliseconds to wait for an element.
java.lang.IllegalStateException
- if the Stack is closed on entry.public int size()
public void close()
|
Jumpi v1.2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |