@Test public void testPush() { stacks.push(1); stacks.push(2); assertEquals(2, stacks.size()); assertEquals(2, stacks.numElements()); }
public E push(E element) { if (isFull()) { stacks.addFirst(new ArrayDeque<E>()); } stacks.getFirst().addFirst(element); return element; }
SetOfStacks { public E push(E element) { if (isFull()) { stacks.addFirst(new ArrayDeque<E>()); } stacks.getFirst().addFirst(element); return element; } }
SetOfStacks { public E push(E element) { if (isFull()) { stacks.addFirst(new ArrayDeque<E>()); } stacks.getFirst().addFirst(element); return element; } SetOfStacks();  SetOfStacks(int capacity); }
SetOfStacks { public E push(E element) { if (isFull()) { stacks.addFirst(new ArrayDeque<E>()); } stacks.getFirst().addFirst(element); return element; } SetOfStacks();  SetOfStacks(int capacity); E push(E element); E pop(); E peek(); boolean isEmpty(); int size(); int numElements(); }
SetOfStacks { public E push(E element) { if (isFull()) { stacks.addFirst(new ArrayDeque<E>()); } stacks.getFirst().addFirst(element); return element; } SetOfStacks();  SetOfStacks(int capacity); E push(E element); E pop(); E peek(); boolean isEmpty(); int size(); int numElements();  }