r/javahelp • • Apr 30 '20

ArrayList vs LinkedList

So I understand that for different situations, either the ArrayList API or the LinkedList API will be more efficient. So what should I look for in terms of design that will tell me which one of those structures is recommended? Is it more related to preference rather than specific uses?

Thanks!

17 Upvotes

22 comments sorted by

View all comments

3

u/Yithar Intermediate Brewer Apr 30 '20 edited May 21 '20

As stated, you should almost always use ArrayList in Java.

The only time I'd use a List is if I'm doing tail recursion and that List class in Scala is immutable:
https://stackoverflow.com/a/5130311/