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;
        }
    }

  • 相关阅读:
    window.showModalDialog使用手册
    javascrīpt 对象的定义
    导航上用CSS标志当前页效果的实现
    数据库中的命名规则
    Oracle数学函数
    实现 asp 的服务器无刷新推技术
    UML建模工具比较
    Oracle日期函数
    神秘的 ORACLE DUAL
    Podcast Publisher——一个综合了多种入门知识的小Web应用
  • 原文地址:https://www.cnblogs.com/happyrocky/p/Collections.html
Copyright © 2011-2022 走看看