Here you can find the source of addAll(Collection
array
to collection
.
Parameter | Description |
---|---|
T | the element type |
collection | the receiving collection, to be modified as a side effect |
array | the array to take the values from |
collection
public static <T> Collection<T> addAll(Collection<T> collection, T[] array)
//package com.java2s; //License from project: Apache License import java.util.Collection; public class Main { /**/*from www . j a v a 2 s .com*/ * Adds all elements from <code>array</code> to <code>collection</code>. * * @param <T> the element type * @param collection the receiving collection, to be modified as a side effect * @param array the array to take the values from * @return <code>collection</code> */ public static <T> Collection<T> addAll(Collection<T> collection, T[] array) { for (int i = 0; i < array.length; i++) { collection.add(array[i]); } return collection; } }