11-16-2006 09:22 PM
11-17-2006 05:40 PM
11-21-2006 03:05 AM
you can modify the implementation of getPressReleases (in Util.java) to sort the collection before returning it.
11-21-2006 12:35 PM
Collections.sort(result, new Comparator() {
public int compare(PressReleaseBean prb1, PressReleaseBean prb2) {
return prb1.getLaunchDate().compare(prb2.getLaunchDate());
}
});
11-21-2006 09:28 PM
at the end of getPressReleases in Util.java add:
Collections.sort(result, new Comparator() {
public int compare(PressReleaseBean prb1, PressReleaseBean prb2) {
return prb1.getLaunchDate().compare(prb2.getLaunchDate());
}
});
see http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collections.html
for more information on how to sort lists.
G:\noviweb>javac Util.java
Util.java:56: <cryptonym org.alfresco.web.pr.Util$1>not abstract,and not cover with java.util
.abstract method of Comparator compare(java.lang.Object,java.lang.Object)
public int compare(PressReleaseBean prb1, PressReleaseBean prb2) {
^
Util.java:57: not find symbol
symbol: method compare(java.util.Date)
location: class java.util.Date
return prb1.getLaunchDate().compare(prb2.getLaunchDate());
^
advert: want to know particular information,please use -Xlint:unchecked afresh javac。
2 errors
11-22-2006 03:58 PM
Collections.sort(result, new Comparator() {
public int compare(Object o1, Object o2) {
return ((PressReleaseBean)o1).getLaunchDate().compareTo(((PressReleaseBean)o2).getLaunchDate());
}
});
11-26-2006 08:58 PM
the method on Date is compareTo, not compare. my mistake.
what version of the jdk are you using? the code i'm providing is for jdk1.5.
if you are using an older jdk this should work.
Collections.sort(result, new Comparator() {
public int compare(Object o1, Object o2) {
return ((PressReleaseBean)o1).getLaunchDate().compareTo(((PressReleaseBean)o2).getLaunchDate());
}
});
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.