Java tutorial
//package com.java2s; import java.util.Collection; import java.util.LinkedList; public class Main { public static final <E> LinkedList<E> createLinkedList(E... elements) { LinkedList<E> list = new LinkedList<E>(); addToCollection(list, elements); return list; } public static final <E> void addToCollection(Collection<? super E> collection, E... elements) { for (E e : elements) { collection.add(e); } } }