{"id":4554,"date":"2012-12-26T22:00:11","date_gmt":"2012-12-26T20:00:11","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=4554"},"modified":"2012-12-26T15:39:39","modified_gmt":"2012-12-26T13:39:39","slug":"google-guava-multisets","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2012\/12\/google-guava-multisets.html","title":{"rendered":"Google Guava Multisets"},"content":{"rendered":"<p>Continuing this tour of<a href=\"http:\/\/code.google.com\/p\/guava-libraries\/\"> Guava<\/a> we get to the<a href=\"http:\/\/docs.guava-libraries.googlecode.com\/git-history\/v9.0\/javadoc\/com\/google\/common\/collect\/Multiset.html\"> Multiset<\/a>. I probably don&#8217;t use this as much as Multimaps or Bimaps, but it certainly does have it&#8217;s uses.<\/p>\n<h2>So what&#8217;s a Multiset then?<\/h2>\n<p>Well as you might be able to guess it&#8217;s a set that can hold multiple instances of the same object.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n<h2>Isn&#8217;t that just a List?<\/h2>\n<p>In Java there are two basic differences between Lists and Sets. Lists can hold duplicates of the same object, and Lists are always ordered. Sets can&#8217;t hold duplicates, and there&#8217;s no guarantee of order by the Set interface. (Some implementations &#8211; LinkedHashSet, SortedSet etc. &#8211; do of course provide a guaranteed order!)<\/p>\n<p>So a Multiset occupies a sort of grey area between a List and a Set. Duplicates allowed, but no guaranteed order.<\/p>\n<p>This collection is also sometimes called a<strong> Bag<\/strong>, in fact this is what Apache Commons Collections calls it&#8217;s Mutlisets.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h2>So what would I use one for?<\/h2>\n<p>The great thing about Multisets is they keep track of the counts of each particular object in the set. So you can use them for counting stuff. Have you ever written code like the following:<\/p>\n<pre class=\"brush:java\">Map&lt;MyClass,Integer&gt; objectCounts = new HashMap&lt;MyClass,Integer&gt;();\r\n\r\npublic void incrementCount(MyClass obj) {\r\n    Integer count = objectCounts.get(obj);\r\n    if (count == null) {\r\n        objectCounts.put(obj,0);\r\n    } else {\r\n        objectCounts.put(obj,count++);\r\n    }\r\n}\r\n\r\npublic int getCount(MyClass obj) {\r\n    Integer count = objectCounts.get(obj);\r\n    if (count == null) {\r\n        return 0;\r\n    } else {\r\n        return count;\r\n    }\r\n}<\/pre>\n<p>Bit unwieldy? Lets see how we might use a Multiset instead:<\/p>\n<pre class=\"brush:java\">Multiset&lt;MyClass&gt; myMultiset = HashMultiset.create();\r\n\r\nMyClass myObject = new MyClass();\r\n\r\nmyMultiset.add(myObject);\r\nmyMultiset.add(myObject);  \/\/ add it a second time.\r\n\r\nSystem.out.println(myMultiset.count(myObject)); \/\/ 2\r\n\r\nmyMultiset.remove(myObject);\r\nSystem.out.println(myMultiset.count(myObject)); \/\/ 1<\/pre>\n<p>As you can see that&#8217;s much simpler! It&#8217;s even possible to add\/remove more than one object at at time<\/p>\n<pre class=\"brush:java\">Multiset&lt;MyClass&gt; myMultiset = HashMultiset.create();\r\n\r\nMyClass myObject = new MyClass();\r\nmyMultiset.add(myObject,5); \/\/ Add 5 copies of myObject\r\n\r\nSystem.out.println(myMultiset.count(myObject)); \/\/ 5\r\n\r\nmyMultiset.remove(myObject,2); \/\/ remove 2 copies\r\n\r\nSystem.out.println(myMultiset.count(myObject)); \/\/ 3<\/pre>\n<p>Pretty useful eh? As usual there&#8217;s several implementations available depending on your requirements, and I recommend taking a look at the API: <a href=\"http:\/\/docs.guava-libraries.googlecode.com\/git-history\/v9.0\/javadoc\/com\/google\/common\/collect\/Multiset.html#count%28java.lang.Object%29\">http:\/\/docs.guava-libraries.googlecode.com\/git-history\/v9.0\/javadoc\/com\/google\/common\/collect\/Multiset.html<\/a><br \/>\n&nbsp;<\/p>\n<p><strong><em>Reference: <\/em><\/strong><a href=\"http:\/\/tomjefferys.blogspot.com\/2011\/09\/multisets.html\">Google Guava Multisets<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/p\/jcg.html\">JCG partner<\/a> Tom Jefferys at the <a href=\"http:\/\/tomjefferys.blogspot.com\/\">Tom&#8217;s Programming Blog <\/a> blog.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Continuing this tour of Guava we get to the Multiset. I probably don&#8217;t use this as much as Multimaps or Bimaps, but it certainly does have it&#8217;s uses. So what&#8217;s a Multiset then? Well as you might be able to guess it&#8217;s a set that can hold multiple instances of the same object. &nbsp; &nbsp; &hellip;<\/p>\n","protected":false},"author":155,"featured_media":112,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[280],"class_list":["post-4554","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-google-guava"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Google Guava Multisets<\/title>\n<meta name=\"description\" content=\"Continuing this tour of Guava we get to the Multiset. I probably don&#039;t use this as much as Multimaps or Bimaps, but it certainly does have it&#039;s uses. So\" \/>\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.javacodegeeks.com\/2012\/12\/google-guava-multisets.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Google Guava Multisets\" \/>\n<meta property=\"og:description\" content=\"Continuing this tour of Guava we get to the Multiset. I probably don&#039;t use this as much as Multimaps or Bimaps, but it certainly does have it&#039;s uses. So\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2012\/12\/google-guava-multisets.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2012-12-26T20:00:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Tom Jefferys\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tom Jefferys\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/google-guava-multisets.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/google-guava-multisets.html\"},\"author\":{\"name\":\"Tom Jefferys\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/673556f9698e4cc973c6b2a033d526d9\"},\"headline\":\"Google Guava Multisets\",\"datePublished\":\"2012-12-26T20:00:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/google-guava-multisets.html\"},\"wordCount\":295,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/google-guava-multisets.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"keywords\":[\"Google Guava\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/google-guava-multisets.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/google-guava-multisets.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/google-guava-multisets.html\",\"name\":\"Google Guava Multisets\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/google-guava-multisets.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/google-guava-multisets.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"datePublished\":\"2012-12-26T20:00:11+00:00\",\"description\":\"Continuing this tour of Guava we get to the Multiset. I probably don't use this as much as Multimaps or Bimaps, but it certainly does have it's uses. So\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/google-guava-multisets.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/google-guava-multisets.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/google-guava-multisets.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"java-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/google-guava-multisets.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Google Guava Multisets\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/673556f9698e4cc973c6b2a033d526d9\",\"name\":\"Tom Jefferys\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c18533c5fb898db45609a696474327815eb2fc647e934d3a87d87f0a7002173?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c18533c5fb898db45609a696474327815eb2fc647e934d3a87d87f0a7002173?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c18533c5fb898db45609a696474327815eb2fc647e934d3a87d87f0a7002173?s=96&d=mm&r=g\",\"caption\":\"Tom Jefferys\"},\"sameAs\":[\"http:\\\/\\\/tomjefferys.blogspot.com\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Tom-Jefferys\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Google Guava Multisets","description":"Continuing this tour of Guava we get to the Multiset. I probably don't use this as much as Multimaps or Bimaps, but it certainly does have it's uses. So","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.javacodegeeks.com\/2012\/12\/google-guava-multisets.html","og_locale":"en_US","og_type":"article","og_title":"Google Guava Multisets","og_description":"Continuing this tour of Guava we get to the Multiset. I probably don't use this as much as Multimaps or Bimaps, but it certainly does have it's uses. So","og_url":"https:\/\/www.javacodegeeks.com\/2012\/12\/google-guava-multisets.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2012-12-26T20:00:11+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","type":"image\/jpeg"}],"author":"Tom Jefferys","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Tom Jefferys","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/google-guava-multisets.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/google-guava-multisets.html"},"author":{"name":"Tom Jefferys","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/673556f9698e4cc973c6b2a033d526d9"},"headline":"Google Guava Multisets","datePublished":"2012-12-26T20:00:11+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/google-guava-multisets.html"},"wordCount":295,"commentCount":2,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/google-guava-multisets.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","keywords":["Google Guava"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2012\/12\/google-guava-multisets.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/google-guava-multisets.html","url":"https:\/\/www.javacodegeeks.com\/2012\/12\/google-guava-multisets.html","name":"Google Guava Multisets","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/google-guava-multisets.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/google-guava-multisets.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","datePublished":"2012-12-26T20:00:11+00:00","description":"Continuing this tour of Guava we get to the Multiset. I probably don't use this as much as Multimaps or Bimaps, but it certainly does have it's uses. So","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/google-guava-multisets.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2012\/12\/google-guava-multisets.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/google-guava-multisets.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","width":150,"height":150,"caption":"java-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/google-guava-multisets.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Google Guava Multisets"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/673556f9698e4cc973c6b2a033d526d9","name":"Tom Jefferys","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/5c18533c5fb898db45609a696474327815eb2fc647e934d3a87d87f0a7002173?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5c18533c5fb898db45609a696474327815eb2fc647e934d3a87d87f0a7002173?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5c18533c5fb898db45609a696474327815eb2fc647e934d3a87d87f0a7002173?s=96&d=mm&r=g","caption":"Tom Jefferys"},"sameAs":["http:\/\/tomjefferys.blogspot.com\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/Tom-Jefferys"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/4554","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/155"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=4554"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/4554\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/112"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=4554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=4554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=4554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}