ImmutableAppendedList implements List<T> { @Override public boolean contains( Object o ) { return element == o || (element != null && element.equals(o)) || parent.contains(o); } ImmutableAppendedList( List<T> parent,
                                  T element ); @Override boolean contains( Object o ); @Override boolean containsAll( Collection<?> c ); @Override T get( int index ); @Override int indexOf( Object o ); @Override boolean isEmpty(); @Override @SuppressWarnings( "synthetic-access" ) Iterator<T> iterator(); @Override int lastIndexOf( Object o ); @Override ListIterator<T> listIterator(); @Override @SuppressWarnings( "synthetic-access" ) ListIterator<T> listIterator( final int index ); @Override int size(); @Override List<T> subList( int fromIndex,
                            int toIndex ); @Override Object[] toArray(); @Override @SuppressWarnings( "unchecked" ) X[] toArray( X[] a ); @Override int hashCode(); @Override boolean equals( Object obj ); @Override String toString(); @Override void add( int index,
                     T element ); @Override boolean add( T o ); @Override boolean addAll( Collection<? extends T> c ); @Override boolean addAll( int index,
                           Collection<? extends T> c ); @Override void clear(); @Override boolean remove( Object o ); @Override T remove( int index ); @Override boolean removeAll( Collection<?> c ); @Override boolean retainAll( Collection<?> c ); @Override T set( int index,
                  T element );  }
@Test public void shouldContainEachValue() { for (int i = 0; i != data.length; ++i) { String value = data[i]; assertThat(list.contains(value), is(true)); } }
@Test public void shouldNotContainValuesThatAreNotInList() { assertThat(list.contains("not found"), is(false)); assertThat(list.contains(null), is(false)); }