ArrayList<Trends> list = new ArrayList<Trends>();
for(int i=0;i<5;i++) {
Trends trends = new Trends();
trends.setDateCreated(String.valueOf(i));
trends.setUserName("王武"+i);
list.add(trends);
}
Collections.sort(list, new Comparator<Trends>() {
@Override
public int compare(Trends object1,
Trends object2) {
// TODO Auto-generated method stub
return object2.getDateCreated()
.compareTo(object1.getDateCreated()); //倒序
//object1.getDateCreated().compareTo(object2.getDateCreated());正序
}
});