我使用notes.jar lotus notes api提取电子邮件的日期和时间。当我将它们添加到集合中,如果添加它们是这样的:Java对日期时间值集合进行排序
Vector times = doc.getItemValueDateTimeArray("PostedDate");
for (int j=0; j<times.size(); j++) {
Object time = times.elementAt(j);
if (time.getClass().getName().endsWith("DateTime")) {
String Listadd = ((DateTime)time).getLocalTime();
NotesDates.add((DateTime)time);
我得到的错误:
lotus.domino.local.DateTime cannot be cast to java.lang.Comparable
当我添加的值作为字符串代码运行,但我不能排序的集合。
如何排列日期和时间的集合以查找最早和最新的?
你需要写一个比较''' –
VECTOR'和Lotus Notes,还没有看到那些在很长一段时间.. –
只是想知道:为什么'time.getClass()的getName()。 endsWith(“DateTime”)'而不是'time instanceof DateTime'? – RealSkeptic