开发者

Help sort to list by date

I have an array list sorted from oldest to newest. I want to change it so that it is sorted from newes开发者_高级运维t to oldest. Can anyone help me?


Sounds like you want to reverse the order of an array?

Collections.reverse(yourSortedList);

See Android docs


This is just a java question rather than Android:

    ArrayList<String> originalList = new ArrayList<String>();
    ArrayList<String> newList = new ArrayList<String>();

    for(int i = originalList.size(); i > 0 ; i--) {
        newList.add(originalList.get(i));
    }

I'm sure there are other ways that differ that can be discussed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜