+ 3
What the difference between list & Arraylist
list<String> list =new Arraylist<>() Arraylist<String> arraylist=new Arraylist<>()
7 Answers
+ 2
thanks
+ 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<>();
0
List is interface. ArrayList implements List, such as LinkedList or Vector. ArrayList is a good alternative traditional array.
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
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.
0
your right, I said list.. I meant standard arrays are a fixed size
0
Thanks a lot