Skip to content

Instantly share code, notes, and snippets.

//max has been set to 1000000;
private void writeTest(Map<Integer, Integer> map, int max) {
long startTime = System.nanoTime();
for(int i = 1; i <= max; i++) {
Integer a = new Integer(i);
map.put(a, a);
}
long endTime = System.nanoTime();
double diff = (endTime - startTime)/(double)1000000000;