From the course: Nail Your Java Interview

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Mastering hash-based structures

Mastering hash-based structures - Java Tutorial

From the course: Nail Your Java Interview

Start my 1-month free trial

Mastering hash-based structures

- Hash-based structures are the most commonly used data structures in technical interviews. There are a few Hash-based structures in Java including Hashtables, HashSets, and HashMaps. But they're very similar when it comes to their core functionality. There are differences lie in synchronization, usages of Knoll and whether or not duplicate values are allowed. But diving into those differences is out of the scope for this course. Generally, you should use a HashMap for your interviews because it provides the most flexibility by allowing duplicate values and an old key. A HashMap is also not synchronized, which means it has better performance than the synchronized Hashtable, but it's not thread safe. So let's talk about HashMaps. A Hash map consists of key-value pairs and uses a hash function to store and organize its data. A hashing function takes a group of characters called a key and maps them to a hash or a hash…

Contents