I am using Cloud Firestore in an Android app.
I create 2 queries, one whereLessThan
and one whereGreaterThan
to effectively create an !=
query.
I order the results for each individual query, but when I run them separately, I might get one or another returned first, depending on which is faster.
When I combine 2 queries into 1 and then use the Tasks.whenAllSuccess
method to get 1 Task
and add 1 OnSuccessListener
to it, will it keep up the order of results in which I pass my tasks?
public void loadNotes(View v) {
Task task1 = notebookRef
.whereLessThan("priority", 2)
.orderBy("priority")
.get();
Task task2 = notebookRef
.whereGreaterThan("priority", 2)
.orderBy("priority")
.get();
Task finalTask = Tasks.whenAllSuccess(task1, task2).addOnSuccessListener(new OnSuccessListener<List<Object>>() {
@Override
public void onSuccess(List<Object> objects) {
//will my results be ordered prioty 1 - 3 - 4 - 5....?
}
});
}