伸手党不好带,直接上源码。
Collections.sort(mapList, new Comparator<Map<String, Object>>() {
@Override
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
if (o1.get("stopTime") == null && o2.get("stopTime") == null)
return 0;
if (o1.get("stopTime") == null)
return -1;
if (o2.get("stopTime") == null)
return 1;
return Long.valueOf(JSON.toJSONString(o2.get("stopTime"))).compareTo(Long.valueOf(JSON.toJSONString(o1.get("stopTime"))));
}
});