class test {
int id;
String name = "zhqang";
}
HashMap<Object, String> params = new HashMap<Object, String>();
params.put(new test(), "1");
params.put(new test(), "2");
Iterator iter = params.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
Object key = entry.getKey();
Object val = entry.getValue();
System.out.print(entry.getValue());
}
结果
$1test@1f3aa07 -> 1
$1test@1a33d48 -> 2