/** * Array of all the elements. * * @return an array containing all of the elements in this collection. */ public Object[] toArray() { // code based on AbstractFeatureCollection // TODO: base this on reader ArrayList<SimpleFeature> array = new ArrayList<SimpleFeature>(); Iterator<SimpleFeature> e = null; try { e = iterator(); while( e.hasNext() ){ array.add( e.next() ); } return array.toArray( new SimpleFeature[array.size()]); } finally { close( e ); } }
/** * Returns <tt>true</tt> if this collection contains all of the elements * in the specified collection. <p> * * @param c collection to be checked for containment in this collection. * @return <tt>true</tt> if this collection contains all of the elements * in the specified collection. * @throws NullPointerException if the specified collection is null. * * @see #contains(Object) */ public boolean containsAll(Collection<?> c) { // TODO: base this on reader Iterator<?> e = c.iterator(); try { while (e.hasNext()){ if(!contains(e.next())){ return false; } } return true; } finally { close( e ); } }
public <T> T[] toArray(T[] array) { int size = size(); if (array.length < size){ array = (T[])java.lang.reflect.Array.newInstance(array.getClass().getComponentType(), size); } Iterator<SimpleFeature> it = iterator(); try { Object[] result = array; for (int i=0; it.hasNext() && i<size; i++){ result[i] = it.next(); } if (array.length > size){ array[size] = null; } return array; } finally { close( it ); } } public String getID() {