Java LinkedList Create newLinkedList(Collection initData)

Here you can find the source of newLinkedList(Collection initData)

Description

new Linked List

License

Apache License

Declaration

public static <T> LinkedList<T> newLinkedList(Collection<T> initData) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {
    public static <T> LinkedList<T> newLinkedList() {
        return new LinkedList<T>();
    }//from w  w  w .  j a v a2s .  c  om

    public static <T> LinkedList<T> newLinkedList(Collection<T> initData) {
        return new LinkedList<T>(initData);
    }

    public static <T> LinkedList<T> newLinkedList(T[] initData) {
        LinkedList<T> ret = new LinkedList<T>();
        for (T t : initData) {
            ret.add(t);
        }
        return ret;
    }
}

Related

  1. createLinkedList(E... array)
  2. createLinkedList(Iterable c)
  3. crossProductInternal(int i, Object[][] arrays, Object[] work, LinkedList ret)
  4. newLinkedList(Collection c)
  5. newLinkedList(E... elements)
  6. newLinkedList(T... elements)
  7. prependAll(List ofList, LinkedList toList)