Summary ArrayList with ArrayDeque are preferable in many more use-cases than LinkedList. If you're not sure โ€” just start with ArrayList.


TLDR, in ArrayList accessing an element takes constant time [O(1)] and adding an element takes O(n) time [worst case]. In LinkedList inserting an element takes O(n) time and accessing also takes O(n) time but LinkedList uses more memory than ArrayList.

LinkedList and ArrayList are two different implementations of the List interface. LinkedList implements it with a doubly-linked list. ArrayList implements it with a dynamically re-sizing array.

As with standard linked list and array operations, the various methods will have different algorithmic runtimes.

For LinkedList<E>

  • get(int index) is O(n) (with n/4 steps on average), but O(1) when index = 0 or index = list.size() - 1 (in this case, you can also use getFirst() and getLast()).
  • add(int index, E element) is O(n) (with n/4 steps on average), but O(1) when index = 0 or index = list.size() - 1 (in this case, you can also use addFirst() and addLast()/add()). One of the main benefits of LinkedList<E>
  • remove(int index) is O(n) (with n/4 steps on average), but O(1) when index = 0 or index = list.size() - 1 (in this case, you can also use removeFirst() and removeLast()). One of the main benefits of LinkedList<E>
  • Iterator.remove() is O(1). One of the main benefits of LinkedList<E>
  • ListIterator.add(E element) is O(1). One of the main benefits of LinkedList<E>

Note: Many of the operations need n/4 steps on average, constant number of steps in the best case (e.g. index = 0), and n/2 steps in worst case (middle of list)

For ArrayList<E>

  • get(int index) is O(1). Main benefit of ArrayList<E>
  • add(E element) is O(1) amortized, but O(n) worst-case since the array must be resized and copied
  • add(int index, E element) is O(n) (with n/2 steps on average)
  • remove(int index) is O(n) (with n/2 steps on average)
  • Iterator.remove() is O(n) (with n/2 steps on average)
  • ListIterator.add(E element) is O(n) (with n/2 steps on average)

Note: Many of the operations need n/2 steps on average, constant number of steps in the best case (end of list), n steps in the worst case (start of list)

LinkedList<E> allows for constant-time insertions or removals using iterators, but only sequential access of elements. In other words, you can walk the list forwards or backwards, but finding a position in the list takes time proportional to the size of the list. Javadoc says "operations that index into the list will traverse the list from the beginning or the end, whichever is closer", so those methods are O(n) (n/4 steps) on average, though O(1) for index = 0.

ArrayList<E>, on the other hand, allow fast random read access, so you can grab any element in constant time. But adding or removing from anywhere but the end requires shifting all the latter elements over, either to make an opening or fill the gap. Also, if you add more elements than the capacity of the underlying array, a new array (1.5 times the size) is allocated, and the old array is copied to the new one, so adding to an ArrayList is O(n) in the worst case but constant on average.

So depending on the operations you intend to do, you should choose the implementations accordingly. Iterating over either kind of List is practically equally cheap. (Iterating over an ArrayList is technically faster, but unless you're doing something really performance-sensitive, you shouldn't worry about this -- they're both constants.)

The main benefits of using a LinkedList arise when you re-use existing iterators to insert and remove elements. These operations can then be done in O(1) by changing the list locally only. In an array list, the remainder of the array needs to be moved (i.e. copied). On the other side, seeking in a LinkedList means following the links in O(n) (n/2 steps) for worst case, whereas in an ArrayList the desired position can be computed mathematically and accessed in O(1).

Another benefit of using a LinkedList arises when you add or remove from the head of the list, since those operations are O(1), while they are O(n) for ArrayList. Note that ArrayDeque may be a good alternative to LinkedList for adding and removing from the head, but it is not a List.

Also, if you have large lists, keep in mind that memory usage is also different. Each element of a LinkedList has more overhead since pointers to the next and previous elements are also stored. ArrayLists don't have this overhead. However, ArrayLists take up as much memory as is allocated for the capacity, regardless of whether elements have actually been added.

The default initial capacity of an ArrayList is pretty small (10 from Java 1.4 - 1.8). But since the underlying implementation is an array, the array must be resized if you add a lot of elements. To avoid the high cost of resizing when you know you're going to add a lot of elements, construct the ArrayList with a higher initial capacity.

If the data structures perspective is used to understand the two structures, a LinkedList is basically a sequential data structure which contains a head Node. The Node is a wrapper for two components : a value of type T [accepted through generics] and another reference to the Node linked to it. So, we can assert it is a recursive data structure (a Node contains another Node which has another Node and so on...). Addition of elements takes linear time in LinkedList as stated above.

An ArrayList is a growable array. It is just like a regular array. Under the hood, when an element is added, and the ArrayList is already full to capacity, it creates another array with a size which is greater than previous size. The elements are then copied from previous array to new one and the elements that are to be added are also placed at the specified indices.

Top answer
1 of 16
3899

Summary ArrayList with ArrayDeque are preferable in many more use-cases than LinkedList. If you're not sure โ€” just start with ArrayList.


TLDR, in ArrayList accessing an element takes constant time [O(1)] and adding an element takes O(n) time [worst case]. In LinkedList inserting an element takes O(n) time and accessing also takes O(n) time but LinkedList uses more memory than ArrayList.

LinkedList and ArrayList are two different implementations of the List interface. LinkedList implements it with a doubly-linked list. ArrayList implements it with a dynamically re-sizing array.

As with standard linked list and array operations, the various methods will have different algorithmic runtimes.

For LinkedList<E>

  • get(int index) is O(n) (with n/4 steps on average), but O(1) when index = 0 or index = list.size() - 1 (in this case, you can also use getFirst() and getLast()).
  • add(int index, E element) is O(n) (with n/4 steps on average), but O(1) when index = 0 or index = list.size() - 1 (in this case, you can also use addFirst() and addLast()/add()). One of the main benefits of LinkedList<E>
  • remove(int index) is O(n) (with n/4 steps on average), but O(1) when index = 0 or index = list.size() - 1 (in this case, you can also use removeFirst() and removeLast()). One of the main benefits of LinkedList<E>
  • Iterator.remove() is O(1). One of the main benefits of LinkedList<E>
  • ListIterator.add(E element) is O(1). One of the main benefits of LinkedList<E>

Note: Many of the operations need n/4 steps on average, constant number of steps in the best case (e.g. index = 0), and n/2 steps in worst case (middle of list)

For ArrayList<E>

  • get(int index) is O(1). Main benefit of ArrayList<E>
  • add(E element) is O(1) amortized, but O(n) worst-case since the array must be resized and copied
  • add(int index, E element) is O(n) (with n/2 steps on average)
  • remove(int index) is O(n) (with n/2 steps on average)
  • Iterator.remove() is O(n) (with n/2 steps on average)
  • ListIterator.add(E element) is O(n) (with n/2 steps on average)

Note: Many of the operations need n/2 steps on average, constant number of steps in the best case (end of list), n steps in the worst case (start of list)

LinkedList<E> allows for constant-time insertions or removals using iterators, but only sequential access of elements. In other words, you can walk the list forwards or backwards, but finding a position in the list takes time proportional to the size of the list. Javadoc says "operations that index into the list will traverse the list from the beginning or the end, whichever is closer", so those methods are O(n) (n/4 steps) on average, though O(1) for index = 0.

ArrayList<E>, on the other hand, allow fast random read access, so you can grab any element in constant time. But adding or removing from anywhere but the end requires shifting all the latter elements over, either to make an opening or fill the gap. Also, if you add more elements than the capacity of the underlying array, a new array (1.5 times the size) is allocated, and the old array is copied to the new one, so adding to an ArrayList is O(n) in the worst case but constant on average.

So depending on the operations you intend to do, you should choose the implementations accordingly. Iterating over either kind of List is practically equally cheap. (Iterating over an ArrayList is technically faster, but unless you're doing something really performance-sensitive, you shouldn't worry about this -- they're both constants.)

The main benefits of using a LinkedList arise when you re-use existing iterators to insert and remove elements. These operations can then be done in O(1) by changing the list locally only. In an array list, the remainder of the array needs to be moved (i.e. copied). On the other side, seeking in a LinkedList means following the links in O(n) (n/2 steps) for worst case, whereas in an ArrayList the desired position can be computed mathematically and accessed in O(1).

Another benefit of using a LinkedList arises when you add or remove from the head of the list, since those operations are O(1), while they are O(n) for ArrayList. Note that ArrayDeque may be a good alternative to LinkedList for adding and removing from the head, but it is not a List.

Also, if you have large lists, keep in mind that memory usage is also different. Each element of a LinkedList has more overhead since pointers to the next and previous elements are also stored. ArrayLists don't have this overhead. However, ArrayLists take up as much memory as is allocated for the capacity, regardless of whether elements have actually been added.

The default initial capacity of an ArrayList is pretty small (10 from Java 1.4 - 1.8). But since the underlying implementation is an array, the array must be resized if you add a lot of elements. To avoid the high cost of resizing when you know you're going to add a lot of elements, construct the ArrayList with a higher initial capacity.

If the data structures perspective is used to understand the two structures, a LinkedList is basically a sequential data structure which contains a head Node. The Node is a wrapper for two components : a value of type T [accepted through generics] and another reference to the Node linked to it. So, we can assert it is a recursive data structure (a Node contains another Node which has another Node and so on...). Addition of elements takes linear time in LinkedList as stated above.

An ArrayList is a growable array. It is just like a regular array. Under the hood, when an element is added, and the ArrayList is already full to capacity, it creates another array with a size which is greater than previous size. The elements are then copied from previous array to new one and the elements that are to be added are also placed at the specified indices.

2 of 16
706

Thus far, nobody seems to have addressed the memory footprint of each of these lists besides the general consensus that a LinkedList is "lots more" than an ArrayList so I did some number crunching to demonstrate exactly how much both lists take up for N null references.

Since references are either 32 or 64 bits (even when null) on their relative systems, I have included 4 sets of data for 32 and 64 bit LinkedLists and ArrayLists.

Note: The sizes shown for the ArrayList lines are for trimmed lists - In practice, the capacity of the backing array in an ArrayList is generally larger than its current element count.

Note 2: (thanks BeeOnRope) As CompressedOops is default now from mid JDK6 and up, the values below for 64-bit machines will basically match their 32-bit counterparts, unless of course you specifically turn it off.



The result clearly shows that LinkedList is a whole lot more than ArrayList, especially with a very high element count. If memory is a factor, steer clear of LinkedLists.

The formulas I used follow, let me know if I have done anything wrong and I will fix it up. 'b' is either 4 or 8 for 32 or 64 bit systems, and 'n' is the number of elements. Note the reason for the mods is because all objects in java will take up a multiple of 8 bytes space regardless of whether it is all used or not.

ArrayList:

ArrayList object header + size integer + modCount integer + array reference + (array oject header + b * n) + MOD(array oject, 8) + MOD(ArrayList object, 8) == 8 + 4 + 4 + b + (12 + b * n) + MOD(12 + b * n, 8) + MOD(8 + 4 + 4 + b + (12 + b * n) + MOD(12 + b * n, 8), 8)

LinkedList:

LinkedList object header + size integer + modCount integer + reference to header + reference to footer + (node object overhead + reference to previous element + reference to next element + reference to element) * n) + MOD(node object, 8) * n + MOD(LinkedList object, 8) == 8 + 4 + 4 + 2 * b + (8 + 3 * b) * n + MOD(8 + 3 * b, 8) * n + MOD(8 + 4 + 4 + 2 * b + (8 + 3 * b) * n + MOD(8 + 3 * b, 8) * n, 8)

๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ java โ€บ arraylist-vs-linkedlist-java
ArrayList vs LinkedList in Java - GeeksforGeeks
May 29, 2026 - ArrayList is based on a dynamic array, while LinkedList uses a doubly linked list ยท ArrayList provides faster random access, whereas LinkedList is efficient for frequent insertions and deletions ยท Both are part of the Java Collections Framework ...
Discussions

ArrayList vs LinkedList
46 votes, 15 comments. Hi everyone, i want to solve a thought about ArrayList vs LinkedList. I know that ArrayList are basically an resizable arrayโ€ฆ More on reddit.com
๐ŸŒ r/learnjava
15
46
December 21, 2020
Can someone please explain the difference between List and ArrayList like I'm five?
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://imgur.com/a/fgoFFis ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
๐ŸŒ r/javahelp
29
30
October 2, 2021
ArrayList vs LinkedList
LinkedList is almost never the answer, see this answer on Stack Overflow and the following comment on memory footprint . More on reddit.com
๐ŸŒ r/javahelp
22
17
April 30, 2020
LinkedList vs ArrayList
The docs ( ArrayList and LinkedList ) plus some basic knowledge about data structures should give you enough insides about each implementation, their pros and cons. Do you need, for whatever reason, a list that also behaves as a queue or a stack for a massive number of elements/operations? Go with LinkedList, otherwise go with ArrayList. I encourage you to make your own conclusions and experiment with each implementation. And since you are being good, using interfaces, switching implementations should be a piece of cake. Deque is just an interface. The underlaying object (LinkedList) is the same in both cases. The difference is using a concrete implement for the name's type vs an interface, which is bad practice 'cause it makes switching implementations a pain. More on reddit.com
๐ŸŒ r/learnjava
4
3
July 27, 2020
๐ŸŒ
Java67
java67.com โ€บ 2012 โ€บ 12 โ€บ difference-between-arraylist-vs-LinkedList-java.html
When to use ArrayList vs LinkedList in Java? [Answered] | Java67
It explains essential data structure in Java programming language and most importantly teaches you when to use which data structure, a good refresher for those who are preparing for coding interviews too. Before comparing differences between ArrayList and LinkedList, let's see What is common between ArrayList and LinkedList in Java : 1) Both ArrayList and LinkedList are an implementation of the List interface, which means you can pass either ArrayList or LinkedList if a method accepts the java.util.List interface.
๐ŸŒ
Reddit
reddit.com โ€บ r/learnjava โ€บ arraylist vs linkedlist
r/learnjava on Reddit: ArrayList vs LinkedList
December 21, 2020 - Sure, copying array elements is fast in Java. But what what happens if the amount of data you have to copy to shift elements over becomes huge? And these shifts happen over and over again in your code? Thatโ€™s when linked lists start to look more appealing ... I found this helpful. ... Also check out ArrayDeque. It's a double ended queue that can be used as a stack or queue or list. ArrayList is still better in most cases, but this is a good one to be familiar with. ... LinkedList has additional node object that keeps reference to value object, so it's unnecessary overhead.
๐ŸŒ
Baeldung
baeldung.com โ€บ home โ€บ java โ€บ java list โ€บ java arraylist vs linkedlist
Java ArrayList vs LinkedList | Baeldung
April 22, 2025 - For this use-case, LinkedList is a better choice because the addition rate is much higher than the read rate. Also, we would read all the items, so we canโ€™t beat the O(n) upper bound. In this tutorial, first, we took a dive into how ArrayList and LinkLists are implemented in Java.
๐ŸŒ
BeginnersBook
beginnersbook.com โ€บ 2022 โ€บ 08 โ€บ when-to-use-arraylist-and-linkedlist-in-java
When to use ArrayList and LinkedList in Java
Search (get method) operations are fast in Arraylist (O(1)) but not in LinkedList (O(n)) so, if there are less add and remove operations and more search operations requirement, ArrayList would be your best bet. import java.util.*; public class JavaExample { public static void main(String[] ...
๐ŸŒ
Scaler
scaler.com โ€บ home โ€บ topics โ€บ arraylist vs linkedlist in java
ArrayList vs LinkedList in Java - Scaler Topics
April 3, 2024 - While both ArrayList and LinkedList store data linearly and accommodate the same data type, their intricate details and usage significantly distinguish them. Through file handling, these data structures can also store data in file systems, ensuring data recovery in the event of a system crash. Arraylist is a class which is a part of the Collections Frameworks in java. It implements the List interface hence all the methods of the List class can be used here. We need to ...
Find elsewhere
๐ŸŒ
Javatpoint
javatpoint.com โ€บ when-to-use-arraylist-and-linkedlist-in-java
When to use ArrayList and LinkedList in Java - javatpoint
When to use ArrayList and LinkedList in Java with list, set, map, queue, arraylist, linkedlist, hashset, linkedhashset, treeset, hashmap, linkedhashmap, storing and fetching data etc.
๐ŸŒ
Baeldung
baeldung.com โ€บ home โ€บ java โ€บ java collections โ€บ java map โ€บ arraylist vs. linkedlist vs. hashmap in java
ArrayList vs. LinkedList vs. HashMap in Java | Baeldung
December 11, 2025 - However, in certain use-cases, we should make use of LinkedList. Those include when we prefer constant insertion and deletion time, over constant access time, and effective memory usage.
๐ŸŒ
DEV Community
dev.to โ€บ wkreuch โ€บ when-to-use-linkedlist-vs-arraylist-in-java-a-practical-guide-with-a-spring-boot-example-2b4b
When to Use LinkedList vs. ArrayList in Java: A Practical Guide with a Spring Boot Example - DEV Community
August 19, 2025 - ArrayList for storing available products (frequent random access, e.g., lookup by ID). LinkedList for a queue of pending orders (FIFO: process in order of arrival, with insertions at the end and removals at the start).
๐ŸŒ
BeginnersBook
beginnersbook.com โ€บ 2013 โ€บ 12 โ€บ difference-between-arraylist-and-linkedlist-in-java
Difference between ArrayList and LinkedList in Java
Whereas in case of LinkedList when an item is deleted there is no need to shift left the next items, only thing is needed is to point the pointer to the next node. ... An arrayList stores data at contiguous memory locations, so when deletion operation is performed it creates an empty space in arrayList.
๐ŸŒ
LinkedIn
linkedin.com โ€บ pulse โ€บ arraylist-vs-linkedlist-helmut-siegel
ArrayList vs LinkedList
March 15, 2022 - The ArrayList is a great default implementation choice when using a list. Is a good General Purpose Implementation, it works well on a variety of different scenarios and probably should be preferred to a LinkedList most of the time.
๐ŸŒ
Medium
rameshfadatare.medium.com โ€บ difference-between-arraylist-and-linkedlist-in-java-ea609090c361
Difference Between ArrayList and LinkedList in Java | by Ramesh Fadatare | Medium
October 29, 2024 - import java.util.ArrayList; public class ArrayListStructureExample { public static void main(String[] args) { ArrayList<String> arrayList = new ArrayList<>(); arrayList.add("A"); arrayList.add("B"); arrayList.add("C"); System.out.println(arrayList); // Output: [A, B, C] } } ... On the other hand, LinkedList internally uses a doubly linked list. Each element is stored in a node, and each node contains a reference to both the next and the previous element in the list.
๐ŸŒ
Stack Abuse
stackabuse.com โ€บ difference-between-arraylist-and-linkedlist-in-java-code-and-performance
Difference Between ArrayList and LinkedList in Java - Code and Performance
September 21, 2023 - ArrayList and LinkedList are two different implementations of the List interface. They have their differences which are important to understand to utilize them properly. Which implementation should be used depends on the exact use cases. If elements are going to be fetched often, it makes little sense to use LinkedList since fetching is slower compared to ArrayList.
๐ŸŒ
Medium
medium.com โ€บ @masha.komarkofffa โ€บ arraylist-vs-linkedlist-java-interview-questions-and-answers-357558520659
ArrayList vs LinkedList. Java interview questions and answers | by Mariia Komarkova | Medium
February 28, 2025 - To summarize, ArrayList is ideal for scenarios where fast random access (O(1)) is needed, while LinkedList excels in frequent insertions and deletions (O(1) at the head/tail) but suffers from slower access (O(n)). Understanding these differences ...
๐ŸŒ
Javatpoint
javatpoint.com โ€บ difference-between-arraylist-and-linkedlist
ArrayList vs LinkedList - javatpoint
May 25, 2013 - Class class uses a doubly linked list to store the elements. It provides a linked-list data structure. It inherits the AbstractList class and implements List and Deque interfaces. In Java, a LinkedList is a class that implements the List interface and represents a linked list...
๐ŸŒ
Medium
medium.com โ€บ javarevisited โ€บ consider-linkedlist-in-java-2fed1b945b48
LinkedList vs ArrayList in Java | Javarevisited
September 19, 2021 - ... This is going to be a different ... slightly wrong. Here's what I found. TL;DR Use ArrayList in most standard cases where you simply add to the list and later on iterate over it....
๐ŸŒ
Medium
medium.com โ€บ @basecs101 โ€บ comparing-arraylist-and-linkedlist-in-java-latest-2b133b29489f
Comparing ArrayList and LinkedList in Java | by BaseCS101 | Level Up Coding
August 20, 2024 - I presented the answers with their use cases and along with that explained the differences. Through this article, you will find a better approach to answering your technical interview questions, which will definitely impress your interviewer. ArrayList is a resizable-array implementation of the List interface. Whereas LinkedList is a Doubly-linked list implementation of the List and Deque interfaces.
๐ŸŒ
Medium
medium.com โ€บ @aashigangrade06 โ€บ arraylist-vs-linkedlist-java-interview-questions-f69c81f0d691
Arraylist Vs Linkedlist | Java Interview Questions | by Aashi Gangrade | Medium
January 14, 2024 - LinkedList is faster for such operations due to its structure involving updating references. Q: What is the access time for both ArrayList and LinkedList? A: ArrayList is faster for random access (get operation) due to direct index-based access.
๐ŸŒ
Blogger
javarevisited.blogspot.com โ€บ 2012 โ€บ 02 โ€บ difference-between-linkedlist-vs.html
Difference between LinkedList and ArrayList in Java
And, if you need to know more ... ArrayList and LinkedList in Java. Use ArrayList in Java for all their situation where you need non-synchronized index-based access....