{"id":4474,"date":"2011-11-10T23:46:26","date_gmt":"2011-11-10T18:16:26","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=4474"},"modified":"2014-12-17T09:15:51","modified_gmt":"2014-12-17T03:45:51","slug":"groovy-find-index-of-element-in-map","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/groovy-find-index-of-element-in-map\/","title":{"rendered":"Groovy : Find Index of Element in Map"},"content":{"rendered":"<p>Groovier way of finding index of element from Map. It can be obtained with findIndexOf Method, which accepts closure as argument.<\/p>\n<p>[groovy]<\/p>\n<p>Map\u00a0map=[&quot;groovy&quot;:1,&quot;grails&quot;:2,&quot;index&quot;:3,&quot;element&quot;:4]<br \/>\nassert\u00a03\u00a0==\u00a0map.findIndexOf{it.key==&quot;element&quot;}<br \/>\nassert 0 ==\u00a0map.findIndexOf{it.value==1}<\/p>\n<p>[\/groovy]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Groovier way of finding index of element from Map. It can be obtained with findIndexOf Method, which accepts closure as argument. [groovy] Map\u00a0map=[&quot;groovy&quot;:1,&quot;grails&quot;:2,&quot;index&quot;:3,&quot;element&quot;:4] assert\u00a03\u00a0==\u00a0map.findIndexOf{it.key==&quot;element&quot;} assert 0 ==\u00a0map.findIndexOf{it.value==1} [\/groovy]<\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":94},"categories":[1174],"tags":[4840,9,669,458],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/4474"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=4474"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/4474\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=4474"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=4474"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=4474"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}