1,根据指定value 取key
String resultKey;
String str = “固定value”;
Map
map.put(“key”,“value”);//
for(Map.Entry
{
if(str.equals(str.getValue()))
{
resultKey = str.getKey();
}
}
2,根据指定key 取value
String resultVal;
String str = “固定key”;
Map
map.put(“key”,“value”);//
for(Map.Entry
{
if(str.equals(str.getKey()))
{
resultKey = str.getValue();
}
}
3,循环输出所有的值
Map
map.put(“key”,“value”);//
for(Map.Entry
{
System.out.print(str);
}