2020
10-10
10-10
关于Java HashMap自动排序的简单剖析
1.HashMap概述HashMap是无序的,这里无序的意思是你取出数据的顺序与你存入数据的顺序不同2.发现问题当尝试向HashMap中存入int类型的key,可以看到在输出的时候会自动排序HashMap<Integer,String>map=newHashMap<>();map.put(3,"asdf");map.put(2,"asdf");map.put(1,"asdf");map.put(6,"asdf");map.put(5,"asdf");map.put(4,"asdf");map.put(8,"asdf");map.put(9,"asdf");map.put(7,"asdf");map...
继续阅读 >