|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pivot.collections.concurrent.SynchronizedStack<T>
public class SynchronizedStack<T>
Synchronized implementation of the Stack
interface.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Stack |
---|
Stack.StackListenerList<T> |
Constructor Summary | |
---|---|
SynchronizedStack(Stack<T> stack)
|
Method Summary | |
---|---|
void |
clear()
Removes all elements from the collection. |
Comparator<T> |
getComparator()
Returns the collection's sort order. |
int |
getDepth()
Returns the stack depth. |
ListenerList<StackListener<T>> |
getStackListeners()
Returns the stack listener list. |
boolean |
isEmpty()
Tests the emptiness of the stack. |
Iterator<T> |
iterator()
NOTE Callers must manually synchronize on the SynchronizedStack instance to ensure thread safety during iteration. |
T |
peek()
Returns the item on top of the stack without removing it from the stack. |
T |
pop()
Removes the top item from the stack and returns it. |
void |
push(T item)
"Pushes" an item onto the stack. |
void |
setComparator(Comparator<T> comparator)
Sets the collection's sort order, re-ordering the collection's contents and ensuring that new entries preserve the sort order. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SynchronizedStack(Stack<T> stack)
Method Detail |
---|
public void push(T item)
Stack
push
in interface Stack<T>
item
- The item to push onto the stack.public T pop()
Stack
pop
in interface Stack<T>
public T peek()
Stack
peek
in interface Stack<T>
public void clear()
Collection
clear
in interface Collection<T>
public boolean isEmpty()
Stack
isEmpty
in interface Collection<T>
isEmpty
in interface Stack<T>
public int getDepth()
Stack
getDepth
in interface Stack<T>
public Comparator<T> getComparator()
Collection
getComparator
in interface Collection<T>
Collection.setComparator(Comparator)
public void setComparator(Comparator<T> comparator)
Collection
Calling this method more than once with the same comparator will re-sort the collection.
setComparator
in interface Collection<T>
comparator
- The comparator used to order elements in the collection, or null if the
collection is unsorted.public Iterator<T> iterator()
iterator
in interface Iterable<T>
public ListenerList<StackListener<T>> getStackListeners()
Stack
getStackListeners
in interface Stack<T>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |