Java Scrap Book  

Java Scrap Book > Java Collection > Overview of LinkedList

Overview of LinkedList

  • The LinkedList class extends AbstractSequentialList and implements the List,Deque interface.
  • LinkedList is not synchronized.LinkedList could be synchronized by Collections.synchronizedList method.
  • e.g List list = Collections.synchronizedList(new LinkedList());


LinkedList

package com.javascrapbook.LinkedList;
import java.util.LinkedList;
public class  LinkedListDemo {
   public static void main(String[] a) {
     LinkedList lList = new LinkedList();
     lList.add("java");
     lList.add("scrap");
     lList.add("List");
    System.out.println("First Element of LinkedList " + lList.getFirst());
    System.out.println("Last Element of LinkedList "+lList.getLast());
  }
}


Result

First Element of LinkedList java
Last Element of LinkedList List

javascrapbook.com  © Copyright 2013
javascrapbook.com is a computer science content service should not be treated as the publisher or speaker of any information provided by another Computer Science content provider.

Contact email: help@javascrapbook.com