根据日期时间对对象的数组列表进行排序 [英] Sorting arraylist of objects based on the date time

查看:31
本文介绍了根据日期时间对对象的数组列表进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个数组列表,它们包含日期时间对象并使用合并两个列表.

I have two arraylists that consist of the datetime objects and merging both the list using.

list1.addAll(list2);

我现在想按照 arraylist 包含的日期时间对象的顺序对这个 arraylist 进行排序.谁能指导我如何对这个数组列表进行排序.

I want to now sort this arraylist on the order of the date time object that the arraylist consists of. Can anyone guide me how to sort this arraylist.

推荐答案

如果你的意思是他们有 Java 日期 对象.你可以做 Collections#sort()

If you meant they have Java Date object. You can just do Collections#sort()

这篇关于根据日期时间对对象的数组列表进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆