|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.clearsilver.jsilver.data.UniqueStack<T>
public class UniqueStack<T>
The ResourceStack
represents a LIFO stack of unique objects (resources).
An attempt to insert on a stack an object that is already there will fail and result with a
method push(Object)
returning false.
All provided operations (pop()
and push(Object)
) are done in average constant
time.
This class is iterable
Constructor Summary | |
---|---|
UniqueStack()
|
Method Summary | |
---|---|
boolean |
isEmpty()
Returns true if this stack contains no elements. |
Iterator<T> |
iterator()
|
T |
pop()
Removes last added object from the stack. |
boolean |
push(T object)
Add an object to a stack. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UniqueStack()
Method Detail |
---|
public boolean push(T object)
object
- to be added. If it is null
a NullPointerException
will be thrown.
public T pop()
NoSuchElementException
- - if the stack is emptypublic boolean isEmpty()
true
if this stack contains no elements.
true
if this stack contains no elements.public Iterator<T> iterator()
iterator
in interface Iterable<T>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |