zoukankan      html  css  js  c++  java
  • Map

    public class MapTest {

    @SuppressWarnings("rawtypes")
    public static void main(String[] args) {
    //HashMap
    System.out.println("------HashMap无序输出------");
    HashMap<String,String> hsMap=new HashMap<String,String>();
    hsMap.put("3", "Value3");
    hsMap.put("1", "Value1");
    hsMap.put("2", "Value2");
    hsMap.put("b", "ValueB");
    hsMap.put("a", "ValueA");
    Iterator it = hsMap.entrySet().iterator();
    while (it.hasNext()) {
    Map.Entry e = (Map.Entry) it.next();
    System.out.println("Key: " + e.getKey() + "--Value: " + e.getValue());
    }

    //TreeMap
    System.out.println("------TreeMap按Key排序输出------");
    TreeMap<String,String> teMap=new TreeMap<String,String>();
    teMap.put("3", "Value3");
    teMap.put("1", "Value1");
    teMap.put("2", "Value2");
    teMap.put("b", "ValueB");
    teMap.put("a", "ValueA");
    Iterator tit = teMap.entrySet().iterator();
    while (tit.hasNext()) {
    Map.Entry e = (Map.Entry) tit.next();
    System.out.println("Key: " + e.getKey() + "--Value: " + e.getValue());
    }
    }

    }

  • 相关阅读:
    python向mysql中插入数字、字符串、日期总结
    selenium鼠标事件
    iOS hook
    网络抓包篇
    frida IOS环境搭建
    git
    $emit
    better-scroll无法滚动的问题。
    this.$nextTick()作用
    better-scroll
  • 原文地址:https://www.cnblogs.com/zaoxi11/p/6026377.html
Copyright © 2011-2022 走看看