public class StackInt
extends java.lang.Object
Stack<Integer>
Modifier and Type | Field and Description |
---|---|
private int |
size
Stack size
|
private int[] |
stack
Stack itself
|
Constructor and Description |
---|
StackInt()
Create a new instance of StackInt
|
StackInt(int size)
Create a new instance of StackInt
|
Modifier and Type | Method and Description |
---|---|
private void |
expand(int more)
Expand the stack is need
|
int |
getSize()
Stack size
|
boolean |
isEmpty()
Indicates if stack is empty
|
int |
pop()
Obtain the integer at the top of the stack and remove it from the stack
|
void |
push(int integer)
Push integer on the top of the stack
|
public StackInt()
public StackInt(int size)
size
- Start sizeprivate void expand(int more)
more
- Number of element will addpublic int getSize()
public boolean isEmpty()
true
if stack is emptypublic int pop()
public void push(int integer)
integer
- Integer to store on the top