+ 3

What the difference between list & Arraylist

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

19th Mar 2017, 11:01 AM
Ali Hasan
Ali Hasan - avatar
7 Respostas
+ 2
thanks
19th Mar 2017, 11:32 AM
Ali Hasan
Ali Hasan - avatar
+ 1
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<>();
19th Mar 2017, 11:09 AM
merkrafter
0
List is interface. ArrayList implements List, such as LinkedList or Vector. ArrayList is a good alternative traditional array.
19th Mar 2017, 12:25 PM
Sergey L.
0
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
19th Mar 2017, 1:17 PM
LordHill
LordHill - avatar
0
@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.
19th Mar 2017, 1:21 PM
merkrafter
0
your right, I said list.. I meant standard arrays are a fixed size
19th Mar 2017, 1:22 PM
LordHill
LordHill - avatar
0
Thanks a lot
5th Apr 2017, 9:33 AM
Aleksandr Smirnov
Aleksandr Smirnov - avatar