zoukankan      html  css  js  c++  java
  • HashMap泛型编程

      基于Java HashMap的泛型编程,常用的代码形式如下(开发中遇到的一个Case):

    复制代码
            //HashMap的创建和值添加
         HashMap<String, String> hashMap = new HashMap<String, String>(); hashMap.put("appName", "IPAD APP"); hashMap.put("appVer", "2.0"); hashMap.put("cmd","CV_Services.GetIndustryNews('consumer discretionary','en',0,10,'','XSHG,XSHE')"); hashMap.put("alg", "alg"); hashMap.put("appID", "device02154698");
         //泛型HashMap的遍历 StringBuffer urlBuffer
    = new StringBuffer(); Iterator<Entry<String, String>> iterator = hashMap.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, String> entry = iterator.next(); urlBuffer.append(entry.getKey()); urlBuffer.append("&"); urlBuffer.append(entry.getValue()); urlBuffer.append("&;"); } String url=""; try { url=URLEncoder.encode(urlBuffer.toString(), "UTF-8");  //URL编码 } catch (UnsupportedEncodingException e) { e.printStackTrace(); } System.out.println(url);
    复制代码
  • 相关阅读:
    统计代码行数
    梯度下降算法
    multiplot 安装与配置
    ros 源码安装
    cmake 指定gcc/g++版本
    python 科学计算基础库安装
    协方差矩阵的含义
    pysvn 相关
    void 0与undefined
    BEM规范
  • 原文地址:https://www.cnblogs.com/makeryan/p/2498257.html
Copyright © 2011-2022 走看看