LinkedList in Java is a linear data structure (like a stack), but instead of storage of data elements contiguous, each item of LinkedList is stored separately with the help of pointer. The data structure is a fast and efficient way to store and organize data. Each item is known as a node, and the node consists of two parts-data part and the pointer part. Every pointer points to the address of the next node. The last node of the LinkedList points to NULL.
In Java, the LinkedList class implements the List interface, and this class uses a doubly linked list to store the data elements.
See the following figure.
Unlike a regular linked list, the doubly linked list consists of there part in each node- previous pointer, data part, and next pointer.
#java #linkedlist #java linkedlist