zoukankan      html  css  js  c++  java
  • 交互设计算法基础(4)

     1   
     2 import java.util.Map;
     3 
     4 // Note the HashMap's "key" is a String and "value" is an Integer
     5 HashMap<String,Integer> hm = new HashMap<String,Integer>();
     6 
     7 // Putting key-value pairs in the HashMap
     8 hm.put("Ava", 1);
     9 hm.put("Cait", 35);
    10 hm.put("Casey", 36);
    11 
    12 // Using an enhanced loop to interate over each entry
    13 for (Map.Entry me : hm.entrySet()) {
    14   print(me.getKey() + " is ");
    15   println(me.getValue());
    16 }
    17 
    18 // We can also access values by their key
    19 int val = hm.get("Casey");
    20 println("Casey is " + val);

    Processing内建HASH Table(哈希表),倒是挺方便的,就不用自己动手写啦!!☆⌒(*^-゜)v

    爱好编程、喜欢计算机、也喜欢美食~
  • 相关阅读:
    植物园偶遇一直喵
    植物园偶遇一直喵
    美食篇
    美食篇
    端午节路过南站
    端午节路过南站
    黄山云海
    黄山云海
    Android (1)
    树和树算法(1)
  • 原文地址:https://www.cnblogs.com/x5115x/p/7530814.html
Copyright © 2011-2022 走看看