How does an ArrayList grow internally?
Reviewed by Gurusankar M.
On this page
Concept Made Simple
Coffee Chat Question
βHow does an ArrayList grow internally?β
Remember It Faster
Mind Map Answer
An ArrayList is a row of theatre seats π, numbered 0,1,2β¦ You jump straight to seat 7 (index access) instantly. But when the row is full, you can't stretch it β you book a bigger hall (1.5Γ array) and walk everyone over to their new seats.
- Default capacity
- 10
- Growth factor
- ~1.5x (oldCap + oldCap/2)
- Access
- O(1) by index
Learn by Doing
Hands-on Keyboard
List<String> list = new ArrayList<>();
list.add("a");
list.add("b");
System.out.println(list.get(1));b
Think Beyond the Expected
What If?
ArrayList vs LinkedList β which for frequent insertions in the middle?
LinkedList β O(1) insert once you hold the node. But ArrayList wins on random access and cache locality, so it is the default choice most of the time.
Real World
ArrayList is the default 'list' you reach for 95% of the time β collecting query results, building a response payload, iterating in order. You only switch away from it when profiling proves random insert/delete in the middle is a real bottleneck.
Interviewer's Expectation
Keywords they're listening for:
- resizable array
- O(1) index access
- amortized growth (1.5x)
- vs LinkedList trade-offs
Continue Learning with AI
Take this question deeper with your favourite AI assistant. Pick a depth, copy the prompt, or open it directly β AI is your learning companion, not a shortcut.
Plain-language foundations
I'm preparing for a software engineering interview and want to understand this from scratch, as a beginner. Topic: Collections (Core Java) Interview question: "How does an ArrayList grow internally?" Please: 1. Explain the core idea in simple, plain language, using an everyday analogy. 2. Define any technical terms you use. 3. Walk through one small, concrete example. 4. Finish with a single sentence I can easily remember. Keep the tone friendly and assume I'm new to this topic.
Was this answer helpful?
Affiliate links
Tools for Your Developer Workspace
Equipment for a comfortable, productive setup.
As an Amazon Associate I earn from qualifying purchases.
- MonitorView on Amazon : BenQ EW2790U 27-inch Monitor (opens in a new tab)
BenQ EW2790U 27-inch Monitor
- LaptopView on Amazon : Acer Aspire One Laptop (opens in a new tab)
Acer Aspire One Laptop
- Office ChairView on Amazon : Wakefit Gravita Ergonomic Office Chair (opens in a new tab)
Wakefit Gravita Ergonomic Office Chair