Map Interfaces
The Map interface maps unique keys to values. A key is an object that you use to retrieve a value at a later date.
Architecture of Map interface:
Hashtable: Hashtable is similar to HashMap except it is synchronized.
Output: String, hashtable Contains :{Total=654, Sum=67}
Integer, hashtable Contains :{3=4, 1=2}
LinkedHashMap: It is Hashtable and LinkedList implementation of map interface. LinkedHashMap has a doublelinkedlist Running through all its elements.
Output: Put, LinkedHashMap Contains :{Hi=1, manoj=2, welcom=3}
Remove, LinkedHashMap Contains :{Hi=1, welcom=3}
HashMap: A HashMap is a Hashtable implementation of map interface, unlike HashMap it contains null keys and values. HashMap does not guarantee that the order of the objects will remain same over the time.
Output: Put, HashMap Contains :{Hi=1, welcom=3, manoj=2}
Remove, HashMap Contains :{Hi=1, welcom=3}
TreeMap: A TreeMap Provides red-block tree based implementation of map interface.
Output: Put, treeMap Contains :{Hi=1, manoj=2, welcom=3}
Remove, treeMap Contains :{Hi=1, welcom=3}
Architecture of Map interface:
Hashtable: Hashtable is similar to HashMap except it is synchronized.
Output: String, hashtable Contains :{Total=654, Sum=67}
Integer, hashtable Contains :{3=4, 1=2}
LinkedHashMap: It is Hashtable and LinkedList implementation of map interface. LinkedHashMap has a doublelinkedlist Running through all its elements.
Output: Put, LinkedHashMap Contains :{Hi=1, manoj=2, welcom=3}
Remove, LinkedHashMap Contains :{Hi=1, welcom=3}
HashMap: A HashMap is a Hashtable implementation of map interface, unlike HashMap it contains null keys and values. HashMap does not guarantee that the order of the objects will remain same over the time.
Output: Put, HashMap Contains :{Hi=1, welcom=3, manoj=2}
Remove, HashMap Contains :{Hi=1, welcom=3}
TreeMap: A TreeMap Provides red-block tree based implementation of map interface.
Output: Put, treeMap Contains :{Hi=1, manoj=2, welcom=3}
Remove, treeMap Contains :{Hi=1, welcom=3}