Linked List in java is a set of two information. The first part contains the value and the second part consists of the reference of the next node. The first node is better known as the start node. The last node of it consists of null because the last node need not to refer to any node. It inherits the Abstract class and implements a list form. We can better denote it with a train, where start is the engine and the last node null value is the cross mark of the trains last compartment. LinkList allocates dynamically which results to consumption of space as well as time. Avoids haphazard storage of values.
Few points to be noted:
Doubly LinkList is the set consisting of three parts the first part contains the reference of the previous node, the second part consists of the info part inserted by the user and the third and the last part consists of the reference value referring to the next node available.
Method to declare a LinkList is:
public class LinkedList extends AbstractSequentialList implements List, Deque, Cloneable, Serializable
Few points to be noted:
- It can contain duplicate elements
- It maintains order of insertion
- It is a non-synchronized form
- Scene there is no shifting so compiling time is less
- It can either be used as a link-list, stack or queue
- Singly LinkList
- Doubly LinkList
Doubly LinkList is the set consisting of three parts the first part contains the reference of the previous node, the second part consists of the info part inserted by the user and the third and the last part consists of the reference value referring to the next node available.
Method to declare a LinkList is:
public class LinkedList
EmoticonEmoticon