HashMap Implementation
HashMap Implementation
Java Code
import java.util.*;
@SuppressWarnings("unchecked")
public HashMap() {
this.N = 4;
this.buckets = new LinkedList[4];
for(int i=0; i<4; i++) {
this.buckets[i] = new LinkedList<>();
}
}
return -1;
}
@SuppressWarnings("unchecked")
private void rehash() {
LinkedList<Node> oldBucket[] = buckets;
buckets = new LinkedList[N*2];
map.remove("India");
System.out.println(map.get("India"));
}
}