title: How to make multiple queries and load into array?
body: <p>How would I load multiple Firestore query results into the same array? I am using a for-loop but since Firestore queries are async, the array is set to 0. Here is my code:</p>
  
  <pre><code>private void loadMealplans() {
          for (int i = 0; i &lt; restaurantArrayList.size(); i++) {
              Query planQuery = firebaseFirestore.collection("Meal_Plans").whereEqualTo("restaurantId", restaurantArrayList.get(i).getRestaurantId());
              planQuery.get().addOnSuccessListener(queryDocumentSnapshots -&gt; {
                  for (QueryDocumentSnapshot allPlans : queryDocumentSnapshots) {
                      Mealplan mealplan = allPlans.toObject(Mealplan.class);
                      mealplan.setMealplanId(allPlans.getId());
                      myPlans.add(mealplan);
                  }
              });
              Log.d(TAG, "mealplan size:"+ myPlans.size()); // this is always zero
          }
          // Loading data into recycler view
      }
  </code></pre>