title: Maximum size of Java arrayList containing Points
body: <p>What is the maximum number of elements an <code>ArrayList</code> of <code>Points</code> can store?</p>
  
  <p>In other words, given this code:</p>
  
  <pre><code>ArrayList&lt;Point&gt; x = new ArrayList&lt;&gt;();
  for (int i = 0; i &lt; maxElements; i++) {
      x.add(new Point(0, 0));
  }
  </code></pre>
  
  <p>what is the maximum allowed value for <code>maxElements</code> (given enough heap space) such that <code>x.get(0)</code> is the correct value and is accessible?</p>