Copies the content of the collection to an array.

@param coll the collection
@return the array
542979
public static long[] longArrayCopyOf(CollectionNumber coll) {
        long[] data = new long[coll.size()];
        IteratorNumber iter = coll.iterator();
        int index = 0;
        while (iter.hasNext()) {
            data[index] = iter.nextLong();
            index++;
        }
        return data;
    }
246128
@Nullable
  @ReturnsMutableCopy
  public static Object [] getAsObjectArray (@Nullable final Collection <?> aCollection)
  {
    if (CollectionHelper.isEmpty (aCollection))
      return null;

    final Object [] ret = new Object [aCollection.size ()];
    return aCollection.toArray (ret);
  }
192156
private function setCollection(PersistentCollectionInterface $coll)
    {
        list($qb, $path, $parent) = $this->getQueryPathAndParent($coll);

        $coll->initialize();

        $path->set($coll);
        $this->executeQuery($qb, $parent);
    }
805968
private boolean containsElements(final Collection<?> coll) {
        if (coll == null || coll.isEmpty()) {
            return false;
        }
        for (final Object name : coll) {
            if (name != null) {
                return true;
            }
        }
        return false;
    }
266046
public Set<T> newColl(Collection<T> coll) {
	Set<T> newSet = this.create();
	newSet.addAll(coll);
	return newSet;
    }
428004
private void buildIndex(Collection<?> coll) {
        certSubjects = new HashMap<X500Principal, Object>();
        crlIssuers = new HashMap<X500Principal, Object>();
        otherCertificates = null;
        otherCRLs = null;
        for (Object obj : coll) {
            if (obj instanceof X509Certificate) {
                indexCertificate((X509Certificate)obj);
            } else if (obj instanceof X509CRL) {
                indexCRL((X509CRL)obj);
            } else if (obj instanceof Certificate) {
                if (otherCertificates == null) {
                    otherCertificates = new HashSet<Certificate>();
                }
                otherCertificates.add((Certificate)obj);
            } else if (obj instanceof CRL) {
                if (otherCRLs == null) {
                    otherCRLs = new HashSet<CRL>();
                }
                otherCRLs.add((CRL)obj);
            } else {
                // ignore
            }
        }
        if (otherCertificates == null) {
            otherCertificates = Collections.<Certificate>emptySet();
        }
        if (otherCRLs == null) {
            otherCRLs = Collections.<CRL>emptySet();
        }
    }
345186
@ReplacedBy("com.google.common.collect.Iterables#toArray()")
    public static <T> T[] toArray (Collection<? extends T> col, Class<T> type)
    {
        @SuppressWarnings("unchecked")
        T[] array = (T[]) Array.newInstance(type, col.size());
        return col.toArray(array);
    }
1326599
public char[] toCharacterArray() {
    char[] copy = new char[size];
    for (int i = 0; i < size; i++) {
      copy[i] = elements[i];
    }
    return copy;
  }
46218
public boolean addAll(Collection<T> coll) {
	boolean newData = false;
	for(T elem : coll) {
	    if(set.add(elem)) {
		newData = true;
	    }
	}
	return newData;
    }
142096
public static <T> C.List<T> toList(Collection<? extends T> col) {
        if (col.size() == 0) {
            return Nil.list();
        }
        if (col instanceof C.List) {
            C.List<T> list = $.cast(col);
            if (list.is(C.Feature.IMMUTABLE)) {
                return list;
            }
        }
        return new ListBuilder<T>(col).toList();
    }
849302
@SuppressWarnings("unchecked")
	@Override
	public Collection<String> getCopyFields() {

		Indexed indexedAnnotation = getIndexAnnotation();
		if (indexedAnnotation != null && indexedAnnotation.copyTo().length > 0) {
			return CollectionUtils.arrayToList(indexedAnnotation.copyTo());
		}
		return Collections.emptyList();
	}
886125
@SuppressWarnings("unchecked")
	public static <T> T[] toArray(T[] source, Collection<? extends T> newContent) {
		final Object array = Array.newInstance(source.getClass().getComponentType(), newContent.size());
		int i = 0;
		for (final T element : newContent) {
			Array.set(array, i, element);
			++i;
		}
		return (T[]) array;
	}
923513
public function update(PersistentCollection $coll, array $options)
    {
        $mapping = $coll->getMapping();

        if ($mapping['isInverseSide']) {
            return; // ignore inverse side
        }

        switch ($mapping['strategy']) {
            case 'set':
            case 'setArray':
                $coll->initialize();
                $this->setCollection($coll, $options);
                break;

            case 'addToSet':
            case 'pushAll':
                $coll->initialize();
                $this->deleteElements($coll, $options);
                $this->insertElements($coll, $options);
                break;

            default:
                throw new \UnexpectedValueException('Unsupported collection strategy: ' . $mapping['strategy']);
        }
    }
936625
private List<String> copyToList(Collection<String> collection) {
 
        if ((collection == null) || collection.isEmpty()) {
            return null;
        }

       return Collections.unmodifiableList(new ArrayList<String>(collection));
    }
865217
public static String[] unboxStrings(Collection<String> coll) {
    return coll.toArray(new String[coll.size()]);
  }
98360
public static short[] shortArrayCopyOf(CollectionNumber coll) {
        short[] data = new short[coll.size()];
        IteratorNumber iter = coll.iterator();
        int index = 0;
        while (iter.hasNext()) {
            data[index] = iter.nextShort();
            index++;
        }
        return data;
    }
416105
@Override
    public Object getCollection(Object coll, String key) throws PageException {
	return variableUtil.getCollection(this, coll, key);
    }