Java tutorial
//package com.java2s; /* * Copyright 2015, Yahoo Inc. * Copyrights licensed under the Apache 2.0 License. * See the accompanying LICENSE file for terms. */ import java.util.Collection; import java.util.Collections; public class Main { /** * A version of {@link Collection#addAll(Collection)} that works on varargs without calling Arrays.asList, which is * a performance and memory boost */ public static <T> void addAll(Collection<T> collection, T... objects) { if (objects != null) { Collections.addAll(collection, objects); } } }