Package coneforest.psylla
Class Stack<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<E>
-
- coneforest.psylla.Stack<E>
-
- Type Parameters:
E
- a type of an element.
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<E>
,Collection<E>
,List<E>
,RandomAccess
- Direct Known Subclasses:
DictStack
,ExecutionStack
,OperandStack
,ProcStack
public class Stack<E> extends ArrayList<E>
Base class for interpreter’s stacks.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Stack()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description E
peek()
Returns the last element of the stack without popping it.E
pop()
Pops and returns the last element of the stack.void
push(E element)
Pushes an element to the stack.void
setSize(int size)
-
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, 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
-
-
-
-
Method Detail
-
pop
public E pop()
Pops and returns the last element of the stack.- Returns:
- an element popped.
-
peek
public E peek()
Returns the last element of the stack without popping it.- Returns:
- an element.
-
push
public void push(E element)
Pushes an element to the stack.- Parameters:
element
- an element.
-
setSize
public void setSize(int size)
-
-