zoukankan      html  css  js  c++  java
  • Collections使用

    private void listSortByDate(List<CTagSet> listSort,int sortType, String sortRow)
    {
        Collections.sort(list,new CTagSetComparator(sortType,sortRow));
    }
    static class CTagSetComparator implement Comparator<CTagSet>, Serializable
    {
        int sortType;
        String sortRow;
        int flag = -1;
        public CTagSetComparator(int sortType, String sortRow){
            this.sortType = sortType;
            this.sortRow = sortRow;
        }
        public int compare(CTagSet s1, CTagSet s2)
        {
            if(null == sortRow || sortRow.isEmpty())
            {
                sortRow = "RECDATE"
            }
            String recDateStr1 = s1.GetValue(sortRow);
            String recDateStr2 = s2.GetValue(sortRow);
            if(null != recDateStr1 && null != recDateStr2)
            {
                try
                {
                    Date recDateStr1 = Dates.parseDateTime(recDateStr1);
                    Date recDateStr2 = Dates.parseDateTime(recDateStr2);
                    flag = recDateStr1.compareTo(recDate2);
                }catch(Exception e)
                {
                    return flag;
                }
            }else{
                return flag;
            }
            return flag*sortType;
        }
    }

  • 相关阅读:
    移动端meta标签
    document.ready 和 window.onload
    axios 源码分析
    vue 中的 el
    安卓和Ios 手机兼容性
    一些移动端问题
    Python 局部变量与全局变量
    Linux常用命令大全(非常全!!!)
    Python_爬虫_基础
    linux 常用命令
  • 原文地址:https://www.cnblogs.com/happyrocky/p/Collections.html
Copyright © 2011-2022 走看看