title: Android How to sort data that i retrieve from Database
body: <p>I already have a code that get the Data from Firestore Database, the data consist of Date,Invoice numb, item type, qty and price. What i want is when i show it to recyclerview, the data is sorted asscendingly based on the invoice number. anybody know how ? thanks</p>
  
  <pre><code>private void filterSearch() {
          pbloading.setVisibility(View.VISIBLE);
          String filter = filterDate.getText().toString();
          FirebaseFirestore db = FirebaseFirestore.getInstance();
          db.collection("sales").whereEqualTo("date",filter).get()
                  .addOnCompleteListener(new OnCompleteListener&lt;QuerySnapshot&gt;() {
                      @Override
                      public void onComplete(@NonNull Task&lt;QuerySnapshot&gt; task) {
                          if (task.isSuccessful()) {
                              for (QueryDocumentSnapshot document : task.getResult()) {
                                  Log.d(Tag.ITEM, document.getId() + "=&gt;" + document.getData());
  
                                  String invoice = document.getString("invoice");
                                  String date = document.getString("date");
                                  String type = document.getString("type");
                                  Integer qty = document.getLong("qty").intValue();
                                  Integer price = document.getLong("price").intValue();
                                  sales = new Sales(invoice, date, type, qty, price);
  
                                  salesList.add(sales);
                              }
                              adapter = new SalesAdapter(SalesHistoryActivity.this, salesList);
                              recyclerView.setAdapter(adapter);
                              pbloading.setVisibility(View.GONE);
                          } else {
                              pbloading.setVisibility(View.GONE);
                              Toast.makeText(SalesHistoryActivity.this, "Error", Toast.LENGTH_SHORT).show();
                              Log.w(Tag.ITEM, "error getting documents", task.getException());
                          }
                      }
                  });
      }
  </code></pre>