java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<E>
coneforest.psylla.runtime.Stack<E>
- Type Parameters:
E
- a type of an element.
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<E>
,Collection<E>
,List<E>
,RandomAccess
,SequencedCollection<E>
- Direct Known Subclasses:
DictStack
,ExecutionStack
,OperandStack
,ProcStack
Base class for interpreter’s stacks.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, ensureCapacity, equals, forEach, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
Methods inherited from class java.util.AbstractCollection
containsAll, toString
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
Methods inherited from interface java.util.List
containsAll, reversed
-
Constructor Details
-
Stack
public Stack()Constructs an empty stack with an initial capacity of ten.- Type Parameters:
E
- a type of an element.
-
-
Method Details
-
pop
Pops and returns the topmost element of this stack.- Returns:
- an element popped.
-
peek
Returns the topmost of this stack without popping it.- Returns:
- the topmost of this stack without popping it
-
push
Pushes an element to this stack.- Parameters:
element
- an element.
-
setSize
public void setSize(int size) Truncate this stack to the specified size.- Parameters:
size
- the size.
-