List<String> list = new ArrayList<String>();
ArrayList<String> list = new ArrayList<String>();
Which one is preferable? and why?
List<String> list = new ArrayList<String>();
ArrayList<String> list = new ArrayList<String>();
Which one is preferable? and why?
If you use Arraylist, it will be for arraylist only. however if you use List it can be also used for Linkedlist. Also if you use list, the other function of arraylist will be shadowed.
I preferred the List Implementation when function only using to add,remove and get values on the ArrayList.