Here you can find the source of toCollection(C c, E... elements)
@SafeVarargs public static <E, C extends Collection<E>> C toCollection(C c, E... elements)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { @SafeVarargs public static <E, C extends Collection<E>> C toCollection(C c, E... elements) { if (elements != null) { for (E element : elements) { c.add(element);/* w ww. j a v a 2 s .com*/ } } return c; } }