I am trying to create an ArrayList of objects created from Firestore data. The objects are creating correctly as far as I can tell. When I try to access the ArrayList that I am adding them to though it comes up empty. I get the collection's reference and then add the listener for the query.
ArrayList<Doctor> docList = new ArrayList<> (); 
CollectionReference doctors = db.collection("doctors");
doctors.get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
            @Override
            public void onComplete(@NonNull Task<QuerySnapshot> task) {
                if (task.isSuccessful()) {
                    for (QueryDocumentSnapshot document : task.getResult()) {
                        docList.add(document.toObject(Doctor.class);
                    }
                }
            }
        });