common_helper/src/main/java/com/xiongyingqi/util/ComparatorHelper.java
@SuppressWarnings("unchecked")
    public List sortByDateTime(Collection<? extends T> collection, final Field field,
                               final boolean asc) {
        if (collection == null) {
            return null;
        }
        List list = new ArrayList();
        list.addAll(collection);
        Collections.sort(list, new Comparator<T>() {
            @Override
            public int compare(T o1, T o2) {
                Object object = invokeMethod(o1, field);
                Object object2 = invokeMethod(o2, field);
                if (object == null || object2 == null) {
                    return 0;
                }
                int value = 0;
                if (object instanceof Date) {
                    Date v1 = (Date) object;
                    Date v2 = (Date) object2;

                    if (v1.getTime() < v2.getTime()) {
                        value = -1;
                    } else if (v1.getTime() > v2.getTime()) {
                        value = 1;
                    }
                    if (!asc) {
                        value = -value;
                    }
                }
                return value;
            }

        });
        return list;
    }
@SuppressWarnings("unchecked")
    public List sortByDateTime(Collection<? extends T> collection, final Field field,
                               final boolean asc) {
        if (collection == null) {
            return null;
        }
        List list = new ArrayList();
        list.addAll(collection);
        Collections.sort(list, new Comparator<T>() {
            @Override
            public int compare(T o1, T o2) {
                Object object = invokeMethod(o1, field);
                Object object2 = invokeMethod(o2, field);
                if (object == null || object2 == null) {
                    return 0;
                }
                int value = 0;
                if (object instanceof Date) {
                    Date v1 = (Date) object;
                    Date v2 = (Date) object2;

                    if (v1.getTime() < v2.getTime()) {
                        value = -1;
                    } else if (v1.getTime() > v2.getTime()) {
                        value = 1;
                    }
                    if (!asc) {
                        value = -value;
                    }
                }
                return value;
            }

        });
        return list;
    }
按照日期进行排序 <br>
2013-6-25 下午9:46:45

@param collection 要排序的集合
@param field      指定排序的时间字段
@param asc        是否按正序排序
@return List