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.
|
public IntStack()
public IntStack(int capacity)
public IntStack(int capacity,
int growth_factor,
int 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 © 2013. All Rights Reserved.