@Test void pop() { FixedStack<String> stack = new FixedStack<>(2); Assertions.assertThrows(ArrayIndexOutOfBoundsException.class, stack::pop); stack.push("1"); stack.push("2"); Assertions.assertEquals("2", stack.pop()); Assertions.assertEquals("1", stack.pop()); }
@Override public T pop() { T object = stack[index - 1]; index--; return object; }
FixedStack implements IStack<T> { @Override public T pop() { T object = stack[index - 1]; index--; return object; } }
FixedStack implements IStack<T> { @Override public T pop() { T object = stack[index - 1]; index--; return object; } @SuppressWarnings("unchecked")  FixedStack(int size); }
FixedStack implements IStack<T> { @Override public T pop() { T object = stack[index - 1]; index--; return object; } @SuppressWarnings("unchecked")  FixedStack(int size); @Override void push(T element); @Override T peek(); @Override T pop(); @Override int size(); @Override boolean isEmpty(); @Override void clear(); @Override final T[] toArray(Class<T[]> arrayType); }
FixedStack implements IStack<T> { @Override public T pop() { T object = stack[index - 1]; index--; return object; } @SuppressWarnings("unchecked")  FixedStack(int size); @Override void push(T element); @Override T peek(); @Override T pop(); @Override int size(); @Override boolean isEmpty(); @Override void clear(); @Override final T[] toArray(Class<T[]> arrayType);  }