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....? } });}推荐答案 Tasks.whenAllSuccess(以及其他whenAll方法)会将任务中的结果按传递给whenAllSuccess的顺序传递给List中的回调.如果您需要其他获取结果的方法,则可以使用原始Task对象维护某种数据结构,然后根据需要查询它们.Tasks.whenAllSuccess (and other whenAll methods) will deliver the results from the tasks to the callback in a List in the order they were passed to whenAllSuccess. If you need some other way of getting the results, you can maintain some data structure with the original Task objects, then query them as you want. 这篇关于Tasks.whenAllSuccess是否保证我将任务传递给它的顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-23 23:12