Day: January 1, 2019

WeakHashMap

WeakHashMap It is exactly same as HashMap, except the following difference. In the case of HashMap, an object is not eligible for garbage, if it is associated with HashMap, even though it doesn’t contain any external reference. i.e HashMap dominates garbage collector. But in the case of WeakHashMap, if an object is not having any […]

LinkedHashMap

LinkedHashMap It is exactly same as HashMap,except the following differences. HashMap LinkedHashMap The underlying data structure is Hashtable. Insertion order is not preserve. Introduce in 1.2 version. The underlying data structure is Hashtable and LinkedList. Insertion order is preserve. Introduce in 1.4 version. In the above, if we are replacing HashMap LinkedHashMap, the following is […]

HashMap

HashMap The underlying data structure is Hashtable. Hashing insertion order is not preserve, because it based on Hashcode of keys. Duplicate keys are not allowed. But values can be duplicated. Heterogeneous objects allowed for both keys& value. Null key is allowed. Null values are allowed, any null of times. Difference between HashMap& Hashtable:- HashMap Hashtable […]

Map interface

Map interface If we want to represent group of objects as key- value pairs, then we should go for Map interface. Both key & value are objects only. Duplicated. Each key- value pair is consider as entry. hence a map is consider as a Set of entries. Collection interface mean for individual objects, where as […]