验证HashMap无序
public class MyMap {
@Test
public void test1(){
Map map = new HashMap();
map.put(1, "no 1");
map.put(3, "no 3");
map.put(6, "no 6");
map.put(4, "no 4");
map.put(5, "no 5");
for (Object e : map.entrySet()) {
Map.Entry e1 = (Map.Entry) e;
System.out.println(e1.getValue());
}
}
}
/* 输出结果
no 1
no 3
no 4
no 5
no 6
*/