public void Push(T v) { MyStack <T> last = GetLastStack(); if (last != null) { // add to last stack if (last.IsFull() != true) { last.Push(v); } else { MyStack <T> stack = new MyStack <T>(capacity); stack.Push(v); stacks.Add(stack); } } else { MyStack <T> stack = new MyStack <T>(capacity); stack.Push(v); stacks.Add(stack); } }
public bool IsEmpty() { MyStack <T> last = GetLastStack(); return(last == null); }