How are ArrayLists implemented in Java?
<p>Did some searching before asking, some not-so-reliable sources suggest that there's an underlying <code>Object[]</code> array.</p>

<p>Is it as simple as that? i.e. it handles resizing when necessary, maybe does a few tricks like doubling the size to get better amortized runtimes, and keeps track of where the first empty slot in the array is.</p>

<p>Or, are there optimizations done for membership testing and sparse arrays?</p>
