java ArrayList排序
Collections.sort(mPersons, new Comparator<Object>() {
@Override
public int compare(Object o1, Object o2) {
Person p1=(Person)o1;
Person p2=(Person)o2;
SimpleDateFormat df =new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
try {
return df.parse(p1.getPctime()).compareTo(df.parse(p2.getPctime()));
} catch (ParseException e) {
return 0;
}
}
});
浙公网安备 33010602011771号