One of the most frequently posed collection interview questions for experienced, be ready for it. The time complexity of HashMap to getting the elements is usually from O(n) to O(Log(n)), when there is no collision occurs and the worst case is O(n) to O(1), because when collision occurs and HashMap needs to travel till the end of the linked list. Now in the case of putting the elements in HashMap, is always O(1). Below classes is the implementation of Map interface. LinkedHashMap, HashMap Hashtable, WeakHashMap, IdentityHashMap, ConcurrentHashMap, TreeMap, and EnumMap. However, as per the memory performance basis, the WeakHashMap gives better performance. But it doesn’t provide the thread safety if one needs to achieve the thread safety, to achieve the thread safety one needs to use the ConcurrentHashMap because it provides thread safety without using synchronization.