Class ImmutableStack<T>
java.lang.Object
com.ibm.wala.util.collections.ImmutableStack<T>
- All Implemented Interfaces:
Iterable<T>
- Direct Known Subclasses:
CallStack
An immutable stack of objects. The
push(Object) and pop() operations create new
stacks.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic <T> ImmutableStack<T> booleanget(int i) static intinthashCode()booleanisEmpty()iterator()protected T[]makeInternalArray(int size) protected ImmutableStack<T> peek()pop()popAll(ImmutableStack<T> other) pushAll(ImmutableStack<T> other) replaceTop(T t) return a new stack with the top replaced with treverse()intsize()booleantopMatches(ImmutableStack<T> other) toString()Methods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
ImmutableStack
-
-
Method Details
-
getMaxSize
public static int getMaxSize() -
emptyStack
-
equals
-
hashCode
-
push
-
makeInternalArray
-
makeStack
-
peek
- Returns:
- the element on the top of the stack
- Throws:
EmptyStackException- if stack is empty
-
pop
- Throws:
EmptyStackException- if stack is empty
-
isEmpty
public boolean isEmpty() -
size
public int size() -
get
-
toString
-
contains
-
topMatches
- Returns:
trueiffother.size() = k,k <= this.size(), and the top k elements of this equal other- Throws:
IllegalArgumentException- if other == null
-
reverse
-
popAll
-
pushAll
-
iterator
-
replaceTop
return a new stack with the top replaced with t
-