It is most common interview question for senior and mid senior level java developer, specially in product company to check in depth understanding of "Internal implementations of various collections like HashMap, HashSet, LinkedHashMap, etc". Here I have documented for some of them and will add many more. Hope it will be good reading for and helpful before going for an interview.
Every Java developer more or less witness use of HashMap in software development process and quite familiar with the put/get operations associated with HashMap. However, how does HashMap works internally is not known by many people unless they make effort to see source code of java.util.HashMap class (JDK). Do you know HashMap internally uses an associative array data structure for storing key/Value pair ? It's very right time to learn internal working of HashMap and understand the underlying internal class structure, implementation and its working. Click here to find detailed explanation.
HashSet is the very obvious choice among developer when they want to store unique objects (Duplicates not allowed). Do you know HashSet uses HashMap internally to store unique objects?.If your answer is NO, then it is very right time to understand how HashSet maintain uniqueness using HahMap and makes our life easy. Here we have an detail discussion to learn and understand internal class structure, implementation and its internal working. Click here to find tutorial with detailed explanation.
HashMap does not maintain order of element and does not give any guarantee of retrieval in same sequence as they were inserted.When we need to maintain order of elements either insertion or access order then LinkedHashMap come for our rescue. What is special about LinkedHashmap which helps maintain order of element. Its is the LinkedList which LinkedHashMap maintain internally to keep control over order of elements inserted.
Click here to find detail discussion of internal class structure, implementation and its working.
====================== End of article ===========================
Happy Learning!!
Nikhil
Every Java developer more or less witness use of HashMap in software development process and quite familiar with the put/get operations associated with HashMap. However, how does HashMap works internally is not known by many people unless they make effort to see source code of java.util.HashMap class (JDK). Do you know HashMap internally uses an associative array data structure for storing key/Value pair ? It's very right time to learn internal working of HashMap and understand the underlying internal class structure, implementation and its working. Click here to find detailed explanation.
HashSet is the very obvious choice among developer when they want to store unique objects (Duplicates not allowed). Do you know HashSet uses HashMap internally to store unique objects?.If your answer is NO, then it is very right time to understand how HashSet maintain uniqueness using HahMap and makes our life easy. Here we have an detail discussion to learn and understand internal class structure, implementation and its internal working. Click here to find tutorial with detailed explanation.
HashMap does not maintain order of element and does not give any guarantee of retrieval in same sequence as they were inserted.When we need to maintain order of elements either insertion or access order then LinkedHashMap come for our rescue. What is special about LinkedHashmap which helps maintain order of element. Its is the LinkedList which LinkedHashMap maintain internally to keep control over order of elements inserted.
Click here to find detail discussion of internal class structure, implementation and its working.
====================== End of article ===========================
Happy Learning!!
Nikhil
Liên hệ Aivivu, đặt vé máy bay tham khảo
ReplyDeleteVe may bay di My
vé máy bay vinh sà i gòn tháng 8
giá vé máy bay sà i gòn hà nội vietjet
vé máy bay đi nha trang
vé máy bay đi huế giá rẻ
bảng giá taxi sân bay nội bà i
combo đà nẵng 5 ngà y 4 đêm