{"id":17391,"date":"2025-10-29T12:49:30","date_gmt":"2025-10-29T12:49:30","guid":{"rendered":"https:\/\/www.kaashivinfotech.com\/blog\/?p=17391"},"modified":"2025-10-29T13:10:58","modified_gmt":"2025-10-29T13:10:58","slug":"map-in-java-explanation-examples","status":"publish","type":"post","link":"https:\/\/www.kaashivinfotech.com\/blog\/map-in-java-explanation-examples\/","title":{"rendered":"Map in Java Explained (2025 Guide): Interface, Methods, and Real Examples You\u2019ll Actually Use \ud83d\ude80"},"content":{"rendered":"<p>If you\u2019ve ever needed to <strong>store data as key\u2013value pairs<\/strong>, you\u2019ve already brushed against one of the most powerful concepts in Java \u2014 the <strong>Map interface<\/strong>. Think of it like a mini database inside your program \u2014 where each key is unique, and every key points to exactly one value. Simple, right? Yet it\u2019s a core part of almost every Java project ever written.<\/p>\n<p>In 2025, with <strong>data-driven applications<\/strong>, <strong>APIs<\/strong>, and <strong>microservices<\/strong> dominating software architecture, Maps are used everywhere \u2014 from caching systems to configuration files and even machine learning pipelines. In fact, most Java frameworks (like Spring, Hibernate, or Kafka) rely heavily on <strong>Map-based data structures<\/strong> behind the scenes.<\/p>\n<p>So if you want to become a better Java developer \u2014 or crack interviews confidently \u2014 understanding <strong>Map in Java<\/strong> isn\u2019t optional, it\u2019s essential.<\/p>\n<p>Let\u2019s decode how Java makes mapping data both elegant and blazing fast \u26a1.<\/p>\n<hr \/>\n<h2>Key Highlights<\/h2>\n<ul>\n<li>\ud83d\udd11 Understand <strong>what Map in Java<\/strong> is and why it\u2019s a core data structure in modern development.<\/li>\n<li>\u2699\ufe0f Explore the <strong>Map interface<\/strong> hierarchy and how different implementations like <strong>HashMap, TreeMap, and LinkedHashMap<\/strong> work.<\/li>\n<li>\ud83d\udca1 Learn <strong>Map methods in Java<\/strong> through clean, real-world code examples.<\/li>\n<li>\ud83d\udd0d Compare all <strong>Map implementations<\/strong> side-by-side for performance, order, and thread safety.<\/li>\n<li>\ud83d\ude80 Discover <strong>best practices and interview tips<\/strong> that developers often overlook.<\/li>\n<\/ul>\n<hr \/>\n<h2><strong>\ud83d\udcd8 What Is the Map Interface in Java?<\/strong><\/h2>\n<p>At its core, the <strong>Map interface in Java<\/strong> represents a <strong>collection of key\u2013value pairs<\/strong> \u2014 where each <em>key<\/em> is unique, and every <em>key<\/em> maps to exactly one <em>value<\/em>. It\u2019s part of the <strong>java.util package<\/strong> and a cornerstone of the <strong>Java Collections Framework<\/strong>.<\/p>\n<p>Here\u2019s the official definition from the JDK:<\/p>\n<pre><code class=\"language-java\" data-line=\"\">public interface Map&lt;K, V&gt; {\n    \/\/ Interface methods for key-value operations\n}\n<\/code><\/pre>\n<h3>\ud83d\udd11 Key Characteristics<\/h3>\n<ul>\n<li><strong>Unique keys:<\/strong> A key can appear only once in the map.<\/li>\n<li><strong>Duplicate values allowed:<\/strong> Multiple keys can map to the same value.<\/li>\n<li><strong>No direct instantiation:<\/strong> You can\u2019t create a <code class=\"\" data-line=\"\">Map<\/code> directly; you must use classes that implement it, like <code class=\"\" data-line=\"\">HashMap<\/code>, <code class=\"\" data-line=\"\">TreeMap<\/code>, or <code class=\"\" data-line=\"\">LinkedHashMap<\/code>.<\/li>\n<li><strong>Efficient operations:<\/strong> Most implementations provide near <strong>O(1)<\/strong> time for insertion, deletion, and lookup.<\/li>\n<\/ul>\n<p>Here\u2019s a quick example to make it stick:<\/p>\n<pre><code class=\"language-java\" data-line=\"\">import java.util.*;\n\npublic class Example {\n    public static void main(String[] args) {\n        Map&lt;Integer, String&gt; map = new HashMap&lt;&gt;();\n        map.put(1, &quot;Java&quot;);\n        map.put(2, &quot;Python&quot;);\n        map.put(3, &quot;C++&quot;);\n\n        System.out.println(map);\n    }\n}\n<\/code><\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre><code class=\"\" data-line=\"\">{1=Java, 2=Python, 3=C++}\n<\/code><\/pre>\n<p>Pretty straightforward \u2014 each key maps to a value.<br \/>\nIf you add another value with the same key, the old one is replaced. This is what makes <code class=\"\" data-line=\"\">Map<\/code> ideal for <strong>fast lookups<\/strong>, like checking user IDs, caching data, or managing app settings.<\/p>\n<figure id=\"attachment_17394\" aria-describedby=\"caption-attachment-17394\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\"size-medium wp-image-17394\" src=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/map-in-java-300x169.webp\" alt=\"map in java\" width=\"300\" height=\"169\" srcset=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/map-in-java-300x169.webp 300w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/map-in-java-1024x576.webp 1024w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/map-in-java-768x432.webp 768w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/map-in-java-380x214.webp 380w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/map-in-java-800x450.webp 800w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/map-in-java-1160x653.webp 1160w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/map-in-java.webp 1280w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><figcaption id=\"caption-attachment-17394\" class=\"wp-caption-text\">map in java<\/figcaption><\/figure>\n<p>\ud83d\udca1 <em>Pro tip:<\/em> Always remember \u2014 <code class=\"\" data-line=\"\">Map<\/code> is not a subtype of <code class=\"\" data-line=\"\">Collection<\/code>. It\u2019s a separate hierarchy because key\u2013value mapping doesn\u2019t fit into the \u201csingle element\u201d model that lists and sets use.<\/p>\n<hr \/>\n<h2><strong>\ud83e\udde9 Hierarchy of Map in Java Collections Framework<\/strong><\/h2>\n<p>Before diving into how Maps work, it helps to know where they sit in the <strong>Java Collections Framework<\/strong> (JCF).<\/p>\n<p>JCF is Java\u2019s backbone for managing and manipulating groups of objects efficiently. It includes interfaces like <code class=\"\" data-line=\"\">List<\/code>, <code class=\"\" data-line=\"\">Set<\/code>, and of course, our focus \u2014 <code class=\"\" data-line=\"\">Map<\/code>.<\/p>\n<p>Here\u2019s the hierarchy (simplified):<\/p>\n<pre><code class=\"\" data-line=\"\">Java Collections Framework\n\u2502\n\u251c\u2500\u2500 Collection Interface\n\u2502   \u251c\u2500\u2500 List\n\u2502   \u2502   \u251c\u2500\u2500 ArrayList\n\u2502   \u2502   \u251c\u2500\u2500 LinkedList\n\u2502   \u2502   \u2514\u2500\u2500 Vector\n\u2502   \u2514\u2500\u2500 Set\n\u2502       \u251c\u2500\u2500 HashSet\n\u2502       \u251c\u2500\u2500 LinkedHashSet\n\u2502       \u2514\u2500\u2500 TreeSet\n\u2502\n\u2514\u2500\u2500 Map Interface\n    \u251c\u2500\u2500 HashMap\n    \u251c\u2500\u2500 LinkedHashMap\n    \u251c\u2500\u2500 TreeMap\n    \u2514\u2500\u2500 Hashtable\n<\/code><\/pre>\n<p>Each of these classes implements the <strong>Map interface<\/strong> differently \u2014 optimizing for speed, order, or thread safety.<\/p>\n<p>Let\u2019s quickly understand their place in the hierarchy:<\/p>\n<ul>\n<li><strong>HashMap<\/strong> \u2013 The go-to implementation; fast and flexible.<\/li>\n<li><strong>LinkedHashMap<\/strong> \u2013 Keeps entries in the order they were added.<\/li>\n<li><strong>TreeMap<\/strong> \u2013 Stores entries in sorted key order.<\/li>\n<li><strong>Hashtable<\/strong> \u2013 Legacy, thread-safe but outdated.<\/li>\n<li><strong>ConcurrentHashMap<\/strong> \u2013 Modern, thread-safe, high-performance version.<\/li>\n<\/ul>\n<p>You can imagine <code class=\"\" data-line=\"\">Map<\/code> as the parent blueprint \u2014 and these implementations as specialized tools built for different scenarios.<\/p>\n<p>\ud83e\udde0 <em>Developer insight:<\/em> Most enterprise systems rely heavily on <strong>HashMap<\/strong> for in-memory storage and quick data access. Even libraries like Spring Boot internally use <code class=\"\" data-line=\"\">ConcurrentHashMap<\/code> for configuration caching.<\/p>\n<hr \/>\n<h2><strong>\ud83d\udd0d Map Implementations in Java (Comparison Table)<\/strong><\/h2>\n<p>When you hear the word <em>Map<\/em>, you might instantly think of <code class=\"\" data-line=\"\">HashMap<\/code>. But here\u2019s the catch \u2014 <strong>Map<\/strong> is just an interface. What makes it powerful are its <strong>implementations<\/strong>, each designed for a different use case: some focus on speed, others on order, and a few on thread safety.<\/p>\n<p>Let\u2019s look at them side-by-side \ud83d\udc47<\/p>\n<table>\n<thead>\n<tr>\n<th><strong>Implementation<\/strong><\/th>\n<th><strong>Maintains Order?<\/strong><\/th>\n<th><strong>Allows Null?<\/strong><\/th>\n<th><strong>Thread-Safe?<\/strong><\/th>\n<th><strong>Performance<\/strong><\/th>\n<th><strong>Best Use Case<\/strong><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>HashMap<\/strong><\/td>\n<td>\u274c No<\/td>\n<td>\u2705 Yes (1 null key, many null values)<\/td>\n<td>\u274c No<\/td>\n<td>\u26a1 Very Fast (O(1))<\/td>\n<td>Default choice for most use cases<\/td>\n<\/tr>\n<tr>\n<td><strong>LinkedHashMap<\/strong><\/td>\n<td>\u2705 Insertion Order<\/td>\n<td>\u2705 Yes<\/td>\n<td>\u274c No<\/td>\n<td>\u26a1 Fast (slightly slower than HashMap)<\/td>\n<td>When you need predictable iteration order<\/td>\n<\/tr>\n<tr>\n<td><strong>TreeMap<\/strong><\/td>\n<td>\u2705 Sorted by Key<\/td>\n<td>\u274c No<\/td>\n<td>\u274c No<\/td>\n<td>\u2696\ufe0f Moderate (O(log n))<\/td>\n<td>When keys need to stay sorted<\/td>\n<\/tr>\n<tr>\n<td><strong>Hashtable<\/strong><\/td>\n<td>\u274c No<\/td>\n<td>\u274c No<\/td>\n<td>\u2705 Yes<\/td>\n<td>\ud83e\uddf1 Slower (synchronized)<\/td>\n<td>Legacy thread-safe codebases<\/td>\n<\/tr>\n<tr>\n<td><strong>ConcurrentHashMap<\/strong><\/td>\n<td>\u274c No<\/td>\n<td>\u274c No<\/td>\n<td>\u2705 Yes<\/td>\n<td>\u26a1 Thread-safe &amp; fast<\/td>\n<td>Multithreaded applications<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\ud83d\udcac Quick Breakdown<\/h3>\n<p><strong>1\ufe0f\u20e3 HashMap:<\/strong><br \/>\nThe default go-to. It\u2019s fast, simple, and ideal when you don\u2019t care about order. Great for caches, lookups, or storing configurations.<\/p>\n<p><strong>2\ufe0f\u20e3 LinkedHashMap:<\/strong><br \/>\nLike a HashMap that remembers the order of insertion. Use it for LRU (Least Recently Used) caches or when predictable order matters.<\/p>\n<p><strong>3\ufe0f\u20e3 TreeMap:<\/strong><br \/>\nImplements the <strong>SortedMap interface<\/strong>, keeping keys sorted in their natural order or via a custom comparator. Perfect for leaderboards, ranking systems, or any \u201csorted\u201d lookup.<\/p>\n<p><strong>4\ufe0f\u20e3 Hashtable:<\/strong><br \/>\nAn old-school, synchronized version of HashMap. It\u2019s thread-safe but outdated \u2014 you\u2019ll rarely use it in new code.<\/p>\n<p><strong>5\ufe0f\u20e3 ConcurrentHashMap:<\/strong><br \/>\nThe modern hero for multi-threaded environments. It allows concurrent reads and segmented writes \u2014 offering <strong>thread safety without killing performance<\/strong>.<\/p>\n<p>\ud83d\udca1 <em>Developer insight:<\/em> In enterprise systems, <strong>ConcurrentHashMap<\/strong> often replaces <code class=\"\" data-line=\"\">Hashtable<\/code> because it scales better under load. Many frameworks (like Spring) internally rely on it for configuration and caching layers.<\/p>\n<figure id=\"attachment_17395\" aria-describedby=\"caption-attachment-17395\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"size-medium wp-image-17395\" src=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Map-Implementations-in-Java-300x200.webp\" alt=\"Map Implementations in Java\" width=\"300\" height=\"200\" srcset=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Map-Implementations-in-Java-300x200.webp 300w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Map-Implementations-in-Java-1024x683.webp 1024w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Map-Implementations-in-Java-768x512.webp 768w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Map-Implementations-in-Java-380x253.webp 380w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Map-Implementations-in-Java-800x533.webp 800w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Map-Implementations-in-Java-1160x773.webp 1160w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Map-Implementations-in-Java.webp 1536w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><figcaption id=\"caption-attachment-17395\" class=\"wp-caption-text\">Map Implementations in Java<\/figcaption><\/figure>\n<hr \/>\n<h2><strong>\ud83d\udee0\ufe0f How to Create a Map in Java<\/strong><\/h2>\n<p>Now that you know which Map to pick, let\u2019s actually <strong>create one<\/strong>.<br \/>\nRemember: <code class=\"\" data-line=\"\">Map<\/code> is an <em>interface<\/em> \u2014 so you can\u2019t do <code class=\"\" data-line=\"\">new Map()<\/code>.<br \/>\nYou must instantiate one of its child classes.<\/p>\n<p>Here\u2019s the simplest example using <strong>HashMap<\/strong>:<\/p>\n<pre><code class=\"language-java\" data-line=\"\">import java.util.*;\n\npublic class CreateMapExample {\n    public static void main(String[] args) {\n        Map&lt;String, Integer&gt; studentScores = new HashMap&lt;&gt;();\n        studentScores.put(&quot;Alice&quot;, 95);\n        studentScores.put(&quot;Bob&quot;, 88);\n        studentScores.put(&quot;Charlie&quot;, 92);\n\n        System.out.println(studentScores);\n    }\n}\n<\/code><\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre><code class=\"\" data-line=\"\">{Bob=88, Alice=95, Charlie=92}\n<\/code><\/pre>\n<p>Did you notice the order? It\u2019s not the same as the insertion order \u2014 because <strong>HashMap doesn\u2019t preserve it<\/strong>.<\/p>\n<p>If you want to maintain the order, just swap <code class=\"\" data-line=\"\">HashMap<\/code> with <code class=\"\" data-line=\"\">LinkedHashMap<\/code>:<\/p>\n<pre><code class=\"language-java\" data-line=\"\">Map&lt;String, Integer&gt; studentScores = new LinkedHashMap&lt;&gt;();\n<\/code><\/pre>\n<p>And boom \u2014 now your keys print exactly in the order they were added.<\/p>\n<p>\ud83e\udde0 <em>Tip:<\/em> Always program to the interface, not the implementation.<\/p>\n<pre><code class=\"language-java\" data-line=\"\">Map&lt;String, Integer&gt; map = new HashMap&lt;&gt;();\n<\/code><\/pre>\n<p>This makes your code flexible \u2014 you can switch to <code class=\"\" data-line=\"\">TreeMap<\/code> or <code class=\"\" data-line=\"\">LinkedHashMap<\/code> later without changing the rest of your code.<\/p>\n<hr \/>\n<h2><strong>\ud83d\udd04 Common Operations on Map in Java<\/strong><\/h2>\n<p>Once your map is created, you\u2019ll want to <strong>add, update, remove, and loop through<\/strong> entries. Let\u2019s explore the most common Map operations \u2014 using <code class=\"\" data-line=\"\">HashMap<\/code> for clarity.<\/p>\n<hr \/>\n<h3><strong>1\ufe0f\u20e3 Adding Elements \u2013 <code class=\"\" data-line=\"\">put()<\/code><\/strong><\/h3>\n<pre><code class=\"language-java\" data-line=\"\">Map&lt;Integer, String&gt; languages = new HashMap&lt;&gt;();\nlanguages.put(1, &quot;Java&quot;);\nlanguages.put(2, &quot;Python&quot;);\nlanguages.put(3, &quot;C++&quot;);\nSystem.out.println(languages);\n<\/code><\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre><code class=\"\" data-line=\"\">{1=Java, 2=Python, 3=C++}\n<\/code><\/pre>\n<p>\u2705 Adds entries as key\u2013value pairs.<br \/>\n\u26a0\ufe0f If the key already exists, the value will be replaced.<\/p>\n<hr \/>\n<h3><strong>2\ufe0f\u20e3 Updating Elements \u2013 Reusing the Same Key<\/strong><\/h3>\n<pre><code class=\"language-java\" data-line=\"\">languages.put(2, &quot;JavaScript&quot;);\nSystem.out.println(languages);\n<\/code><\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre><code class=\"\" data-line=\"\">{1=Java, 2=JavaScript, 3=C++}\n<\/code><\/pre>\n<p>The value for key <code class=\"\" data-line=\"\">2<\/code> changed from <em>Python<\/em> \u2192 <em>JavaScript<\/em>.<br \/>\n<em>Reason:<\/em> Each key is unique, and new inserts overwrite old values for the same key.<\/p>\n<hr \/>\n<h3><strong>3\ufe0f\u20e3 Removing Elements \u2013 <code class=\"\" data-line=\"\">remove()<\/code><\/strong><\/h3>\n<pre><code class=\"language-java\" data-line=\"\">languages.remove(3);\nSystem.out.println(languages);\n<\/code><\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre><code class=\"\" data-line=\"\">{1=Java, 2=JavaScript}\n<\/code><\/pre>\n<p>Removes the entry with the specified key.<\/p>\n<hr \/>\n<h3><strong>4\ufe0f\u20e3 Checking Existence \u2013 <code class=\"\" data-line=\"\">containsKey()<\/code> &amp; <code class=\"\" data-line=\"\">containsValue()<\/code><\/strong><\/h3>\n<pre><code class=\"language-java\" data-line=\"\">System.out.println(languages.containsKey(1));  \/\/ true\nSystem.out.println(languages.containsValue(&quot;C++&quot;));  \/\/ false\n<\/code><\/pre>\n<p>Use these to validate keys\/values before performing operations.<\/p>\n<hr \/>\n<h3><strong>5\ufe0f\u20e3 Iterating Over Map \u2013 Best Practices<\/strong><\/h3>\n<p><strong>\u2705 Using entrySet() (Recommended)<\/strong><\/p>\n<pre><code class=\"language-java\" data-line=\"\">for (Map.Entry&lt;Integer, String&gt; entry : languages.entrySet()) {\n    System.out.println(entry.getKey() + &quot; -&gt; &quot; + entry.getValue());\n}\n<\/code><\/pre>\n<p><strong>\u2705 Using keySet()<\/strong><\/p>\n<pre><code class=\"language-java\" data-line=\"\">for (Integer key : languages.keySet()) {\n    System.out.println(key + &quot; : &quot; + languages.get(key));\n}\n<\/code><\/pre>\n<p><strong>\u2705 Using forEach (Java 8 and above)<\/strong><\/p>\n<pre><code class=\"language-java\" data-line=\"\">languages.forEach((key, value) -&gt; \n    System.out.println(key + &quot; =&gt; &quot; + value));\n<\/code><\/pre>\n<p>\ud83e\udde0 <em>Pro tip:<\/em> <code class=\"\" data-line=\"\">forEach()<\/code> is cleaner and preferred in modern Java, especially for lambda-based functional code.<\/p>\n<hr \/>\n<h3><strong>6\ufe0f\u20e3 Clearing a Map \u2013 <code class=\"\" data-line=\"\">clear()<\/code><\/strong><\/h3>\n<pre><code class=\"language-java\" data-line=\"\">languages.clear();\nSystem.out.println(languages.isEmpty()); \/\/ true\n<\/code><\/pre>\n<p>Removes all entries at once \u2014 handy for reinitializing caches or session data.<\/p>\n<hr \/>\n<p>\ud83d\udca1 <em>Best Practice:<\/em><br \/>\nIf you\u2019re using a map in multi-threaded environments (like APIs or concurrent tasks), <strong>never use a raw HashMap<\/strong> \u2014 go for <code class=\"\" data-line=\"\">ConcurrentHashMap<\/code> to avoid race conditions and inconsistent reads.<\/p>\n<hr \/>\n<h2><strong>\ud83e\udde0 Important Map Methods in Java (with Examples)<\/strong><\/h2>\n<p>Once you\u2019re comfortable adding and iterating through Maps, it\u2019s time to master the <strong>core Map methods in Java<\/strong> \u2014 the ones you\u2019ll use daily whether you\u2019re building APIs, backend systems, or solving coding interviews.<\/p>\n<p>Here\u2019s a <strong>quick reference table<\/strong> that summarizes the most used methods in the <strong>Map interface in Java<\/strong> \ud83d\udc47<\/p>\n<table>\n<thead>\n<tr>\n<th><strong>Method<\/strong><\/th>\n<th><strong>Description<\/strong><\/th>\n<th><strong>Example Code<\/strong><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code class=\"\" data-line=\"\">put(K key, V value)<\/code><\/td>\n<td>Adds a key-value pair (or replaces if key exists)<\/td>\n<td><code class=\"\" data-line=\"\">map.put(1, &quot;Java&quot;);<\/code><\/td>\n<\/tr>\n<tr>\n<td><code class=\"\" data-line=\"\">get(Object key)<\/code><\/td>\n<td>Returns value for the given key<\/td>\n<td><code class=\"\" data-line=\"\">map.get(1); \/\/ Java<\/code><\/td>\n<\/tr>\n<tr>\n<td><code class=\"\" data-line=\"\">remove(Object key)<\/code><\/td>\n<td>Removes entry by key<\/td>\n<td><code class=\"\" data-line=\"\">map.remove(2);<\/code><\/td>\n<\/tr>\n<tr>\n<td><code class=\"\" data-line=\"\">containsKey(Object key)<\/code><\/td>\n<td>Checks if key exists<\/td>\n<td><code class=\"\" data-line=\"\">map.containsKey(1); \/\/ true<\/code><\/td>\n<\/tr>\n<tr>\n<td><code class=\"\" data-line=\"\">containsValue(Object value)<\/code><\/td>\n<td>Checks if a value exists<\/td>\n<td><code class=\"\" data-line=\"\">map.containsValue(&quot;C++&quot;);<\/code><\/td>\n<\/tr>\n<tr>\n<td><code class=\"\" data-line=\"\">size()<\/code><\/td>\n<td>Returns total entries<\/td>\n<td><code class=\"\" data-line=\"\">map.size();<\/code><\/td>\n<\/tr>\n<tr>\n<td><code class=\"\" data-line=\"\">isEmpty()<\/code><\/td>\n<td>Checks if map is empty<\/td>\n<td><code class=\"\" data-line=\"\">map.isEmpty();<\/code><\/td>\n<\/tr>\n<tr>\n<td><code class=\"\" data-line=\"\">clear()<\/code><\/td>\n<td>Removes all entries<\/td>\n<td><code class=\"\" data-line=\"\">map.clear();<\/code><\/td>\n<\/tr>\n<tr>\n<td><code class=\"\" data-line=\"\">replace(K key, V value)<\/code><\/td>\n<td>Updates existing value<\/td>\n<td><code class=\"\" data-line=\"\">map.replace(1, &quot;Kotlin&quot;);<\/code><\/td>\n<\/tr>\n<tr>\n<td><code class=\"\" data-line=\"\">compute(K key, BiFunction)<\/code><\/td>\n<td>Recomputes value for a key<\/td>\n<td><code class=\"\" data-line=\"\">map.compute(1, (k, v) -&gt; v + &quot; Dev&quot;);<\/code><\/td>\n<\/tr>\n<tr>\n<td><code class=\"\" data-line=\"\">computeIfAbsent(K key, Function)<\/code><\/td>\n<td>Adds key only if missing<\/td>\n<td><code class=\"\" data-line=\"\">map.computeIfAbsent(2, k -&gt; &quot;Python&quot;);<\/code><\/td>\n<\/tr>\n<tr>\n<td><code class=\"\" data-line=\"\">forEach(BiConsumer)<\/code><\/td>\n<td>Iterates through map (Java 8+)<\/td>\n<td><code class=\"\" data-line=\"\">map.forEach((k, v) -&gt; ...);<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>\u2699\ufe0f Example: Advanced Operations<\/h3>\n<pre><code class=\"language-java\" data-line=\"\">import java.util.*;\n\npublic class MapMethodsExample {\n    public static void main(String[] args) {\n        Map&lt;Integer, String&gt; lang = new HashMap&lt;&gt;();\n        lang.put(1, &quot;Java&quot;);\n        lang.put(2, &quot;Python&quot;);\n\n        lang.replace(2, &quot;Go&quot;);\n        lang.compute(1, (k, v) -&gt; v + &quot; Developer&quot;);\n        lang.computeIfAbsent(3, k -&gt; &quot;Rust&quot;);\n        \n        lang.forEach((key, value) -&gt;\n            System.out.println(key + &quot; =&gt; &quot; + value));\n    }\n}\n<\/code><\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre><code class=\"\" data-line=\"\">1 =&gt; Java Developer\n2 =&gt; Go\n3 =&gt; Rust\n<\/code><\/pre>\n<p>\ud83d\udca1 <em>Pro tip:<\/em><\/p>\n<ul>\n<li>Use <code class=\"\" data-line=\"\">computeIfAbsent()<\/code> when you need lazy initialization (like caching or counting).<\/li>\n<li><code class=\"\" data-line=\"\">replace()<\/code> is safer than <code class=\"\" data-line=\"\">put()<\/code> when updating existing keys since it avoids unintended new entries.<\/li>\n<\/ul>\n<hr \/>\n<h2><strong>\ud83c\udf33 SortedMap in Java (TreeMap Explained)<\/strong><\/h2>\n<p>When order matters, <code class=\"\" data-line=\"\">TreeMap<\/code> steps in as the elegant cousin of <code class=\"\" data-line=\"\">HashMap<\/code>.<br \/>\nIt implements the <strong>SortedMap interface<\/strong>, automatically storing keys in a <strong>sorted (ascending)<\/strong> order \u2014 either natural order (for <code class=\"\" data-line=\"\">Comparable<\/code> keys) or a custom comparator.<\/p>\n<h3><strong>Creating a TreeMap<\/strong><\/h3>\n<pre><code class=\"language-java\" data-line=\"\">import java.util.*;\n\npublic class TreeMapExample {\n    public static void main(String[] args) {\n        Map&lt;Integer, String&gt; courses = new TreeMap&lt;&gt;();\n        courses.put(3, &quot;C++&quot;);\n        courses.put(1, &quot;Java&quot;);\n        courses.put(2, &quot;Python&quot;);\n\n        System.out.println(courses);\n    }\n}\n<\/code><\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre><code class=\"\" data-line=\"\">{1=Java, 2=Python, 3=C++}\n<\/code><\/pre>\n<p>Notice something?<br \/>\nEven though we inserted keys in random order, the output is <strong>sorted by keys<\/strong>.<\/p>\n<h3>\u2699\ufe0f Custom Sorting Example<\/h3>\n<p>You can even define your own sort order:<\/p>\n<pre><code class=\"language-java\" data-line=\"\">Map&lt;Integer, String&gt; map = new TreeMap&lt;&gt;(Comparator.reverseOrder());\nmap.put(1, &quot;A&quot;);\nmap.put(3, &quot;C&quot;);\nmap.put(2, &quot;B&quot;);\nSystem.out.println(map);\n<\/code><\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre><code class=\"\" data-line=\"\">{3=C, 2=B, 1=A}\n<\/code><\/pre>\n<h3>\ud83d\udeab Why TreeMap Doesn\u2019t Allow Null Keys<\/h3>\n<p>Because sorting requires comparisons between keys, and comparing <code class=\"\" data-line=\"\">null<\/code> with other objects causes a <code class=\"\" data-line=\"\">NullPointerException<\/code>.<br \/>\nHence, <strong>TreeMap disallows null keys<\/strong> (though it allows null values).<\/p>\n<p>\ud83d\udca1 <em>Best for:<\/em><\/p>\n<ul>\n<li>Sorted leaderboards<\/li>\n<li>Range queries (like fetching all keys below 100)<\/li>\n<li>Navigable data structures (<code class=\"\" data-line=\"\">headMap()<\/code>, <code class=\"\" data-line=\"\">tailMap()<\/code>, <code class=\"\" data-line=\"\">subMap()<\/code>)<\/li>\n<\/ul>\n<p>\ud83e\udde0 <em>Pro insight:<\/em> In trading systems, search engines, or ranking applications, developers use <code class=\"\" data-line=\"\">TreeMap<\/code> for quick retrieval of <em>\u201cnext higher\u201d<\/em> or <em>\u201clower\u201d<\/em> keys \u2014 something HashMap can\u2019t do.<\/p>\n<hr \/>\n<h2><strong>\ud83d\udca1 Real-World Use Cases of Map in Java<\/strong><\/h2>\n<p>Maps aren\u2019t just for theory \u2014 they\u2019re quietly running the world behind your favorite apps. Here are some <strong>real, practical examples<\/strong> of how Java Maps are used every day \ud83d\udc47<\/p>\n<hr \/>\n<h3><strong>1\ufe0f\u20e3 User Login Systems<\/strong><\/h3>\n<p>Store usernames as keys and password hashes as values.<\/p>\n<pre><code class=\"language-java\" data-line=\"\">Map&lt;String, String&gt; users = new HashMap&lt;&gt;();\nusers.put(&quot;john_doe&quot;, &quot;hash@123&quot;);\nusers.put(&quot;alice99&quot;, &quot;h$29xg&quot;);\n<\/code><\/pre>\n<p>\u2705 Constant-time lookups make login checks fast.<\/p>\n<hr \/>\n<h3><strong>2\ufe0f\u20e3 Employee ID Lookup<\/strong><\/h3>\n<p>Store employee IDs and names for quick retrieval.<\/p>\n<pre><code class=\"language-java\" data-line=\"\">Map&lt;Integer, String&gt; employees = new HashMap&lt;&gt;();\nemployees.put(101, &quot;Rahul&quot;);\nemployees.put(102, &quot;Aisha&quot;);\nSystem.out.println(employees.get(101)); \/\/ Rahul\n<\/code><\/pre>\n<hr \/>\n<h3><strong>3\ufe0f\u20e3 Word Frequency Counter (Interview Favorite)<\/strong><\/h3>\n<p>Count occurrences of words using <code class=\"\" data-line=\"\">compute()<\/code> or <code class=\"\" data-line=\"\">merge()<\/code>:<\/p>\n<pre><code class=\"language-java\" data-line=\"\">String text = &quot;java map java code map&quot;;\nMap&lt;String, Integer&gt; freq = new HashMap&lt;&gt;();\n\nfor (String word : text.split(&quot; &quot;)) {\n    freq.merge(word, 1, Integer::sum);\n}\nSystem.out.println(freq);\n<\/code><\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre><code class=\"\" data-line=\"\">{java=2, map=2, code=1}\n<\/code><\/pre>\n<p>\ud83c\udfaf <em>Common interview question:<\/em> \u201cHow would you count word occurrences in Java using a Map?\u201d<\/p>\n<hr \/>\n<h3><strong>4\ufe0f\u20e3 Caching API Responses<\/strong><\/h3>\n<p>In real-world APIs, caching often uses Maps to avoid hitting the database repeatedly.<\/p>\n<pre><code class=\"language-java\" data-line=\"\">Map&lt;String, Object&gt; cache = new ConcurrentHashMap&lt;&gt;();\ncache.put(&quot;user_123&quot;, userData);\n<\/code><\/pre>\n<p>\u2705 Faster response, lower database load.<\/p>\n<hr \/>\n<h3><strong>5\ufe0f\u20e3 JSON-like Data Structures<\/strong><\/h3>\n<p>Since JSON is inherently key-value based, Maps are perfect for representing structured data in memory.<\/p>\n<pre><code class=\"language-java\" data-line=\"\">Map&lt;String, Object&gt; json = new HashMap&lt;&gt;();\njson.put(&quot;name&quot;, &quot;Arun&quot;);\njson.put(&quot;age&quot;, 25);\njson.put(&quot;skills&quot;, List.of(&quot;Java&quot;, &quot;Spring&quot;, &quot;SQL&quot;));\n<\/code><\/pre>\n<p>\ud83d\udce6 Ideal for serializing and transferring between APIs.<\/p>\n<hr \/>\n<p>\ud83d\udca1 <em>Best Practice Summary:<\/em><\/p>\n<ul>\n<li>Use <strong>HashMap<\/strong> when speed matters.<\/li>\n<li>Use <strong>LinkedHashMap<\/strong> for predictable order.<\/li>\n<li>Use <strong>TreeMap<\/strong> for sorted keys.<\/li>\n<li>Use <strong>ConcurrentHashMap<\/strong> for multi-threaded apps.<\/li>\n<\/ul>\n<hr \/>\n<h2>\ud83e\uddea Interview Tips &amp; Practice Tasks<\/h2>\n<p>If you\u2019re preparing for a Java interview, chances are \u2014 <em>Map in Java<\/em> will show up in some form. It\u2019s one of the most common topics to test your understanding of <strong>data structures and Collections Framework<\/strong>. Let\u2019s go through a few <strong>practical tasks and questions<\/strong> that often trip up even experienced developers \ud83d\udc47<\/p>\n<h3>\ud83e\udded Practice Tasks<\/h3>\n<ol>\n<li><strong>Count word occurrences using Map<\/strong>\n<pre><code class=\"language-java\" data-line=\"\">import java.util.*;\n\npublic class WordCount {\n    public static void main(String[] args) {\n        String text = &quot;java map in java map example&quot;;\n        String[] words = text.split(&quot; &quot;);\n\n        Map&lt;String, Integer&gt; frequency = new HashMap&lt;&gt;();\n\n        for (String word : words) {\n            frequency.put(word, frequency.getOrDefault(word, 0) + 1);\n        }\n\n        System.out.println(frequency);\n    }\n}\n<\/code><\/pre>\n<p>\u2705 <em>Output:<\/em> <code class=\"\" data-line=\"\">{java=2, map=2, in=1, example=1}<\/code><br \/>\n\ud83e\udde0 <em>Concept reinforced:<\/em> Using <code class=\"\" data-line=\"\">getOrDefault()<\/code> and key-based counting.<\/li>\n<li><strong>Find the first non-repeating character using LinkedHashMap<\/strong><br \/>\n<em>Hint:<\/em> Use LinkedHashMap to maintain insertion order.<\/li>\n<li><strong>Create a frequency map of characters from a file.<\/strong><br \/>\n<em>Bonus:<\/em> Try it with <code class=\"\" data-line=\"\">ConcurrentHashMap<\/code> if you want thread safety.<\/li>\n<\/ol>\n<hr \/>\n<h3>\ud83d\udcac Common Interview Questions<\/h3>\n<p><strong>Q1:<\/strong> What\u2019s the difference between <code class=\"\" data-line=\"\">HashMap<\/code> and <code class=\"\" data-line=\"\">Hashtable<\/code>?<br \/>\n<strong>A:<\/strong> <code class=\"\" data-line=\"\">HashMap<\/code> is <em>not synchronized<\/em> (faster but not thread-safe), while <code class=\"\" data-line=\"\">Hashtable<\/code> is <em>synchronized<\/em> (thread-safe but slower). <code class=\"\" data-line=\"\">HashMap<\/code> allows <code class=\"\" data-line=\"\">null<\/code> keys\/values; <code class=\"\" data-line=\"\">Hashtable<\/code> doesn\u2019t.<\/p>\n<p><strong>Q2:<\/strong> Why does <code class=\"\" data-line=\"\">TreeMap<\/code> not allow <code class=\"\" data-line=\"\">null<\/code> keys?<br \/>\n<strong>A:<\/strong> Because <code class=\"\" data-line=\"\">TreeMap<\/code> sorts keys using natural ordering or a comparator \u2014 <code class=\"\" data-line=\"\">null<\/code> can\u2019t be compared, so it throws a <code class=\"\" data-line=\"\">NullPointerException<\/code>.<\/p>\n<p><strong>Q3:<\/strong> Which <code class=\"\" data-line=\"\">Map<\/code> implementation should you use for multi-threaded environments?<br \/>\n<strong>A:<\/strong> Use <strong><code class=\"\" data-line=\"\">ConcurrentHashMap<\/code><\/strong>, as it allows concurrent reads and thread-safe updates without blocking the entire map.<\/p>\n<p><strong>Q4:<\/strong> How is <code class=\"\" data-line=\"\">HashMap<\/code> internally implemented?<br \/>\n<strong>A:<\/strong> It uses a <strong>hash table<\/strong> (array of buckets) and <strong>linked lists \/ red-black trees<\/strong> for storing key-value pairs, depending on hash collisions and capacity.<\/p>\n<p><strong>Q5:<\/strong> How can you iterate through a <code class=\"\" data-line=\"\">Map<\/code> efficiently?<br \/>\n<strong>A:<\/strong> Use:<\/p>\n<pre><code class=\"language-java\" data-line=\"\">for (Map.Entry&lt;Integer, String&gt; entry : map.entrySet()) {\n    System.out.println(entry.getKey() + &quot; =&gt; &quot; + entry.getValue());\n}\n<\/code><\/pre>\n<p>This is the most efficient and clean way to iterate using <code class=\"\" data-line=\"\">entrySet()<\/code>.<\/p>\n<p><strong>Q6:<\/strong> What\u2019s the time complexity of basic operations in a <code class=\"\" data-line=\"\">HashMap<\/code>?<br \/>\n<strong>A:<\/strong> On average, <strong>O(1)<\/strong> for <code class=\"\" data-line=\"\">put()<\/code> and <code class=\"\" data-line=\"\">get()<\/code>, but in worst cases (when collisions occur excessively), it can degrade to <strong>O(n)<\/strong>.<\/p>\n<hr \/>\n<h3>\u26a1 Bonus Tip<\/h3>\n<p>When in doubt \u2014 remember:<\/p>\n<ul>\n<li>Use <code class=\"\" data-line=\"\">HashMap<\/code> for general use.<\/li>\n<li>Use <code class=\"\" data-line=\"\">LinkedHashMap<\/code> when order matters.<\/li>\n<li>Use <code class=\"\" data-line=\"\">TreeMap<\/code> when sorting matters.<\/li>\n<li>Use <code class=\"\" data-line=\"\">ConcurrentHashMap<\/code> when threads matter.<\/li>\n<\/ul>\n<hr \/>\n<h2>\ud83c\udfaf Conclusion<\/h2>\n<p>The <strong>Map interface in Java<\/strong> is more than just another collection \u2014 it\u2019s the foundation for <strong>key-value data management<\/strong>. From handling configurations and caches to implementing complex algorithms, <em>Maps<\/em> make Java flexible, fast, and readable.<\/p>\n<p>Choosing the right implementation can drastically improve your app\u2019s <strong>performance and maintainability<\/strong>:<\/p>\n<ul>\n<li><code class=\"\" data-line=\"\">HashMap<\/code> for speed \ud83c\udfce\ufe0f<\/li>\n<li><code class=\"\" data-line=\"\">LinkedHashMap<\/code> for order \ud83d\udcda<\/li>\n<li><code class=\"\" data-line=\"\">TreeMap<\/code> for sorting \ud83c\udf32<\/li>\n<li><code class=\"\" data-line=\"\">ConcurrentHashMap<\/code> for thread safety \u2699\ufe0f<\/li>\n<\/ul>\n<p>In short \u2014 whenever you think in <em>pairs<\/em> (ID \u2192 Name, Word \u2192 Count, Key \u2192 Value) \u2014 a <strong>Map<\/strong> is your best friend.<\/p>\n<hr \/>\n<h2>\ud83d\udcda Related Reads for Java Developers<\/h2>\n<p>If you found this guide on <em>Map in Java<\/em> useful, you\u2019ll love these hand-picked articles that deepen your Java knowledge \ud83d\udc47<\/p>\n<p>\ud83d\udd39 <strong>\ud83e\udde0 <a href=\"https:\/\/www.kaashivinfotech.com\/blog\/enum-in-java-complete-guide-2025\/\">Enum in Java: Powerful Examples Every Developer Should Master in 2025<\/a><\/strong><br \/>\nLearn how Enums bring type safety, cleaner code, and better readability in Java applications.<\/p>\n<p>\ud83d\udd39 <strong>\u26a1 <a href=\"https:\/\/www.wikitechy.com\/ternary-operator-in-java-syntax-algorithm-more\/\" target=\"_blank\" rel=\"noopener\">Clever Ways to Master the Ternary Operator in Java (with Real-World Examples &amp; Developer Insights) 2025<\/a><\/strong><br \/>\nSimplify your Java logic using the ternary operator \u2014 with practical examples and developer insights.<\/p>\n<p>\ud83d\udd39 <strong>\ud83d\udca1 <a href=\"https:\/\/www.kaashivinfotech.com\/blog\/abstract-classes-in-java\/\">Abstract Classes in Java: 7 Essential Things You Must Know to Master Java OOP<\/a><\/strong><br \/>\nUnderstand abstraction, inheritance, and OOP design with clear code examples and tips.<\/p>\n<p>\ud83d\udd39 <strong>\ud83e\udde9 <a href=\"https:\/\/www.wikitechy.com\/java-string-methods-programs-interview-questions\/\" target=\"_blank\" rel=\"noopener\">7 Things You Must Know About Java String (With Real Examples &amp; Insights)<\/a><\/strong><br \/>\nDeep dive into Java Strings \u2014 methods, immutability, and interview-focused examples.<\/p>\n<p>\ud83d\udd39 <strong>\ud83c\udfd7\ufe0f <a href=\"https:\/\/www.kaashivinfotech.com\/blog\/design-patterns-in-csharp-java-2025\/\">Design Patterns in C# &amp; Java (2025 Guide) \u2013 With Code Examples, UML &amp; Best Practices<\/a><\/strong><br \/>\nUnderstand reusable software design patterns with UML diagrams and code snippets.<\/p>\n<p>\ud83d\udd39 <strong>\ud83d\ude80 <a href=\"https:\/\/www.wikitechy.com\/inheritance-in-java-2025-syntax-examples\/\" target=\"_blank\" rel=\"noopener\">Inheritance in Java (2025 Guide): Types, Syntax, Examples &amp; Multiple Inheritance Explained<\/a><\/strong><br \/>\nA must-read for anyone mastering Java OOP \u2014 includes visuals and advanced insights.<\/p>\n<p>\ud83d\udd39 <strong>\ud83c\udf0d <a href=\"https:\/\/www.kaashivinfotech.com\/blog\/where-is-java-used-in-2025\/\">Where is Java Used in 2025? (10 Real-World Java Programming Applications &amp; Java Platform Strengths)<\/a><\/strong><br \/>\nExplore how Java powers fintech, AI, web apps, and enterprise systems worldwide.<\/p>\n<p>\ud83d\udd39 <strong>\ud83d\udd25 <a href=\"https:\/\/www.kaashivinfotech.com\/blog\/10-best-java-frameworks-in-2025-for-web-backend-developers\/\">10 Best Java Frameworks in 2025 (For Web &amp; Backend Developers)<\/a><\/strong><br \/>\nFind the top frameworks every Java developer should know \u2014 from Spring Boot to Micronaut.<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you\u2019ve ever needed to store data as key\u2013value pairs, you\u2019ve already brushed against one of the most powerful concepts in Java \u2014 the Map interface. Think of it like a mini database inside your program \u2014 where each key is unique, and every key points to exactly one value. Simple, right? Yet it\u2019s a [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":17398,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3356,3203],"tags":[10050,10046,10049,10052,7497,10055,9745,8622,781,10044,10051,1604,8329,10054,10056,10047,10042,10043,10053,10048,10045],"class_list":["post-17391","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","category-programming","tag-concurrenthashmap","tag-hashmap","tag-hashtable","tag-iterate-map-in-java","tag-java-collections-framework","tag-java-data-structures","tag-java-developer-guide","tag-java-examples","tag-java-interview-questions","tag-java-map","tag-java-map-methods","tag-java-programming","tag-java-tutorial","tag-key-value-pair-java","tag-learn-java-2025","tag-linkedhashmap","tag-map-in-java","tag-map-interface-in-java","tag-sorted-map-in-java","tag-treemap","tag-what-is-map-in-java"],"_links":{"self":[{"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/posts\/17391","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/comments?post=17391"}],"version-history":[{"count":0,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/posts\/17391\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/media\/17398"}],"wp:attachment":[{"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/media?parent=17391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/categories?post=17391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/tags?post=17391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}