Create new Linked List - Java java.util

Java examples for java.util:List Creation

Description

Create new Linked List

Demo Code


//package com.java2s;

import java.util.Collection;

import java.util.LinkedList;

public class Main {
    public static void main(String[] argv) {
        System.out.println(newLinkedList());
    }// ww  w  .jav a  2 s  .  c om

    public static <E> LinkedList<E> newLinkedList() {
        return new LinkedList<E>();
    }

    public static <E> LinkedList<E> newLinkedList(
            final Collection<? extends E> c) {
        return new LinkedList<E>(c);
    }
}

Related Tutorials