On which basis should we choose to use List, LinkedList, ArrayList in Java?.
Also please explain which one is better to use?.
On which basis should we choose to use List, LinkedList, ArrayList in Java?.
Also please explain which one is better to use?.
List is an interface, it should be the type of your variables or the arguments of your methods.
The other two are implementations of this interface.
LinkedList is optimized for inserts and deletes.
ArrayList is optimized for random access.
So, you can choose based on the kind of work you are going to do.