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);
    复制代码
  • 相关阅读:
    input输入框只能输入数字和 小数点后两位
    HAVING 子句
    GROUP BY 语句
    SUM()函数
    COUNT()函数
    MySQL AVG() 函数
    adb(16)-查看实时资源占用情况top
    adb(15)-刷机相关命令
    adb(14)-设备重启/检测root
    adb(13)-设置系统日期和时间
  • 原文地址:https://www.cnblogs.com/makeryan/p/2498257.html
Copyright © 2011-2022 走看看