LinkedList in Java
LinkedList in Java
Introduction [1]
Each element in the LinkedList is called the Node. Each Node of the LinkedList
contains two items:
1) Content of the element
2) Pointer/Address/Reference to the Next Node in the LinkedList.
Note:
1. Head of the LinkedList only contains the Address of the First element of the
List.
2. The Last element of the LinkedList contains null in the pointer part of the node
because it is the end of the List so it doesn’t point to anything as shown in the
above diagram.
import java.util.*;
public class LinkedListExample {
public static void main(String args[]) {
Reference
[1] https://beginnersbook.com/
[2] https://docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html