ListView implements List<T> { @Override public T get(final int arg0) { return (T)this.list.get(arg0); } ListView(final List<?> list);  ListView(final List<?> list, final Class<T> clazz); @Override boolean add(final T arg0); @Override void add(final int arg0, final T arg1); @Override boolean addAll(final Collection<? extends T> arg0); @Override boolean addAll(final int arg0, final Collection<? extends T> arg1); @Override void clear(); @Override boolean contains(final Object arg0); @Override boolean containsAll(final Collection<?> arg0); @Override T get(final int arg0); @Override int indexOf(final Object arg0); @Override boolean isEmpty(); @Override Iterator<T> iterator(); @Override int lastIndexOf(final Object arg0); @Override ListIterator<T> listIterator(); @Override ListIterator<T> listIterator(final int arg0); @Override boolean remove(final Object arg0); @Override T remove(final int arg0); @Override boolean removeAll(final Collection<?> arg0); @Override boolean retainAll(final Collection<?> arg0); @Override T set(final int arg0, final T arg1); @Override int size(); @Override List<T> subList(final int arg0, final int arg1); @Override Object[] toArray(); @Override S[] toArray(final S[] arg0);  }
@Test public void testNumberList() { List<Number> l = Arrays.asList(2, 4, 6, 8, 10); List<Integer> l2 = new ListView<>(l); int index = 0; for (int i : l2) { assertEquals(i, l.get(index)); index ++; } }