{"id":169,"date":"2019-01-25T04:40:31","date_gmt":"2019-01-25T04:40:31","guid":{"rendered":"https:\/\/www.kindsonthegenius.com\/java\/?p=169"},"modified":"2019-03-02T04:39:24","modified_gmt":"2019-03-02T04:39:24","slug":"28-java-hashtables","status":"publish","type":"post","link":"https:\/\/www.kindsonthegenius.com\/java\/28-java-hashtables\/","title":{"rendered":"Java &#8211; Hashtables"},"content":{"rendered":"<p>In this lesson, I would teach you all you need to be able to use Hashtables in Java.<\/p>\n<p>A hashtable in Java is an implementation of the dictionary data structure. Therefore you can use it for storage of key-values pairs. This is similar to hashmaps. But unlike hashmaps, hashtables are thread-safe (or synchronized).<\/p>\n<p>&nbsp;<\/p>\n<p>We cover the following:<\/p>\n<ol>\n<li><a href=\"#t1\">How Hashtables Work<\/a><\/li>\n<li><a href=\"#t2\">Hashtable Methods<\/a><\/li>\n<li><a href=\"#t3\">Hashtable Example<\/a><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t1\">1. How Hashtables Work<\/strong><\/h4>\n<p>To store an item in a hashtable, you need to specify the value you want to store. Also you must specify a key along with this value. Then this\u00a0 key is then hashed. This means passing it through a hash function. The output of the hashing is a hash code which represents the index where the value is to be stored.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>How to Create a Hashtable<\/strong><\/p>\n<p>You can create a hashtable using the new keyword. An example is given below:<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<pre style=\"margin: 0; line-height: 125%;\">\tHashtable ht <span style=\"color: #333333;\">=<\/span> <span style=\"color: #008800; font-weight: bold;\">new<\/span> Hashtable<span style=\"color: #333333;\">();<\/span>\r\n\tHashtable ht2 <span style=\"color: #333333;\">=<\/span> <span style=\"color: #008800; font-weight: bold;\">new<\/span> Hashtable<span style=\"color: #333333;\">(<\/span><span style=\"color: #0000dd; font-weight: bold;\">10<\/span><span style=\"color: #333333;\">);<\/span>\r\n<\/pre>\n<p>The first line creates a new hashtable while the second line creates a new hashtable with a size of 10. You can also use any of the constructors below.<\/p>\n<p>&nbsp;<\/p>\n<table class=\"table table-bordered\" align=\"center\">\n<tbody>\n<tr style=\"background-color: #f7f6f3;\">\n<th>SN<\/th>\n<th>Hashtable constructors<\/th>\n<\/tr>\n<tr>\n<td class=\"ts\">1<\/td>\n<td><b>Hashtable( )<\/b><\/p>\n<p>The default constructor of the hash table. It creates a new hashtable.<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">2<\/td>\n<td><b>Hashtable(int size)<\/b><\/p>\n<p>Takes the initial size of the table as parameter and then creates a hash table that with an initial size given by the value size.<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">3<\/td>\n<td><b>Hashtable(int size, float fillRatio)<\/b><\/p>\n<p>This creates a hash table with an initial size given by size parameter and also a fill ratio. The fill ratio must be between 0.0 and 1.0. It then determines how full the hash table can be before it is resized.<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">4<\/td>\n<td><b>Hashtable(Map &lt; ? extends K, ? extends V &gt; t)<\/b><\/p>\n<p>This constructor creates a Hashtable with the given mappings.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Table 1.1. Hashtable Constructors<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t2\">2. Hashtable Methods<\/strong><\/h4>\n<p>You can use the following methods the perform various operations on a hashtable. Similar to arraylist, you can add and delete items from a hashtable.<\/p>\n<table class=\"table table-bordered\">\n<tbody>\n<tr style=\"background-color: #f7f6f3;\">\n<th>Sr.No<\/th>\n<th>Method &amp; Description<\/th>\n<\/tr>\n<tr>\n<td class=\"ts\">1<\/td>\n<td><b>clear( )<\/b><\/p>\n<p>This is used to clear (or empty) the hash table.<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">2<\/td>\n<td><b>clone( )<\/b><\/p>\n<p>Used to return a duplicate of the invoking hashtable. Create another copy<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">3<\/td>\n<td><b>contains(Object value)<\/b><\/p>\n<p>You use this to check if the hashtable contains the specified value. It true if\u00a0 the object exists within the hash table. Otherwise, it returns false<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">4<\/td>\n<td><b>containsKey(Object key)<\/b><\/p>\n<p>You use this to check if the hashtable contains the specified key. It true if\u00a0 the key exists within the hash table. Otherwise, it returns false<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">5<\/td>\n<td><b>containsValue(Object value)<\/b><\/p>\n<p>You use this to check if the hashtable contains the specified value. It true if\u00a0 the value exists within the hashtable. Otherwise, it returns false<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">6<\/td>\n<td><b>elements( )<\/b><\/p>\n<p>Used to return an enumeration of all the values contained in the hashtable.<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">7<\/td>\n<td><b>get(Object key)<\/b><\/p>\n<p>Used to return the object that contains the value associated with the key. If the key is not in the hash table, a null object is returned.<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">8<\/td>\n<td><b>isEmpty( )<\/b><\/p>\n<p>Used to check if the hashtable is empty. Return true if the hash table is empty. Otherwise returns false.<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">9<\/td>\n<td><b>keys( )<\/b><\/p>\n<p>List of the keys contained in the hash table.<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">10<\/td>\n<td><b>put(Object key, Object value)<\/b><\/p>\n<p>You use this to add a key and a value pair into the hash table. It returns null if the key is not already existing in the hashtable; returns the previous value associated with the key if the key is already in the hashtable.<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">11<\/td>\n<td><b>rehash( )<\/b><\/p>\n<p>It Increases the size of the hashtable and then rehashes all of its keys.<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">12<\/td>\n<td><b>remove(Object key)<\/b><\/p>\n<p>Removes the specified key along with its value. Returns the value associated with the specified key. If the key is not found in the hashtable, a null object is returned.<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">13<\/td>\n<td><b>size( )<\/b><\/p>\n<p>Returns an integer value of the number of entries in the hashtable.<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">14<\/td>\n<td><b>String toString( )<\/b><\/p>\n<p>Creates the string equivalent of a hashtable.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Table 1.1: Hashtable Methods<\/p>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t2\">3. Hashtable Example<\/strong><\/h4>\n<p>In the example below, we create a hashtable and insert some items. Then remove an item. We also demonstrate the use of some other methods of the hash table. I therefor suggest you try this code on your own.<\/p>\n<p>&nbsp;<\/p>\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #008800; font-weight: bold;\">import<\/span> <span style=\"color: #0e84b5; font-weight: bold;\">java.util.Hashtable<\/span><span style=\"color: #333333;\">;<\/span>\r\n\r\n<span style=\"color: #008800; font-weight: bold;\">public<\/span> <span style=\"color: #008800; font-weight: bold;\">class<\/span> <span style=\"color: #bb0066; font-weight: bold;\">HashTableDemo<\/span> <span style=\"color: #333333;\">{<\/span>\r\n\r\n\t<span style=\"color: #008800; font-weight: bold;\">public<\/span> <span style=\"color: #008800; font-weight: bold;\">static<\/span> <span style=\"color: #333399; font-weight: bold;\">void<\/span> <span style=\"color: #0066bb; font-weight: bold;\">main<\/span><span style=\"color: #333333;\">(<\/span>String<span style=\"color: #333333;\">[]<\/span> args<span style=\"color: #333333;\">)<\/span> <span style=\"color: #333333;\">{<\/span>\r\n\t\t\r\n\tHashtable ht <span style=\"color: #333333;\">=<\/span> <span style=\"color: #008800; font-weight: bold;\">new<\/span> Hashtable<span style=\"color: #333333;\">();<\/span>\r\n\tht<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">put<\/span><span style=\"color: #333333;\">(<\/span><span style=\"color: #0000dd; font-weight: bold;\">1<\/span><span style=\"color: #333333;\">,<\/span> <span style=\"background-color: #fff0f0;\">\"Monday\"<\/span><span style=\"color: #333333;\">);<\/span>\r\n\tht<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">put<\/span><span style=\"color: #333333;\">(<\/span><span style=\"color: #0000dd; font-weight: bold;\">2<\/span><span style=\"color: #333333;\">,<\/span> <span style=\"background-color: #fff0f0;\">\"Tuesday\"<\/span><span style=\"color: #333333;\">);<\/span>\t\r\n\tht<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">put<\/span><span style=\"color: #333333;\">(<\/span><span style=\"color: #0000dd; font-weight: bold;\">3<\/span><span style=\"color: #333333;\">,<\/span> <span style=\"background-color: #fff0f0;\">\"Wednesday\"<\/span><span style=\"color: #333333;\">);<\/span>\t\r\n\tht<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">put<\/span><span style=\"color: #333333;\">(<\/span><span style=\"color: #0000dd; font-weight: bold;\">4<\/span><span style=\"color: #333333;\">,<\/span> <span style=\"background-color: #fff0f0;\">\"Thursday\"<\/span><span style=\"color: #333333;\">);<\/span>\t\r\n\tht<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">put<\/span><span style=\"color: #333333;\">(<\/span><span style=\"color: #0000dd; font-weight: bold;\">5<\/span><span style=\"color: #333333;\">,<\/span> <span style=\"background-color: #fff0f0;\">\"Friday\"<\/span><span style=\"color: #333333;\">);<\/span>\t\r\n\tht<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">put<\/span><span style=\"color: #333333;\">(<\/span><span style=\"color: #0000dd; font-weight: bold;\">6<\/span><span style=\"color: #333333;\">,<\/span> <span style=\"background-color: #fff0f0;\">\"Saturday\"<\/span><span style=\"color: #333333;\">);<\/span>\t\r\n\tht<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">put<\/span><span style=\"color: #333333;\">(<\/span><span style=\"color: #0000dd; font-weight: bold;\">7<\/span><span style=\"color: #333333;\">,<\/span> <span style=\"background-color: #fff0f0;\">\"Sunday\"<\/span><span style=\"color: #333333;\">);<\/span>\t\r\n\t\r\n\tSystem<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">out<\/span><span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">println<\/span><span style=\"color: #333333;\">(<\/span><span style=\"background-color: #fff0f0;\">\"Is Empty? \"<\/span> <span style=\"color: #333333;\">+<\/span> ht<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">isEmpty<\/span><span style=\"color: #333333;\">());<\/span>\r\n\tSystem<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">out<\/span><span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">println<\/span><span style=\"color: #333333;\">(<\/span><span style=\"background-color: #fff0f0;\">\"Contains Tuesday? \"<\/span> <span style=\"color: #333333;\">+<\/span> ht<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">contains<\/span><span style=\"color: #333333;\">(<\/span><span style=\"background-color: #fff0f0;\">\"Tuesday\"<\/span><span style=\"color: #333333;\">));<\/span>\r\n\tSystem<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">out<\/span><span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">println<\/span><span style=\"color: #333333;\">(<\/span><span style=\"background-color: #fff0f0;\">\"Value of 5: \"<\/span> <span style=\"color: #333333;\">+<\/span> ht<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">get<\/span><span style=\"color: #333333;\">(<\/span><span style=\"color: #0000dd; font-weight: bold;\">5<\/span><span style=\"color: #333333;\">));<\/span>\r\n\tSystem<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">out<\/span><span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">println<\/span><span style=\"color: #333333;\">(<\/span><span style=\"background-color: #fff0f0;\">\"Number of entries: \"<\/span> <span style=\"color: #333333;\">+<\/span> ht<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">size<\/span><span style=\"color: #333333;\">());<\/span>\r\n\t\r\n\tSystem<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">out<\/span><span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">println<\/span><span style=\"color: #333333;\">(<\/span>ht<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">toString<\/span><span style=\"color: #333333;\">());<\/span>\r\n\t<span style=\"color: #333333;\">}<\/span>\r\n<span style=\"color: #333333;\">}<\/span>\r\n<\/pre>\n<p>Listing 1.1: Demo of hashtables<\/p>\n<p>&nbsp;<\/p>\n<p>If you run the code, you would have the output below:<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<pre style=\"margin: 0; line-height: 125%;\">Is Empty<span style=\"color: #333333;\">?<\/span> <span style=\"color: #008800; font-weight: bold;\">false<\/span>\r\nContains Tuesday<span style=\"color: #333333;\">?<\/span> <span style=\"color: #008800; font-weight: bold;\">true<\/span>\r\nValue of <span style=\"color: #0000dd; font-weight: bold;\">5<\/span><span style=\"color: #333333;\">:<\/span> Friday\r\nNumber of <span style=\"color: #997700; font-weight: bold;\">entries:<\/span> <span style=\"color: #0000dd; font-weight: bold;\">7<\/span>\r\n<span style=\"color: #333333;\">{<\/span><span style=\"color: #0000dd; font-weight: bold;\">7<\/span><span style=\"color: #333333;\">=<\/span>Sunday<span style=\"color: #333333;\">,<\/span> <span style=\"color: #0000dd; font-weight: bold;\">6<\/span><span style=\"color: #333333;\">=<\/span>Saturday<span style=\"color: #333333;\">,<\/span> <span style=\"color: #0000dd; font-weight: bold;\">5<\/span><span style=\"color: #333333;\">=<\/span>Friday<span style=\"color: #333333;\">,<\/span> <span style=\"color: #0000dd; font-weight: bold;\">4<\/span><span style=\"color: #333333;\">=<\/span>Thursday<span style=\"color: #333333;\">,<\/span> <span style=\"color: #0000dd; font-weight: bold;\">3<\/span><span style=\"color: #333333;\">=<\/span>Wednesday<span style=\"color: #333333;\">,<\/span> <span style=\"color: #0000dd; font-weight: bold;\">2<\/span><span style=\"color: #333333;\">=<\/span>Tuesday<span style=\"color: #333333;\">,<\/span> <span style=\"color: #0000dd; font-weight: bold;\">1<\/span><span style=\"color: #333333;\">=<\/span>Monday<span style=\"color: #333333;\">}<\/span>\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this lesson, I would teach you all you need to be able to use Hashtables in Java. A hashtable in Java is an implementation &hellip; <\/p>\n","protected":false},"author":395,"featured_media":170,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[2],"tags":[],"class_list":["post-169","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java-tutorial"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Java - Hashtables - Java Tutorials<\/title>\n<meta name=\"description\" content=\"In this lesson I explain how hashtables in Java works. You also learn how to create hashtable, add keys and values and perform other operations.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.kindsonthegenius.com\/java\/28-java-hashtables\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java - Hashtables - Java Tutorials\" \/>\n<meta property=\"og:description\" content=\"In this lesson I explain how hashtables in Java works. You also learn how to create hashtable, add keys and values and perform other operations.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.kindsonthegenius.com\/java\/28-java-hashtables\/\" \/>\n<meta property=\"og:site_name\" content=\"Java Tutorials\" \/>\n<meta property=\"article:published_time\" content=\"2019-01-25T04:40:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-02T04:39:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.kindsonthegenius.com\/java\/wp-content\/uploads\/sites\/9\/2019\/01\/Hashtables-in-Java.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"950\" \/>\n\t<meta property=\"og:image:height\" content=\"518\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"kindsonthegenius\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"kindsonthegenius\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/28-java-hashtables\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/28-java-hashtables\\\/\"},\"author\":{\"name\":\"kindsonthegenius\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/#\\\/schema\\\/person\\\/63a68934672db675ff0cd80d066510c2\"},\"headline\":\"Java &#8211; Hashtables\",\"datePublished\":\"2019-01-25T04:40:31+00:00\",\"dateModified\":\"2019-03-02T04:39:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/28-java-hashtables\\\/\"},\"wordCount\":691,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/28-java-hashtables\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/wp-content\\\/uploads\\\/sites\\\/9\\\/2019\\\/01\\\/Hashtables-in-Java.jpg\",\"articleSection\":[\"Java Tutorial\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/28-java-hashtables\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/28-java-hashtables\\\/\",\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/28-java-hashtables\\\/\",\"name\":\"Java - Hashtables - Java Tutorials\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/28-java-hashtables\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/28-java-hashtables\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/wp-content\\\/uploads\\\/sites\\\/9\\\/2019\\\/01\\\/Hashtables-in-Java.jpg\",\"datePublished\":\"2019-01-25T04:40:31+00:00\",\"dateModified\":\"2019-03-02T04:39:24+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/#\\\/schema\\\/person\\\/63a68934672db675ff0cd80d066510c2\"},\"description\":\"In this lesson I explain how hashtables in Java works. You also learn how to create hashtable, add keys and values and perform other operations.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/28-java-hashtables\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/28-java-hashtables\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/28-java-hashtables\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/wp-content\\\/uploads\\\/sites\\\/9\\\/2019\\\/01\\\/Hashtables-in-Java.jpg\",\"contentUrl\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/wp-content\\\/uploads\\\/sites\\\/9\\\/2019\\\/01\\\/Hashtables-in-Java.jpg\",\"width\":950,\"height\":518,\"caption\":\"Hashtables in Java\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/28-java-hashtables\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java &#8211; Hashtables\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/#website\",\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/\",\"name\":\"Java Tutorials\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/#\\\/schema\\\/person\\\/63a68934672db675ff0cd80d066510c2\",\"name\":\"kindsonthegenius\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g\",\"caption\":\"kindsonthegenius\"},\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/author\\\/kindsonthegenius-2\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java - Hashtables - Java Tutorials","description":"In this lesson I explain how hashtables in Java works. You also learn how to create hashtable, add keys and values and perform other operations.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.kindsonthegenius.com\/java\/28-java-hashtables\/","og_locale":"en_US","og_type":"article","og_title":"Java - Hashtables - Java Tutorials","og_description":"In this lesson I explain how hashtables in Java works. You also learn how to create hashtable, add keys and values and perform other operations.","og_url":"https:\/\/www.kindsonthegenius.com\/java\/28-java-hashtables\/","og_site_name":"Java Tutorials","article_published_time":"2019-01-25T04:40:31+00:00","article_modified_time":"2019-03-02T04:39:24+00:00","og_image":[{"width":950,"height":518,"url":"https:\/\/www.kindsonthegenius.com\/java\/wp-content\/uploads\/sites\/9\/2019\/01\/Hashtables-in-Java.jpg","type":"image\/jpeg"}],"author":"kindsonthegenius","twitter_card":"summary_large_image","twitter_misc":{"Written by":"kindsonthegenius","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.kindsonthegenius.com\/java\/28-java-hashtables\/#article","isPartOf":{"@id":"https:\/\/www.kindsonthegenius.com\/java\/28-java-hashtables\/"},"author":{"name":"kindsonthegenius","@id":"https:\/\/www.kindsonthegenius.com\/java\/#\/schema\/person\/63a68934672db675ff0cd80d066510c2"},"headline":"Java &#8211; Hashtables","datePublished":"2019-01-25T04:40:31+00:00","dateModified":"2019-03-02T04:39:24+00:00","mainEntityOfPage":{"@id":"https:\/\/www.kindsonthegenius.com\/java\/28-java-hashtables\/"},"wordCount":691,"commentCount":0,"image":{"@id":"https:\/\/www.kindsonthegenius.com\/java\/28-java-hashtables\/#primaryimage"},"thumbnailUrl":"https:\/\/www.kindsonthegenius.com\/java\/wp-content\/uploads\/sites\/9\/2019\/01\/Hashtables-in-Java.jpg","articleSection":["Java Tutorial"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.kindsonthegenius.com\/java\/28-java-hashtables\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.kindsonthegenius.com\/java\/28-java-hashtables\/","url":"https:\/\/www.kindsonthegenius.com\/java\/28-java-hashtables\/","name":"Java - Hashtables - Java Tutorials","isPartOf":{"@id":"https:\/\/www.kindsonthegenius.com\/java\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.kindsonthegenius.com\/java\/28-java-hashtables\/#primaryimage"},"image":{"@id":"https:\/\/www.kindsonthegenius.com\/java\/28-java-hashtables\/#primaryimage"},"thumbnailUrl":"https:\/\/www.kindsonthegenius.com\/java\/wp-content\/uploads\/sites\/9\/2019\/01\/Hashtables-in-Java.jpg","datePublished":"2019-01-25T04:40:31+00:00","dateModified":"2019-03-02T04:39:24+00:00","author":{"@id":"https:\/\/www.kindsonthegenius.com\/java\/#\/schema\/person\/63a68934672db675ff0cd80d066510c2"},"description":"In this lesson I explain how hashtables in Java works. You also learn how to create hashtable, add keys and values and perform other operations.","breadcrumb":{"@id":"https:\/\/www.kindsonthegenius.com\/java\/28-java-hashtables\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.kindsonthegenius.com\/java\/28-java-hashtables\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.kindsonthegenius.com\/java\/28-java-hashtables\/#primaryimage","url":"https:\/\/www.kindsonthegenius.com\/java\/wp-content\/uploads\/sites\/9\/2019\/01\/Hashtables-in-Java.jpg","contentUrl":"https:\/\/www.kindsonthegenius.com\/java\/wp-content\/uploads\/sites\/9\/2019\/01\/Hashtables-in-Java.jpg","width":950,"height":518,"caption":"Hashtables in Java"},{"@type":"BreadcrumbList","@id":"https:\/\/www.kindsonthegenius.com\/java\/28-java-hashtables\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.kindsonthegenius.com\/java\/"},{"@type":"ListItem","position":2,"name":"Java &#8211; Hashtables"}]},{"@type":"WebSite","@id":"https:\/\/www.kindsonthegenius.com\/java\/#website","url":"https:\/\/www.kindsonthegenius.com\/java\/","name":"Java Tutorials","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.kindsonthegenius.com\/java\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.kindsonthegenius.com\/java\/#\/schema\/person\/63a68934672db675ff0cd80d066510c2","name":"kindsonthegenius","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g","caption":"kindsonthegenius"},"url":"https:\/\/www.kindsonthegenius.com\/java\/author\/kindsonthegenius-2\/"}]}},"_links":{"self":[{"href":"https:\/\/www.kindsonthegenius.com\/java\/wp-json\/wp\/v2\/posts\/169","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kindsonthegenius.com\/java\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kindsonthegenius.com\/java\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/java\/wp-json\/wp\/v2\/users\/395"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/java\/wp-json\/wp\/v2\/comments?post=169"}],"version-history":[{"count":1,"href":"https:\/\/www.kindsonthegenius.com\/java\/wp-json\/wp\/v2\/posts\/169\/revisions"}],"predecessor-version":[{"id":171,"href":"https:\/\/www.kindsonthegenius.com\/java\/wp-json\/wp\/v2\/posts\/169\/revisions\/171"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/java\/wp-json\/wp\/v2\/media\/170"}],"wp:attachment":[{"href":"https:\/\/www.kindsonthegenius.com\/java\/wp-json\/wp\/v2\/media?parent=169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/java\/wp-json\/wp\/v2\/categories?post=169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/java\/wp-json\/wp\/v2\/tags?post=169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}