public static HashMap map1=new HashMap();map1.put(10,"hello"]);
map1.put(11,"hepeng"
map1.put(12,"ni hoa");
map1.put(13+3,"haha");
接下来怎么把指定的Value 提出key来啊,
比如我要提取 "hello"的key,怎么写啊
map1.put(11,"hepeng"
map1.put(12,"ni hoa");
map1.put(13+3,"haha");
接下来怎么把指定的Value 提出key来啊,
比如我要提取 "hello"的key,怎么写啊
for (Iterator i = m.entrySet().iterator(); i.hasNext(); ) {
Map.Entry e = (Map.Entry) i.next();
if(e.getValue().toString().equals("hello"){}
System.out.println(e.getKey().toString());
}
}
for (Iterator i = m.entrySet().iterator(); i.hasNext(); ) {
Map.Entry e = (Map.Entry) i.next();
if(e.getValue().toString().equals("hello"){
System.out.println(e.getKey().toString());
}
}
} 上一帖点太快,还没写好就发出去了