Null keys and null values

HashMap allows one null key and any number of null values, while HashTable does not allow null keys and null values in the HashTable object. Let's say you are entering employee records into a database and while uploading the employee details into your database, maybe you feel that you would not know their phone number, but you enter the field called phone number in a key value, and index value for now you would leave it as a null; you could update it later. This works in HashMap, but when you are working with HashTable, it will not allow any null keys and null values. If you feel that you want to make your program very secure and you want to block multiple threads from accessing it simultaneously, then you should ...

Get Hands-On Automation Testing with Java for Beginners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.