不太清楚這跟正規式或者 get 的關係...
我通常是這樣做...
HashMap<String, String> hm = new HashMap<String, String>();
hm.put("a","1");
hm.put("b","2");
hm.put("xax","3");
hm.put("ax","4");
hm.put("xa","5");
Iterator it = new Vector<String>(hm.keySet()).iterator();
while (it.hasNext()) {
String st = it.next().toString();
if (st.contains("a")) {
System.out.println(st + ": " + hm.get(st));
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 163.25.148.49