All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.thksystems.util.collection.CollectionUtils Maven / Gradle / Ivy

Go to download

Commons for lang, crypto, xml, dom, text, csv, reflection, annotations, parsing, ...

There is a newer version: 4.3.3
Show newest version
/*
 * tksCommons
 *
 * Author  : Thomas Kuhlmann (ThK-Systems, http://www.thk-systems.de)
 * License : LGPL (https://www.gnu.org/licenses/lgpl.html)
 */

package de.thksystems.util.collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

public final class CollectionUtils {

    private CollectionUtils() {
    }

    /**
     * Creates a new {@link ArrayList} with the given entries.
     */
    @SafeVarargs
    public static  List createArrayList(T... entries) {
        return addToCollection(new ArrayList<>(), entries);
    }

    /**
     * Adds all entries to the given {@link Collection}.
     */
    @SafeVarargs
    public static > C addToCollection(C collection, T... entries) {
        Collections.addAll(collection, entries);
        return collection;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy