Let ArrayList support max capacity.
Synced with ArrayList.