Accounting Basics Tutorial


Java Collections LinkedList

Linked List

Java LinkedList class uses doubly linked list to store the elements. It extends the AbstractList class and implements List and Deque interfaces.
    Java LinkedList class can contain duplicate elements.
    Java LinkedList class maintains insertion order.
    Java LinkedList class is non synchronized.
    In Java LinkedList class, manipulation is fast because no shifting needs to be occurred.
    Java LinkedList class can be used as list, stack or queue.

WRITE A PROGRAM ON LINKED LIST CLASS.
import java.util.*;
class Sample
{
        public static void main(String args[])
        {
                LinkedList <String>l1=new LinkedList<String>();
                l1.add("f1");
                l1.add("B");
                l1.add("E");
                l1.add("C");
                l1.add("A");
                l1.add(1,"A2");
                System.out.println(l1);
                l1.remove("f");
                l1.remove(2);
                l1.removeFirst();
                l1.removeLast();
                System.out.println(l1);
        }
}



google ads place