Create LinkedList

ConstructorSummary
LinkedList()Creates an empty list.
LinkedList(Collection<? extends E> c) Creates a list containing the elements of the specified collection, in the order they are returned by the collection's iterator.

  import java.util.LinkedList;

public class Main{
    public static void main(String args[]) {

        LinkedList<String> ll = new LinkedList<String>();

        ll.add("A");
        ll.add("B");
        ll.add("ja v a2s.com");
        ll.add("E");
        ll.add("F");

        System.out.println(ll);
    }
}
  

The output:


[A, B, ja v a2s.com, E, F]
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.