|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkodkod.util.collections.Stack<T>
kodkod.util.collections.ArrayStack<T>
public class ArrayStack<T>
A Stack implementation based on an array.
Constructor Summary | |
---|---|
ArrayStack()
Constructs an empty stack with the inital capacity of 10. |
|
ArrayStack(int initialCapacity)
|
Method Summary | |
---|---|
boolean |
empty()
Returns true if the stack is empty; otherwise returns false. |
void |
ensureCapacity(int minCapacity)
Increases the capacity of this ArrayStack, if necessary, to ensure that it can hold at least the number of elements specified by the minimum capacity argument. |
java.util.Iterator<T> |
iterator()
Iterates over the items in this Stack, starting at the top of the stack and working its way down. |
T |
peek()
Looks at the object at the top of this stack without removing it from the stack. |
T |
pop()
Removes the object at the top of this stack and returns that object as the value of this function. |
T |
push(T item)
Pushes an item onto the top of this stack and returns it. |
int |
search(java.lang.Object o)
Returns the 1-based position where an object is on this stack. |
int |
size()
Returns the size of this stack. |
void |
trimToSize()
Trims the capacity of this ArrayStack to be the stack's current size. |
Methods inherited from class kodkod.util.collections.Stack |
---|
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ArrayStack()
no this.elems' |
public ArrayStack(int initialCapacity)
Method Detail |
---|
public void ensureCapacity(int minCapacity)
public void trimToSize()
public int size()
Stack
size
in class Stack<T>
Stack.size()
public T push(T item)
push
in class Stack<T>
Stack.push(T)
public T pop()
Stack
pop
in class Stack<T>
Stack.pop()
public T peek()
Stack
peek
in class Stack<T>
Stack.peek()
public int search(java.lang.Object o)
Stack
search
in class Stack<T>
Stack.search(java.lang.Object)
public boolean empty()
Stack
empty
in class Stack<T>
Stack.empty()
public java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T>
iterator
in class Stack<T>
Stack.iterator()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |