An ArrayList in Java is a List that is backed by an array.

The get(index) method is a constant time, O(1), operation.

The code straight out of the Java library for ArrayList.get(index):

public E get(int index) {
    RangeCheck(index);
    return (E) elementData[index];
}

Basically, it just returns a value straight out of the backing array. (RangeCheck(index)) is also constant time)

Answer from jjnguy on Stack Overflow
๐ŸŒ
Cisc3130fa24
cisc3130fa24.github.io โ€บ handouts โ€บ ArrayList-complexity.html
time complexity of ArrayList operations
Suppose that list refers to an ArrayList<E>, element is a variable of type E, and index is a random int in the range [0, list.size()).
Discussions

arrays - Time Complexity for Java ArrayList - Stack Overflow
I found other entries for this question that dealt with specific methods, but nothing comprehensive. I'd like to verify my own understanding of the most often used methods of this data structure: ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Why is the add(index, element) time complexity not constant in Java for array lists?

For array lists, you would have to move all elements to adjacent positions when you insert at an index. So it takes linear time ( more the number of elements already in the list, more time it takes to move them all ).

Also Java has nothing to do with time complexities of a data structure. It is universal.

More on reddit.com
๐ŸŒ r/learnjava
8
2
June 1, 2020
arraylist - Time complexity in Java - Stack Overflow
For the method add of the ArrayList Java API states: The add operation runs in amortized constant time, that is, adding n elements requires O(n) time. I wonder if it is the same time complexity, More on stackoverflow.com
๐ŸŒ stackoverflow.com
April 27, 2017
ArrayList Time Complexity (Big-O) for Insertion, Deletion, Retrieving and Checking a specific element Without a schedule
On Studocu you find all the lecture notes, summaries and study guides you need to pass your exams with better grades. More on studocu.com
๐ŸŒ studocu.com
1
September 30, 2024
๐ŸŒ
Baeldung
baeldung.com โ€บ home โ€บ java โ€บ java collections โ€บ time complexity of java collections
Time Complexity of Java Collections | Baeldung
September 24, 2025 - Usually, when we talk about time complexity, we refer to Big-O notation. Simply put, the notation describes how the time to perform the algorithm grows with the input size. Useful write-ups are available to learn more about Big-O notation theory and practical Java examples. Letโ€™s start with a simple list, which is an ordered collection. Here weโ€™ll look at a performance overview of the ArrayList, LinkedList, and CopyOnWriteArrayList implementations.
๐ŸŒ
YourBasic
yourbasic.org โ€บ algorithms โ€บ time-complexity-arrays
Time complexity of array/list operations [Java, Python] ยท YourBasic
Warning: This code has quadratic time complexity. It runs in time ฮ˜(n2), where n is the initial length of the list a. This means that the program is useful only for short lists, with at most a few thousand elements. ... To avoid this type of performance problems, you need to know the difference between constant and linear time list operations. The following ArrayList methods operate on a subset of the elements, but still have time complexity that depends on the size n of the list.
๐ŸŒ
Carnegie Mellon University
cs.cmu.edu โ€บ ~mrmiller โ€บ 15-121 โ€บ Slides โ€บ 09-BigO-ArrayList.pdf pdf
Big O & ArrayList 15-121 Fall 2020 Margaret Reid-Miller
September 24, 2020 - Time(n) = 3n = O(3n), not O(2n)! ... A followed by B. โ€ข Then the overall complexity of the algorithm is
๐ŸŒ
University of Pennsylvania
cis.upenn.edu โ€บ ~cis110 โ€บ 16sp โ€บ lectures โ€บ 43bArrayList.pdf pdf
ArrayLists & List Computational Complexity
n๏ฎ What is the complexity for the following? q๏ฑ access to the โ€œmiddleโ€ element of the list using ยท E get(int index) 12 ยท Example 1 โ€“ArrayList vs. LinkedList ยท n๏ฎ What is the running time for an ArrayList versus ยท a LinkedList? public static void ยท
Find elsewhere
๐ŸŒ
GitHub
gist.github.com โ€บ psayre23 โ€บ c30a821239f4818b0709
Runtime Complexity of Java Collections ยท GitHub
I have to build my Programs in a way that saves time! ... Thankyou! Only a small mistake that I think is LinkedList remove is O(N) not O(1) because it first needs to find the node before deleting it. ... To the point. Thanks man! ... @Barry36 nope, it's O(M+N) where M = array size (the ArrayList) and N = collection size (the function argument Collection).
๐ŸŒ
Luke Du
blog.duyidong.com โ€บ 2020 โ€บ 07 โ€บ 20 โ€บ data-structure-and-time-complexity
Time Complexity of Java Collections - Luke.Du's blog
December 19, 2022 - get() โ€“ searching for an element takes O(n) time. remove(element) โ€“ to remove an element, we first need to find it. This operation is O(n). remove(index) โ€“ to remove an element by index, we first need to follow the links from the beginning; ...
๐ŸŒ
Medium
yogeshkkhichi.medium.com โ€บ time-and-space-complexity-of-collections-5a00c7b1d32b
Time and Space Complexity of Collections | by Yogesh Kumar | Medium
November 17, 2020 - Searching by indexing: ArrayList can give you any element in O(1) complexity as the array has random access property.
Top answer
1 of 3
10

This depends on where you're adding. E.g. if in an ArrayList you add to the front of the list, the implementation will have to shift all items every time, so adding n elements will run in quadratic time.

Similar for the linked list, the implementation in the JDK keeps a pointer to the head and the tail. If you keep appending to the tail, or prepending in front of the head, the operation will run in linear time for n elements. If you append at a different place, the implementation will have to search the linked list for the right place, which might give you worse runtime. Again, this depends on the insertion position; you'll get the worst time complexity if you're inserting in the middle of the list, as the maximum number of elements have to be traversed to find the insertion point.

The actual complexity depends on whether your insertion position is constant (e.g. always at the 10th position), or a function of the number of items in the list (or some arbitrary search on it). The first one will give you O(n) with a slightly worse constant factor, the latter O(n^2).

2 of 3
4

In most cases, ArrayList outperforms LinkedList on the add() method, as it's simply saving a pointer to an array and incrementing the counter.

If the woking array is not large enough, though, ArrayList grows the working array, allocating a new one and copying the content. That's slower than adding a new element to LinkedListโ€”but if you constantly add elements, that only happens O(log(N)) times.

When we talk about "amortized" complexity, we take an average time calculated for some reference task.

So, answering your question, it's not the same complexity: it's much faster (though still O(1)) in most cases, and much slower (O(N)) sometimes. What's better for you is better checked with a profiler.

๐ŸŒ
Studocu
studocu.com โ€บ saudi electronic university โ€บ data structure โ€บ question
[Solved] ArrayList Time Complexity BigO for Insertion Deletion Retrieving - Data Structure (CS240) - Studocu
September 30, 2024 - For an ArrayList, insertion and deletion have a time complexity of O(n) because elements may need to be shifted to accommodate the changes.
๐ŸŒ
CliffsNotes
cliffsnotes.com โ€บ questions & answers โ€บ computer science โ€บ what is the average time complexity to add an item to the end of an arraylist? what is the worst case time complexity...
[Solved] What is the average time complexity to add an item to the end of an ArrayList? What is the worst case time complexity... | CliffsNotes
February 8, 2023 - Taking this all into account, what situations would an ArrayList be the appropriate data structure for storing your data? public static int[] allEvensUnder(int limit){ if (limit <= 0){ return new int[0]; } if (limit < 2){ return new int[1]; } int[] vals = new int[(limit+1)/2]; for(int i = 0; i <(limit+ 1)/2 ; i++ ) { vals[i] = i*2; } return vals; } What is the time complexity of the allEvensUnder function?
๐ŸŒ
Blogger
array-arraylist-linkedlist.blogspot.com
Time complexity of Array / ArrayList / Linked List
This is a little brief about the ... of these data structure will be of best use ... Operation Array ArrayList Singly Linked List Read (any where) O(1) O(1) O(n) Add/Remove at ......
๐ŸŒ
javathinking
javathinking.com โ€บ blog โ€บ time-complexity-for-java-arraylist
Java ArrayList: Is It an Array or List? Get Operation Time Complexity (O(1) vs O(n)) Explained โ€” javathinking.com
The get(int index) method in ArrayList retrieves the element at the specified position. Its time complexity is O(1), meaning it runs in constant time.
Top answer
1 of 1
10
Imagine packing for a trip with two choices for luggage: a regular suitcase (Array) and an expandable suitcase (ArrayList). Array: It's like a regular suitcase. You choose its size when you pack, like a small, medium, or large suitcase. Once you pick, it's fixed. If it's small and you try to add more, it won't fit. If it's not full, you still carry the empty space. In Java, an Array of size 10 can only store 10 elements, no more, no less. ArrayList: This is an expandable suitcase. It grows or shrinks as needed. Start with a few items? It adjusts. Found souvenirs? It expands. Decided to leave stuff behind? It shrinks. In Java, ArrayList is part of the Java Collection Framework and adjusts its size as you add or remove elements. Key Differences: Size: Arrays have fixed sizes. ArrayLists can change size dynamically. Type: Arrays can hold primitive types (like int, char) and objects. ArrayLists only hold objects, not primitives. Performance: Adding or removing items in an ArrayList might be slower due to potential resizing and copying to a new location. Utility: ArrayLists offer methods like .add(), .remove(), .indexOf(), making them more user-friendly than Arrays. Time and Space Complexities of Arrays and ArrayLists in Java Understanding the time and space complexities of Arrays and ArrayLists is like knowing how long it takes to do tasks with your regular suitcase (Array) or expandable suitcase (ArrayList), and how much space they take up. Arrays Space Complexity: O(n). The size is fixed, and it occupies space for all its elements, regardless of whether they are used or not. Accessing an Element (Read/Write): O(1). Like picking an item from a specific pocket in your suitcase; it's quick because you know where it is. Inserting/Deleting an Element: Not applicable in the traditional sense, as the size is fixed. But if you consider overwriting an existing element or setting it to null, it's O(1). ArrayLists Space Complexity: O(n). However, it can be more due to the dynamic resizing. When an ArrayList grows, it usually doubles its size, which temporarily increases the space requirement before it's filled up. Accessing an Element (Read/Write): O(1). Similar to arrays, direct index access. Inserting an Element: Average Case: O(1). If there's room in the ArrayList. Worst Case (resizing required): O(n). Resizing involves creating a new array and copying elements, which takes more time. Deleting an Element: Average/Worst Case: O(n). Removal requires shifting elements to fill the gap left by the deleted element, which takes more time as the size of the ArrayList increases. In summary, both arrays and ArrayLists offer quick access to elements. Arrays have a fixed space, while ArrayLists can resize, affecting their space complexity. Inserting and deleting elements are generally more time-consuming in ArrayLists, especially when resizing or shifting elements is involved. Choose Arrays when you know the exact number of elements. Choose ArrayLists for flexibility and convenience.
๐ŸŒ
Medium
bikashdubey42.medium.com โ€บ arraylist-vs-linkedlist-in-java-633e68f49d22
Time Complexity of Java Collections API | by Bikash Dubey | Medium
November 17, 2020 - Its all about the requirement, ArrayList is best choice when our frequent operation in program is to read the elements from the array because ArrayList implements RandomAccess interface which provide support for fast (constant time) random access for ArrayList.
๐ŸŒ
DEV Community
dev.to โ€บ jhonifaber โ€บ choosing-the-right-java-collection-5750
Java Collections: From Lists to Maps with Time Complexity in Mind - DEV Community
August 7, 2025 - Javaโ€™s Collection Framework is powerful, but knowing when to use ArrayList, LinkedList, HashMap, Queue, or Deque can make a big difference in the performance and readability of your code. In this article, Iโ€™ll guide you through real world scenarios, time complexities, and examples to help you choose the right data structure depending on your needs.