LinkedList in Java

A LinkedList is special because it implements both List and Queue. It has all of the methods of a List. It also has additional methods to facilitate adding or removing from the beginning and/or end of the list. The main benefits of a LinkedList are that you can access, add, and remove from the beginning and end of the list in constant time. The trade-off is that dealing with an arbitrary index takes linear time. This makes a LinkedList a good choice when you’ll be using it as Queue.
```
import java.util. * ;
public class Main {
    public static void main(String args[]) {
        LinkedList <String> al = new LinkedList <> (); 
        al.add("a"); 
        al.add("c");
        al.add("b");
        Iterator <String> itr = al.iterator();
        while (itr.hasNext()) {
            System.out.println(itr.next());
        }
    }
}
```