What is List in Java?
List is class in which we can do modifications. In this we can do many methods like size, length, method, sorting, searching.
There are two types :
Array list:
In array list we can do methods like size, search, sorting using collection and collections.
For example:
Arraylist a = new Arraylist();
a[0]=(100);
a[1]=(100);
a[2]=(1000);
System.out.println(a.size[i]); }
Output: 2
Linked list: In linked list, We have two blocks in first blocks store actual data and second block stores address of next data.
There are two linked list:
Singly Linked list: In this, we can follow or read data from one side only and there are two blocks in which one stores data and other stores address of next data.
Doubly linked list:
In this, we can store data and two address i.e. previous and next. There is three blocks in which middle block consists of data and first block consists of address of previous data and third block consists of address of next data.