title: Assigned value in inner class not assigned correctly
body: <p>I have this function to return number of nodes at a firestore endpoint but it seems not to ork as expected. Currently, the number of nodes at the endpoint is 1.Here is the function</p>
  
  <pre><code>public static int getInvoicesCount(String uid)
  {
      final int[] count = new int[1];
  
      FirebaseFirestore firestore;
      firestore = FirebaseFirestore.getInstance();
  
      CollectionReference invoicesRef = firestore
              .collection("invoices");
  
      Query query = invoicesRef.whereEqualTo("creator_id",uid);
  
      Task&lt;QuerySnapshot&gt; task = query.get();
  
  
      task.addOnCompleteListener(new OnCompleteListener&lt;QuerySnapshot&gt;() {
          @Override
          public void onComplete(@NonNull Task&lt;QuerySnapshot&gt; task) {
              if(task.isSuccessful())
              {
                  if(task.getResult().isEmpty())
                  {
                      count[0] = 0;
                      Log.d("counter",String.valueOf(count[0]));
                  }
                  else {
                      Log.d("counter is",String.valueOf(task.getResult().size()));
                      count[0] = task.getResult().size();
                  }
  
              }
          }
      });
  
      return count[0];
  
  }
  </code></pre>
  
  <p>Logging the value of count[0] in the else statement gives 1 but the return value at the end of the function is still giving 0 instead of 1;</p>