Map in Java
Not Geo map
Hash Map
Available Methods
.put()
.get()
.containsKey()
.containsValue()
.getOrDefault()
.forEach() // to iterate over
.keySet() // for all keys
.values() // for all values
.replace()
.replaceAll((key,value) -> value+10)
.putIfAbsent()
.remove()Declaring Hash Map
Map<KeyType, ValueType> myMap = new HashMap<KeyType, ValueType>();Adding values
Getting values from Hash Map
Check if keys exists
get Or Default
Iterating over hashMap
replace
replace All
put If Absent
remove
Linked Hash Map
Weakhashmap
Sorted Map
Hashtable

Last updated