Hash Set
Hash Set
HashSet
1
Introduction to HashSet
List Queue
Set
Introduction to HashSet
List<E> Queue<E>
Set<E>
Introduction to HashSet
A Map is not Iterable (doesn’t inherit Iterable interface), thus cannot be used directly in a for-each loop
BUT YOU CAN GET COLLECTION VIEW of a Map with methods like entrySet(), keySet(), etc
Introduction to HashSet
Iterable<E>
Collection<E>
Map<K,V>
Map Classes
- HashMap
- LinkedHashMap
- TreeMap
hashCode(), equals(), HashMap
If we only override equals(), the code may still NOT work as intended
Because each object will have a separate hashCode() even if they have same
roll numbers
Input Hash Fn hashCode
(Mehul,1) =>
300
1 2 3 4
Thanks for
Listening!