-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathHashMapImplementation.java
More file actions
23 lines (19 loc) · 909 Bytes
/
HashMapImplementation.java
File metadata and controls
23 lines (19 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package hashtables;
/**
* Created by Prashant
* As you can see in this program we have resolved the collision using chaining for two values
* "Prashant" and "Patrick"
*/
public class HashMapImplementation {
public static void main(String[] args){
HashMap map=new HashMap();
map.put("Nanda",Double.parseDouble("3474797289"));
map.put("Prashant",Double.parseDouble("2012682695"));
map.put("Patrick",Double.parseDouble("3474798289"));
double phone_no_prashant=map.get("Prashant");
double phone_no_patrick=map.get("Patrick");
System.out.println("We are haiving collision with following two values but It will be resolved and we will get the correct output");
System.out.println("Key= Prashant"+" Value ="+String.valueOf(phone_no_prashant));
System.out.println("Key= Patrick"+" Value ="+String.valueOf(phone_no_patrick));
}
}