在一个ConcurrentHashMap放了1W个数据,测试的发现取同样的数据多次,第一次总是比较慢,这可能是什么原因呢ConcurrentHashMap<String,Student>map = new ConcurrentHashMap<String,Student>();
Student student;
for(int i=0;i<10000;i++)
{
student = new Student(i,""+i);
map.put(""+i,student);
}
String str=""+0;
for(int i=0;i<10;i++)
{
long start = System.nanoTime();
map.get(str);
System.out.println(System.nanoTime()-start);
}