What's the syntax to get an object's transform (as a Vector3) inside an ArrayList?

I’ve been trying to implement a camera path based on control points, but I can’t figure out the syntax to use. Here’s the code as it is so far:

    	public ArrayList controlPoints;
    
    	private int currentCP;
    	private int nextCP;
    
    
    	void Update ()
    	{
    		if (transform == controlPoints[nextCP].transform) {
    			currentCP = nextCP;
    			nextCP++;
    			transform = Vector3.Slerp (controlPoints [currentCP], controlPoints [nextCP], 3);
    		}
    	}

You would not use ArrayList; it’s untyped and obsolete. Use a standard array.

public Transform[] controlPoints;

If you need to add/remove from the array, use a List

public List<Transform> controlPoints;