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 go with HashTable. HashTable is thread-safe, and it will not release its object to another program until one program completes its operation on HashTable.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.148.102.90