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