5 Difference Between Hashmap and Hashset in Java With Example
5 Difference Between Hashmap and Hashset in Java With Example
2018 5 Difference between HashMap and HashSet in java with example | Java Hungry
DATA-STRUCTURES
SCJP THREADS BEST JAVA BOOKS JAVA CODING PROGRAM MORE JAVA TOPICS
5 Difference Between
HashMap And
HashSet In Java With
Example
https://javahungry.blogspot.com/2015/06/difference-between-hashset-and-hashmap-in-java-with-example.html 1/6
12.11.2018 5 Difference between HashMap and HashSet in java with example | Java Hungry
3. Implementation : HashMap
implements Map interface, while
HashSet implements Set interface.
https://javahungry.blogspot.com/2015/06/difference-between-hashset-and-hashmap-in-java-with-example.html 2/6
12.11.2018 5 Difference between HashMap and HashSet in java with example | Java Hungry
import java.util.HashMap;
import java.util.HashSet;
HashSet<String> hashsetobj = n
hashsetobj.add("Alive is awesom
hashsetobj.add("Love yourself")
System.out.println("HashSet obj
1. Performance : Performance of
add,put,remove operations are
almost same i.e constant time for
HashSet and HashMap. It is
incorrect to say HashMap is faster
than HashSet.
HashSet
HashMap
Yes,
Duplicate
values No
Duplicates
but no
duplicate
keys
Adding or HashMap
Hashing
Storing object
technique
mechanism
Dummy
No Yes
values
https://javahungry.blogspot.com/2015/06/difference-between-hashset-and-hashmap-in-java-with-example.html 5/6
12.11.2018 5 Difference between HashMap and HashSet in java with example | Java Hungry
Recommended by
Comments Community
1 Login
Sort by Best
LOG IN WITH
Name
Return to Top ↑ Java Hungry Copyright © 2018 · All Rights Reserved. Designed by studiopress
-->
https://javahungry.blogspot.com/2015/06/difference-between-hashset-and-hashmap-in-java-with-example.html 6/6