+ 8

Whats the difference between hashmap and hash set in laymans words?

21st Mar 2016, 6:24 PM
Kelvin Murithi
Kelvin Murithi - avatar
6 odpowiedzi
+ 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.
15th Apr 2016, 1:57 AM
Lê Hồng Phúc
Lê Hồng Phúc - avatar
+ 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
24th Jun 2016, 5:31 PM
mohan chakradhar v
mohan chakradhar v - avatar
+ 3
HashMap is the one with (key,value) with a relation in between them. HashSet is the one with only values just like arraylist.
4th Apr 2016, 11:38 PM
Veera D
Veera D - avatar
+ 3
HashMap's element has key-value relationship or mapping, while HashSet just keeps a group of non-duplicate elements.
18th Feb 2017, 1:24 PM
Nova716
0
Good question and good answers.
26th Jun 2016, 4:50 PM
‎‏‎‏‎Joe
‎‏‎‏‎Joe - avatar
0
Good Explanation..
13th Feb 2017, 6:20 PM
Himanshu Melkani
Himanshu Melkani - avatar