Firebase数据库从最后一个子节点开始遍历子节点 [英] Firebase Database loop through children starting from last child
本文介绍了Firebase数据库从最后一个子节点开始遍历子节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在孩子之间有这样的循环:
I have this loop through children:
public void onDataChange(DataSnapshot snapshot) {
for (DataSnapshot postSnapshot: snapshot.getChildren()) {
przejazd = postSnapshot.getValue(Przejazd.class);
System.out.println(przejazd.getAdres_koniec());
przejazdList.add(przejazd);
mAdapter.notifyDataSetChanged();
}
}
但是我想从最后一个孩子到第一个孩子循环播放,怎么做?
But I want to loop from last child to first child, how to do it?
推荐答案
据我所知,当前的API无法做到这一点.如果要 reverse
,可以使用获取的列表来完成.
From what I know, you can't do it with current API.
If you want to reverse
it, you can do it with the obtained list.
Collections.reverse(przejazdList);
这篇关于Firebase数据库从最后一个子节点开始遍历子节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文