在使用ConcurrentHashMap的时候,想了下,数据插进去之后,再拿出来,会不会是按照先进先出的原则,就写了简单的列子:
public static void main(String[] args) {
Map<String, String> map = new ConcurrentHashMap<>();
map.put("1", "1-1");
map.put("2", "2-2");
map.put("3", "3-3");
map.put("4", "4-4");
map.put("5", "5-5");
for (String value : map.values()) {
System.out.println(value);
}
}
结果:
1-1
2-2
3-3
4-4
5-5
还有其他类型的Map,我这里后续用到了再测试,先记录到这里