### Question:
ArrayList extends List<E> { @Override public boolean contains(E object) { int lastIndex = firstIndex + itemCount; if (object != null) { for (int i = firstIndex; i < lastIndex; i++) { if (object.equals(array[i])) { return true; } } } else { for (int i = firstIndex; i < lastIndex; i++) { if (array[i] == null) { return true; } } } return false; } ArrayList();  ArrayList(int capacity);  ArrayList(Collection<E> collection);  ArrayList(E... args); @Override void add(int location, E object); @Override boolean add(E object); @Override boolean addAll(int location, Collection<? extends E> collection); @Override boolean addAll(Collection<? extends E> collection); @Override void clear(); @Override boolean contains(E object); void ensureCapacity(int minimumCapacity); @Override E get(int location); @Override int indexOf(E object); @Override boolean isEmpty(); @Override int lastIndexOf(E object); @Override Iterator<E> iterator(); @Override E remove(int location); @Override boolean remove(E object); @Override E set(int location, E object); @Override int size(); @Override Object[] toArray(); @Override void toArray(E[] contents); void sortInPlace(Comparator<E> comparator); void trimToSize();  }### Answer:
@Test public void testConstructorWithConcurrentCollection() { Collection<String> collection = shrinksOnSize("A", "B", "C", "D"); ArrayList<String> list = new ArrayList<String>(collection); assertFalse(list.contains(null)); }
@Test public void testContains() { assertTrue("Returned false for valid element", alist.contains(objArray[99])); assertTrue("Returned false for equal element", alist.contains(8)); assertTrue("Returned true for invalid element", !alist.contains(new Object())); assertTrue("Returned true for null but should have returned false", !alist.contains(null)); alist.add(null); assertTrue("Returned false for null but should have returned true", alist.contains(null)); }