ConformerContainer implements List<IAtomContainer> { @Override public Object[] toArray() { IAtomContainer[] ret = new IAtomContainer[coordinates.size()]; int index = 0; for (Point3d[] coords : coordinates) { try { IAtomContainer conf = (IAtomContainer) atomContainer.clone(); for (int i = 0; i < coords.length; i++) { IAtom atom = conf.getAtom(i); atom.setPoint3d(coords[i]); } ret[index++] = conf; } catch (CloneNotSupportedException e) { e.printStackTrace(); } } return ret; } ConformerContainer();  ConformerContainer(IAtomContainer atomContainer);  ConformerContainer(IAtomContainer[] atomContainers); String getTitle(); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override Iterator<IAtomContainer> iterator(); @Override Object[] toArray(); @Override IAtomContainer[] toArray(IAtomContainer[] ts); @Override boolean add(IAtomContainer atomContainer); @Override boolean remove(Object o); @Override boolean containsAll(Collection<?> objects); @Override boolean addAll(Collection<? extends IAtomContainer> atomContainers); @Override boolean addAll(int i, Collection<? extends IAtomContainer> iAtomContainers); @Override boolean removeAll(Collection<?> objects); @Override boolean retainAll(Collection<?> objects); @Override void clear(); @Override IAtomContainer get(int i); @Override IAtomContainer set(int i, IAtomContainer atomContainer); @Override void add(int i, IAtomContainer atomContainer); @Override IAtomContainer remove(int i); @Override int indexOf(Object o); @Override int lastIndexOf(Object o); @Override ListIterator<IAtomContainer> listIterator(); @Override ListIterator<IAtomContainer> listIterator(int i); @Override List<IAtomContainer> subList(int i, int i1);  }
@Test public void testToArray() { ConformerContainer container = new ConformerContainer(confs); IAtomContainer[] array = (IAtomContainer[]) container.toArray(); Assert.assertEquals(nconfs, array.length); }
@Test(expected = UnsupportedOperationException.class) public void testToArray_arrayObject() { ConformerContainer container = new ConformerContainer(confs); container.toArray(new IAtomContainer[]{}); }