package datastructure.stack;
public class Array {
private E[] data;
private int size;
// capacityArray
public Array(int capacity){
data = (E[])new Object[capacity];
size = 0;
}
// capacity=10
public Array(){
this(10);
}
//
public int getCapacity(){
return data.length;
}
//
public int getSize(){
return size;
}
//
public boolean isEmpty(){
return size == 0;
}
// indexe
public void add(int index, E e){
if(index < 0 || index > size)
throw new IllegalArgumentException("Add failed. Require index >= 0 and index