Here you can find the source of arrayToCollection(E[] array, C collection)
Parameter | Description |
---|---|
E | a parameter |
C | a parameter |
array | a parameter |
collection | a parameter |
public static <E, C extends Collection<E>> C arrayToCollection(E[] array, C collection)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { /**// w ww .j av a2s. c om * Constructs a new java.util.Collection that will contain the given array elements. * * @param <E> * @param <C> * @param array * @param collection * @return */ public static <E, C extends Collection<E>> C arrayToCollection(E[] array, C collection) { collection.clear(); for (E e : array) { collection.add(e); } return collection; } }