CastorizedList extends AbstractCollection<E> implements List<E> { @Override public E set(int index, E element) { return owner.set(index, element); } CastorizedList(List<E> cl); @Override Iterator<E> iterator(); @Override int size(); @Override boolean add(E element); @Override void add(int index, E element); @Override boolean addAll(int index, Collection<? extends E> c); @Override E get(int index); @Override int indexOf(Object o); @Override int lastIndexOf(Object o); @Override ListIterator<E> listIterator(); @Override ListIterator<E> listIterator(int index); @Override E remove(int index); @Override E set(int index, E element); @Override List<E> subList(int fromIndex, int toIndex);  }
@Test public void testSet() { ArrayList list = new ArrayList(); CastorizedList castor = new CastorizedList(list); Object o = new Object(); castor.add(o); assertEquals(o, castor.set(0, new Object())); }