What the difference between list & Arraylist | Sololearn: Learn to code for FREE!


What the difference between list & Arraylist

list<String> list =new Arraylist<>() Arraylist<String> arraylist=new Arraylist<>()

3/19/2017 11:01:26 AM

Ali Hasan

7 Answers

New Answer




List is just an interface. You cannot write List<String> list = new List<>(); The List interface is also implemented by the LinkedList class, so you have the advantage to easily change between both, e.g. List<String> list = null; list = new ArrayList<>(); list = new LinkedList<>();


List is interface. ArrayList implements List, such as LinkedList or Vector. ArrayList is a good alternative traditional array.


my biggest difference (why I choose one over the other) is what I'm doing. ArrayList can change in size. so if i am using it to store new information as I get it I use an arraylist. lists having a set size, but imo are easier to work with, are better suited for pre-set lists


@Justin In Java both the ArrayList and the LinkedList can grow. They only have differences in their performance (at least for the user). While ArrayLists are access-oriented, LinkedLists are faster when performing add and remove operations.


your right, I said list.. I meant standard arrays are a fixed size


Thanks a lot