Implement ArrayList ensureCapacity()Step 1 of 2
1
2
Check if resize is needed
First, check if the minimum capacity requested exceeds the current array length. If not, no resize is needed.
Loading editor...
Learning Objectives
- Understand dynamic array resizing
- Learn the doubling strategy
- Copy elements to a new array