FullList implements List<E> { @Override public void clear() { this.list.clear(); } private  FullList(final E blankElement, final int capacity); static FullListBuilder<F> builder(); static FullList<F> newList(final F... elements); static FullList<F> newListWithCapacity(final int capacity); static FullList<F> newListWithCapacity(final int capacity, final F... elements); @Override boolean add(final E e); @Override void add(final int index, final E element); @Override boolean addAll(final Collection<? extends E> c); @Override boolean addAll(final int index, final Collection<? extends E> c); @Override void clear(); @Override boolean contains(final Object o); @Override boolean containsAll(final Collection<?> c); @Override boolean equals(final Object o); @Override E get(final int index); @Override int hashCode(); @Override int indexOf(final Object o); @Override boolean isEmpty(); @Override Iterator<E> iterator(); @Override int lastIndexOf(final Object o); @Override ListIterator<E> listIterator(); @Override ListIterator<E> listIterator(final int index); @Override E remove(final int index); @Override boolean remove(final Object o); @Override boolean removeAll(final Collection<?> c); @Override boolean retainAll(final Collection<?> c); @Override E set(final int index, final E element); @Override int size(); int usedSize(); @Override List<E> subList(final int fromIndex, final int toIndex); @Override Object[] toArray(); @Override T[] toArray(final T[] a); @Override String toString(); int capacity();  }
@Test public final void testClear() { final String be = "blank"; final FullList<String> fl = FullList.<String>builder().blankElement(be).capacity(10).build(); fl.set(100, "non blank2"); fl.clear(); Assert.assertEquals(0, fl.usedSize()); Assert.assertFalse(fl.isEmpty()); Assert.assertEquals(be, fl.get(100)); }