public int pop() { StackWithCapacity stack = getLastStack(); int val = stack.pop(); if (stack.isEmpty() && this.listOfStacks.Count > 1) { listOfStacks.pop(); } return(val); }
public void push(int item) { StackWithCapacity stack = getLastStack(); if (!stack.isFull()) { stack.push(item); } else { stack = new StackWithCapacity(this.capacityStacks); stack.push(item); listOfStacks.push(stack); } }