0
我乔达DateTime是否像这样一个ArrayList:乔达日期时间数组排序数组按日期时间
List <DateTime> nextRemindersArray = new ArrayList<DateTime>();
nextRemindersArray.add(reminderOneDateTime);
nextRemindersArray.add(reminderTwoDateTime);
nextRemindersArray.add(reminderThreeDateTime);
我试图以升序日期排序,但我有麻烦:
我用Google搜索并找到了这个网页:
https://cmsoftwaretech.wordpress.com/2015/07/19/sort-date-with-timezone-format-using-joda-time/
我想它是这样的:
nextRemindersArray.sort(nextRemindersArray);
但它给我的错误:
Error:(1496, 37) error: incompatible types: List<DateTime> cannot be converted to Comparator<? super DateTime>
我又试图像这样:
DateTimeComparator dateTimeComparator = DateTimeComparator.getInstance();
nextRemindersArray.sort(nextRemindersArray, dateTimeComparator);
而且这样的:
nextRemindersArray.sort(nextRemindersArray, new DateTimeComparator());
但都有错误。
我尝试了乔达时间手册,并没有太大的帮助。我如何对数组进行排序?
在此先感谢您的帮助
非常感谢你非常感谢! –