title: Android Firebase Realtime Database orderByChild is not working
body: <p>I'm trying to sort the restaurants by the average rating with orderByChild() but instead of returning them by sorting them by average rating it doesn't.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>public void filterQuality(){
  
      DatabaseReference mRatingDb = FirebaseDatabase.getInstance().getReference();
  
      Query topQualityQuery = mRatingDb.orderByChild("Average");
      topQualityQuery.addListenerForSingleValueEvent(new ValueEventListener() 
      {
  
          @Override
          public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
              Map &lt;String, Double&gt; topQualityMap = new HashMap&lt;&gt;();
              List list = new ArrayList();
              List list2 = new ArrayList();  
  
              for (DataSnapshot ds: dataSnapshot.getChildren()){
  
                  topQualityMap.put(ds.getKey(), ds.child("Quality").child("Average").getValue(double.class));
                  list.add(ds.child("Quality").child("Average").getValue(double.class));
                  list2.add(ds.getKey());
  
                  Log.d("Top Quality", "Value" + topQualityMap);
                  Log.d("Top Quality", "Value" + list);
                  Log.d("Top Quality", "Value" + list2);
              }
  
          }
  
          @Override
          public void onCancelled(@NonNull DatabaseError databaseError) {
  
          }
      });
  
  }
  </code></pre>
  
  <p>This is what I get from maps and lists from what I tried to debug:</p>
  
  <p>Value [3.0]</p>
  
  <p>Value [Jurys Inn Newcastle]</p>
  
  <p>Value {Malmaison Newcastle=2.0, Jurys Inn Newcastle=3.0}</p>
  
  <p>D/Top Quality: Value [3.0, 2.0]</p>
  
  <p>D/Top Quality: Value [Jurys Inn Newcastle, Malmaison Newcastle]</p>
  
  <p>D/Top Quality: Value {Malmaison Newcastle=2.0, Jurys Inn Newcastle=3.0, The County Hotel, Newcastle=4.0}</p>
  
  <p>Value [3.0, 2.0, 4.0]</p>
  
  <p>Value [Jurys Inn Newcastle, Malmaison Newcastle, The County Hotel, Newcastle]</p>
  
  <p>Here is my firebase:</p>
  
  <p><a href="https://i.stack.imgur.com/ToP8k.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ToP8k.png" alt="Firebase"></a>
  <a href="https://i.stack.imgur.com/pVhSh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pVhSh.png" alt="Check my update Firebase"></a></p>
  
  <p>If someone knows why this is not working properly please help.
  Thank you.</p>