排序根据日期时间对象的ArrayList [英] Sorting arraylist of objects based on the date time

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

问题描述

我有两个的ArrayList是由日期时间对象,并使用合并两个列表。

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

list1.addAll(list2);

我想现在排序的日期和时间对象ArrayList中包含的顺序此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的日期对象。你可以做的集合#排序()

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

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

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