代码如下,不知道是不是这个意思public class TestMap { public static void main(String[] args) {Map map = new HashMap();
String [] a = {"a", "b", "c"};String [] b = {"d", "e", "f"};
map.put("key1", a);map.put("key2", b);//遍历整个map 里层循环 遍历每个数组里的元素 以及hashCodefor(Iterator i = map.keySet().iterator(); i.hasNext();){ String key = (String) i.next(); String str[] = map.get(key); for(int j = 0; j < str.length; j ++){
System.out.println(key + " " + str[j] + " hashCode " + str[j].hashCode()); } System.out.println();} }} |