### Question:
KTypeStack extends KTypeArrayList<KType> { public void discard(int count) { assert elementsCount >= count; elementsCount -= count; Arrays.fill(buffer, elementsCount, elementsCount + count, null); } KTypeStack();  KTypeStack(int expectedElements);  KTypeStack(int expectedElements, ArraySizingStrategy resizer);  KTypeStack(KTypeContainer<KType> container); void push(KType e1); void push(KType e1, KType e2); void push(KType e1, KType e2, KType e3); void push(KType e1, KType e2, KType e3, KType e4); void push(KType[] elements, int start, int len); @SafeVarargs /* #end */ final void push(KType... elements); int pushAll(KTypeContainer<? extends KType> container); int pushAll(Iterable<? extends KTypeCursor<? extends KType>> iterable); void discard(int count); void discard(); KType pop(); KType peek(); @SafeVarargs /* #end */ static KTypeStack<KType> from(KType... elements); @Override KTypeStack<KType> clone();  }### Answer:
@Test public void testDiscard() { stack.push(key1, key3); assertEquals(2, stack.size()); stack.discard(); assertEquals(1, stack.size()); stack.push(key4); assertEquals(2, stack.size()); assertEquals2(1, stack.get(0)); assertEquals2(4, stack.get(1)); stack.discard(2); assertEquals(0, stack.size()); }