### Question:
DuplicateOnWriteSimpleCollection implements SimpleCollection<E> { public DuplicateOnWriteSimpleCollection<E> add(E element) { Object[] newElements = Arrays.copyOf(elements, elements.length + 1); newElements[elements.length] = element; return new DuplicateOnWriteSimpleCollection<>(newElements); } private  DuplicateOnWriteSimpleCollection(); private  DuplicateOnWriteSimpleCollection(Object[] collection); @Override int size(); @Override boolean isEmpty(); @Override Iterator<E> iterator(); @Override Iterator<E> structuralIterator(); DuplicateOnWriteSimpleCollection<E> add(E element); DuplicateOnWriteSimpleCollection<E> remove(E element); DuplicateOnWriteSimpleCollection<E> replace(E newElement, E oldElement); static DuplicateOnWriteSimpleCollection<E> create(); static DuplicateOnWriteSimpleCollection<E> create(E[] array);  }### Answer:
@Test public void add() { final DuplicateOnWriteSimpleCollection<String> collection = DuplicateOnWriteSimpleCollection.create(); assertTrue(collection.isEmpty()); final DuplicateOnWriteSimpleCollection<String> modifiedCollection = collection.add("a"); assertEquals(0, collection.size()); assertFalse(collection.iterator().hasNext()); assertFalse(collection.structuralIterator().hasNext()); assertFalse(modifiedCollection.isEmpty()); assertEquals(1, modifiedCollection.size()); assertEquals("a", modifiedCollection.iterator().next()); assertEquals("a", modifiedCollection.structuralIterator().next()); }