public class IntStack extends IntVector
Stack pretty closely, except that push()
returns the position of the added element in the stack. Inherits from IntVector, so those methods
are also available.| Constructor and Description |
|---|
IntStack()
Creates an empty stack.
|
IntStack(int capacity)
Creates an empty stack.
|
IntStack(int capacity,
int growth_factor,
int multiplication_limit)
Creates an empty stack with specified capacity, growth_factor and multiplication limit
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears the stack.
|
boolean |
empty()
Check if stack is empty.
|
int |
peek()
Look at the topmost element in the stack.
|
int |
pop()
Pop an element from the stack.
|
int |
push(int i)
Push a new element on the stack.
|
add, add, add, add, addBulk, contains, copy, ensure_size, equals, fill, get, getArray, hashCode, indexOf, indexOfOptimizeAscending, multiAdd, multiAdd, position, put, remove, removeAllElements, removeAllElementsAdjustSizeDown, resetSize, set, setSize, size, sortDedup, toArray, toArrayCopy, toIntArray, toString, trimToSizepublic IntStack()
public IntStack(int capacity)
capacity - -public IntStack(int capacity,
int growth_factor,
int multiplication_limit)
capacity - -growth_factor - -multiplication_limit - -public int push(int i)
i - The element to be pushed.i after it's been added.public int pop()
public int peek()
public boolean empty()
true, if stack is empty; false, else.public void clear()
Copyright © 2018. All rights reserved.