1. package cop3530; public interface List { boolean contains( AnyType x ); int size( ); boolean isEmpty( ); void add( AnyType x ); void clear( ); } 2. package cop3530; public class ArrayList implements List { private AnyType [ ] items; private int theSize; public ArrayList( ) { items = (AnyType []) new Object[ 5 ]; theSize = 0; } // Required for Version A only public boolean contains( AnyType x ) { for( int i = 0; i < theSize; i++ ) if( items[ i ].equals( x ) ) return true; return false; } // Required for Version B only public void add( AnyType x ) { if( theSize == items.length ) { AnyType [ ] old = items; items = (AnyType []) new Object[ old.length * 2 + 1 ]; for( int i = 0; i < old.length; i++ ) items[ i ] = old[ i ]; } items[ theSize++ ] = x; } ... }