zoukankan      html  css  js  c++  java
  • 集合用例

    1. map用法示例:

      set - get ; 对象 - 对象的引用

     1     public List<OrganBatchFlowDTO> selectCompareList(
     2             Req_compareInfo_query record) {
     3 
     4         /** 1、查询日切流水表,得到记录*/
     5         List<OrganBatchFlowDTO> list= organBatchFlowDao.selectCompareList(dto);
     6         if(list==null ||list.size()<1){
     7             LOGGER.info("### step1: query from welink_adm_organ_batch_flow ,and size = 0");
     8             return new ArrayList<OrganBatchFlowDTO>();
     9         }
    10         /** 2、遍历,将记录存到 Map 中*/
    11         SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd");
    12         Map<String, OrganBatchFlowDTO> map = new HashMap <String, OrganBatchFlowDTO>();    
    13         for(OrganBatchFlowDTO t:list){
    14             if(StringUtils.equals(WftsAdmConstant.UP_ORGAN_NO, t.getOrgan_no())){
    15                 t.setOrgan_name("统一支付平台");
    16             }
    17             t.setSettleDate(fmt.format(t.getBatch_change_last_time()));
    18             t.setOrganNo(t.getOrgan_no());
    19             map.put(t.getOrgan_no()+fmt.format(t.getBatch_change_last_time()), t);
    20         }
    21         /** 3、查询对账待办事项,遍历,补齐字段*/
    22         List<CompareFileDTO> list2= compareFileDao.selectForCompare();
    23         
    24         if(list2.size()>0){
    25             for(CompareFileDTO t2:list2){
    26                 if(map.containsKey((t2.getOrganNo()+t2.getSettleDate())) && 
    27                         map.get((t2.getOrganNo()+t2.getSettleDate()))!=null ){
    28                     String key =t2.getOrganNo()+t2.getSettleDate() ;
    29                     map.get(key).setCompareStatus(t2.getComparStatus());
    30                     map.get(key).setTransType(t2.getTransType());
    31                 }
    32             }
    33         }        
    34         /** 4、查询对账文件列表,遍历,补齐字段*/
    35         List<FileStatusDTO> list3= fileStatusDao.selectForCompare();
    36         for(FileStatusDTO t3:list3){
    37             if(map.containsKey((t3.getOrganNo()+t3.getSettleDate())) && 
    38                     map.get((t3.getOrganNo()+t3.getSettleDate()))!=null ){
    39                 String key =t3.getOrganNo()+t3.getSettleDate() ;
    40                 map.get(key).setFileLineCount(t3.getFileLineCount());
    41                 map.get(key).setTotalAmount(t3.getTotalAmount());
    42                 map.get(key).setsFileLineCount(t3.getsFileLineCount());
    43                 map.get(key).setsTotalAmount(t3.getsTotalAmount());
    44                 map.get(key).setFileName(t3.getFileName());
    45                 map.get(key).setMd5Str(t3.getMd5Str());
    46                 map.get(key).setAccountDataAddr(t3.getAccountDataAddr());
    47             }
    48         }
    49         /** 
    50          * map 存的value是list当中的对象,map的value值改变,同时也改变list元素对象的值,
           * 所以最后可以返回改变后的list
    52
           */ 53 return list; 54 }

    2. set用法示例

    『愿你我既可以朝九晚五,又能够浪迹天涯』
  • 相关阅读:
    2 行为型模式之
    1 行为型模式之
    WinSCP无法连接 ubuntu 的解决方法
    command 'x86_64-linux-gnu-gcc' failed with exit status 1错误及解决方案
    Ubuntu 16.04 LTS 安装 Nginx/PHP 5.6/MySQL 5.7 (LNMP) 与Laravel
    CentOS 7 安装、配置、使用 PostgreSQL 9.5及PostGIS2.2
    R实战之热点图(HeatMap)
    Windows下Eclipse连接hadoop
    Ubuntu下eclipse开发hadoop应用程序环境配置
    Hadoop集群环境搭建
  • 原文地址:https://www.cnblogs.com/zjwwljty/p/5555288.html
Copyright © 2011-2022 走看看