+ 8
Whats the difference between hashmap and hash set in laymans words?
6 Answers
+ 23
imagine that:
-> HashMap as a train with people and seats, each person is attached to a fixed seat, and a seat has a number on it.
-> HastSet as a school bus with students, a student will have a seat if he comes first. and seats have no number on it.
+ 5
In HashMap a value can be accessed using the key...every value has an unique key
in HashSet value can be stored...however it avoids duplicate values
+ 3
HashMap is the one with (key,value) with a relation in between them.
HashSet is the one with only values just like arraylist.
+ 3
HashMap's element has key-value relationship or mapping, while HashSet just keeps a group of non-duplicate elements.
0
Good question and good answers.
0
Good Explanation..