Create LinkedList from array - Java Collection Framework

Java examples for Collection Framework:Array Element

Description

Create LinkedList from array

Demo Code


//package com.java2s;

import java.util.LinkedList;

public class Main {
    public static <T> LinkedList<T> linkedListOf(T... objects) {
        final LinkedList<T> list = new LinkedList<T>();
        for (T object : objects) {
            list.add(object);/* ww w .j a  va 2 s . c  o m*/
        }
        return list;
    }
}

Related Tutorials