LabAssign1
LabAssign1
public ArrayStack2()
{
this(DEFAULT_INITIAL_CAPACITY);
} // end default constructor
public T peek()
{
T top = null;
if (!isEmpty())
top = stack[topIndex];
return top;
} // end peek
public T pop()
{
T top = null;
if (!isEmpty()) {
top = stack[topIndex];
stack[topIndex] = null;
topIndex--;
} // end if
if(isTooBig())
reduceArray();
return top;
} // end pop