{"id":26347,"date":"2015-08-27T15:00:43","date_gmt":"2015-08-27T12:00:43","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=26347"},"modified":"2019-03-29T14:33:11","modified_gmt":"2019-03-29T12:33:11","slug":"groovy-map-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/","title":{"rendered":"Groovy Map Example"},"content":{"rendered":"<p>In this tutorial, I will show you how to evaluate the power of Groovy maps. You will provided codes for each case and I assume that you have a little bit back ground about groovy. Let&#8217;s have a look at map concepts in groovy step by step together.<\/p>\n<h2>1. Map&nbsp;Declaration<\/h2>\n<p>Maps are generally used for storing key-value pairs in programming languages. You have two options to declare a map in groovy. First option is, define an empty map and put key-value pairs after. Second option is declaring map with default values. You will understand it better if you have a look at example below.<br \/>\n&nbsp;<\/p>\n<p>&nbsp;<br \/>\n<span style=\"text-decoration: underline\"><em>GroovyMapDeclaration.groovy<\/em><\/span><\/p>\n<pre class=\"brush:groovy\">package com.javacodegeeks.groovy.map\n\nimport groovy.transform.ToString\n\nclass GroovyMapDeclaration {\n\n\tstatic main(args) {\n\t\tdef emptyStudentMap = [:]\n\t\tprintln emptyStudentMap \/\/ [:]\n\t\t\n\t\tdef studentMapWithInitialValue = [name: \"John\", surname: \"Doe\", age: 17]\n\t\tprintln studentMapWithInitialValue \/\/ [name:John, surname:Doe, age:17]\n\t}\n}\n<\/pre>\n<p>Be careful about the colon inside the map declaration. It states that this is a map not a list. You can see that keys are not inside quotes. However, they are all String by default. As you can see, map declaration is very easy stuff, let&#8217;s add some values to this map.<\/p>\n<h2>2. Map&nbsp;Add Values<\/h2>\n<p>You can manipulate groovy maps in several map. When you look at the following examples of adding items to the map,<\/p>\n<p><span style=\"text-decoration: underline\"><em>GroovyMapAddValues.groovy<\/em><\/span><\/p>\n<pre class=\"brush:groovy\">package com.javacodegeeks.groovy.map\n\nimport groovy.transform.ToString\n\nclass GroovyMapAddValues {\n\n\tstatic main(args) {\n\t\tdef student = [:] \/\/ Initialize empty map\n\t\tstudent.put('name', 'John') \/\/ java notation\n\t\tstudent['surname'] = 'Doe' \/\/ You can state key in square brackets\n\t\tstudent &lt;&lt; [age: 17] \/\/ This is something output redirection in unix commands. key-value pair put inside map object\n\t\tstudent.class = \"11C\" \/\/ Dot notation is also available\n\t\tstudent.'school' = \"Groovy School\" \/\/ Same as previous\n\t\t\n\t\tprintln student \/\/ [name:John, surname:Doe, age:17, class:11C, school:Groovy School]\n\t}\n}\n<\/pre>\n<p>Above example is for adding values to map, but you can use that commands for updating operation also. For example, if you want to update the age of student, you can use following.<\/p>\n<pre class=\"brush:groovy\">student['age'] = 17 \n<\/pre>\n<h2>3. Remove From Map<\/h2>\n<p>Removing element from maps is very easy as adding values. In order to remove values from map, you can use different kind of ways. Let&#8217;s have a look at following example.<\/p>\n<p><span style=\"text-decoration: underline\"><em>GroovyMapRemove.groovy<\/em><\/span><\/p>\n<pre class=\"brush:groovy\">package com.javacodegeeks.groovy.map\n\nimport groovy.transform.ToString\n\nclass GroovyMapRemove {\n\n\tstatic main(args) {\n\t\tdef student = [name: 'John', surname: 'Doe', age: 17, class: '11C', school: 'Groovy School']\n\t\tprintln student \/\/ [name:John, surname:Doe, age:17, class:11C, school:Groovy School]\n\t\t\n\t\tstudent.remove('age') \/\/ Remove by key\n\t\tprintln student \/\/ [name:John, surname:Doe, class:11C, school:Groovy School]\n\t\t\n\t\tstudent = student - [school: 'Groovy School'] \/\/ This is something like arithmetic operation \n\t\tprintln student \/\/ [name:John, surname:Doe, class:11C]\n\t}\n}\n<\/pre>\n<p>As in the example above, you cna remove elements from map by key or you can simply remove key-value pairs from map with a simple arithmetic like operation. In our case we are substracting <code>[school: 'Groovy School']<\/code> and resulting map will be following.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"brush:groovy\">[name: 'John', surname: 'Doe', class: '11C'] \/\/ We have removed 'age' and 'school' attribute\n<\/pre>\n<h2>4. Map Get Default Value<\/h2>\n<p>Sometimes, we need to call some function through an object fetched from map. If the fetched value is <code>null<\/code> we get <code>NullPointerException<\/code>. To avoid from getting this exception, we check the returned value from map. What if we get a default value instead of <code>null<\/code>? Groovy enables you provide default value in case of <code>null<\/code> value fetched from map. You can see following example for easy understanding.<\/p>\n<p><span style=\"text-decoration: underline\"><em>GroovyMapGetWithDefaultValue.groovy<\/em><\/span><\/p>\n<pre class=\"brush:groovy\">package com.javacodegeeks.groovy.map\n\nimport groovy.transform.ToString\n\nclass GroovyMapGetWithDefaultValue {\n\n\tstatic main(args) {\n\t\tdef student = [name: 'John', surname: 'Doe', age: 17, class: '11C', school: 'Groovy School']\n\t\tdef result = student.get('teacher', new Teacher(name: \"Betty\"))\n\t\t\n\t\tprintln result \/\/ com.javacodegeeks.groovy.map.Teacher(name:Betty)\n\t}\n}\n<\/pre>\n<p>In above example, if <code>student<\/code> has not a <code>teacher<\/code>, it will return <code>new Teacher()<\/code> object, so you can continue your work without thinking about <code>NullPointerException<\/code> stuff.<\/p>\n<h2>5. Map Union<\/h2>\n<p>Let say that, you have different kind of information of the student like below.<\/p>\n<p><span style=\"text-decoration: underline\"><em>GroovyMapUnion.groovy<\/em><\/span><\/p>\n<pre class=\"brush:groovy\">package com.javacodegeeks.groovy.map\n\nimport groovy.transform.ToString\n\nclass GroovyMapUnion {\n\n\tstatic main(args) {\n\t\tdef studentProp1 = [name: 'John', surname: 'Doe']\n\t\tdef studentProp2 = [age: 17, class: '11C']\n\t\tdef studentProp3 = [school: 'Groovy School']\n\t\tdef student = studentProp1 + studentProp2 + studentProp3\n\t\t\n\t\tprintln student \/\/ [name:John, surname:Doe, age:17, class:11C, school:Groovy School]\n\t}\n}\n<\/pre>\n<p>As you can see above, If you need to combine those informations into one variable, you can use following.<\/p>\n<pre class=\"brush:groovy\">def student = studentProp1 + studentProp2 + studentProp3\n<\/pre>\n<p>And resulting map will be like below.<\/p>\n<pre class=\"brush:groovy\">[name: 'John', surname: 'Doe', age: 17, class: '11C', school: 'Groovy School']\n<\/pre>\n<h2>6. Map Intersect<\/h2>\n<p>Sometimes, you need to find same properties within different maps. For example, you may want to see two students for determining the same properties like below.<\/p>\n<p><span style=\"text-decoration: underline\"><em>GroovyMapIntersect.groovy<\/em><\/span><\/p>\n<pre class=\"brush:groovy\">package com.javacodegeeks.groovy.map\n\nimport groovy.transform.ToString\n\nclass GroovyMapIntersect {\n\t\n\tstatic main(args) {\n\t\tdef student1 = [name: 'John', surname: 'Doe', age: 17]\n\t\tdef student2 = [surname: 'Bunny', age: 17]\n\t\tdef sameProperties = student1.intersect(student2) \/\/ [age: 17]\n\t\t\n\t\tprintln sameProperties \/\/ [age:17]\n\t}\n}\n<\/pre>\n<p>When you intersect two maps like above, the same key-value pairse will be fetched from two maps. Both students have <code>surname<\/code>, and <code>age<\/code> attributes, but only <code>age<\/code> attribute will exist in the result because their surnames are different[ulp id=&#8217;kHqyxwGNoyzYAfPN&#8217;]<\/p>\n<h2>7. Map Keys and Values<\/h2>\n<p>Let say that, you need to know which properties a student have. You can do that with following.<\/p>\n<p><span style=\"text-decoration: underline\"><em>GroovyMapKeys.groovy<\/em><\/span><\/p>\n<pre class=\"brush:groovy\">package com.javacodegeeks.groovy.map\n\nimport groovy.transform.ToString\n\nclass GroovyMapKeys {\n\n\tstatic main(args) {\n\t\tdef student = [name: 'John', surname: 'Doe', age: 17]\n        def studentKeys = student.keySet() \/\/ [name, surname, age]\n\t\t\n\t\tprintln studentKeys \/\/ [name, surname, age]\n\t}\n}\n<\/pre>\n<p>In same way, you may want to know about which values a student has. In that case, you can use below.<\/p>\n<p><span style=\"text-decoration: underline\"><em>GroovyMapValues.groovy<\/em><\/span><\/p>\n<pre class=\"brush:groovy\">package com.javacodegeeks.groovy.map\n\nimport groovy.transform.ToString\n\nclass GroovyMapValues {\n\n\tstatic main(args) {\n\t\tdef student = [name: 'John', surname: 'Doe', age: 17]\n\t\tdef studentValues = student.values() \/\/ [John, Doe, 17]\n\t\t\n\t\tprintln studentValues \/\/ [John, Doe, 17]\n\t}\n}\n<\/pre>\n<p>In order to see overall picture, you can have a look at combined version of the codes for map operations.<\/p>\n<p><span style=\"text-decoration: underline\"><em>GroovyMaps.groovy<\/em><\/span><\/p>\n<pre class=\"brush:groovy\">package com.javacodegeeks.groovy.map\n\nimport groovy.transform.ToString\n\nclass GroovyMaps {\n\n\tstatic main(args) {\n\t\t\/\/ Add values to map\n\t\tdef student1 = [:] \/\/ Initialize empty map\n\t\tstudent1.put('name', 'John') \/\/ java notation\n\t\tstudent1['surname'] = 'Doe' \/\/ You can state key in square brackets\n\t\tstudent1 &lt;&lt; [age: 17] \/\/ This is something output redirection in unix commands. key-value pair put inside map object\n\t\tstudent1.class = \"11C\" \/\/ Dot notation is also available\n\t\tstudent1.'school' = \"Groovy School\" \/\/ Same as previous\n\t\t\n\t\tprintln \"Student 1 info: ${student1}\" \/\/ Student info: [name:John, surname:Doe, age:17, class:11C, school:Groovy School]\n\t\t\n\t\t\/\/ Remove element from map\n\t\tdef student2 = [name: 'John', surname: 'Doe', age: 17, class: '11C', school: 'Groovy School']\n\t\tstudent2.remove('age') \/\/ Remove by key\n\t\tstudent2 = student2 - [school: 'Groovy School'] \/\/ This is something like arithmetic operation\n\t\t\n\t\tprintln \"Student 2 info: ${student2}\" \/\/ Student 2 info: [name:John, surname:Doe, class:11C]\n\t\t\n\t\t\/\/ Get default value\n\t\tdef student3 = [name: 'John', surname: 'Doe', age: 17, class: '11C', school: 'Groovy School']\n\t\tdef student3Teacher = student3.get('teacher', new Teacher(name: \"Betty\"))\n\t\t\n\t\tprintln \"Student 3 teacher info: ${student3Teacher}\" \/\/ Student 3 teacher info: com.javacodegeeks.groovy.map.Teacher(name:Betty)\n\t\t\n\t\t\/\/ Map union\n\t\tdef studentProp1 = [name: 'John', surname: 'Doe']\n\t\tdef studentProp2 = [age: 17, class: '11C']\n\t\tdef studentProp3 = [school: 'Groovy School']\n\t\tdef student4 = studentProp1 + studentProp2 + studentProp3\n\t\t\n\t\tprintln \"Student 4 ingo: ${student4}\" \/\/ Student 4 ingo: [name:John, surname:Doe, age:17, class:11C, school:Groovy School]\n\t\t\n\t\t\/\/ Map intersect\n\t\tdef student5 = [name: 'John', surname: 'Doe', age: 17]\n\t\tdef student6 = [surname: 'Bunny', age: 17]\n\t\tdef sameProperties = student5.intersect(student6) \/\/ [age: 17]\n\t\t\n\t\tprintln \"Student 5 - Student 6 intersection: ${sameProperties}\" \/\/ Student 5 - Student 6 intersection: [age:17]\n\t\t\n\t\t\/\/ Map keys and values\n\t\tdef student7 = [name: 'John', surname: 'Doe', age: 17]\n\t\tdef student7KeyList = student7.keySet() \/\/ [name, surname, age]\n\t\t\n\t\tprintln \"Student 7 key set: ${student7KeyList}\" \/\/ Student 7 key set: [name, surname, age]\n\t\t\n\t\tdef student8 = [name: 'John', surname: 'Doe', age: 17]\n\t\tdef student8ValueList = student8.values() \/\/ [John, Doe, 17]\n\t\t\n\t\tprintln \"Student 8 value set: ${student8ValueList}\" \/\/ Student 8 value set: [John, Doe, 17]\n\t}\n\n}\n\n@ToString(includeNames=true, includeFields=true)\nclass Teacher {\n\tdef name\n}\n<\/pre>\n<h2>8. Conclusion<\/h2>\n<p>Groovy is very good language, because we are able to write and read codes like speaking or writing in English. It has dynamic usage when it comes to coding and this powerful property let us use Groovy maps very easily. Remember that, you need to do lots of practices about Groovy maps in order to get full control Groovy collections. You can try all the examples above online <a href=\"https:\/\/groovyconsole.appspot.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of the project here: <a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/08\/GroovyMapExample.zip\"><strong>GroovyMapExample<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, I will show you how to evaluate the power of Groovy maps. You will provided codes for each case and I assume that you have a little bit back ground about groovy. Let&#8217;s have a look at map concepts in groovy step by step together. 1. Map&nbsp;Declaration Maps are generally used for &hellip;<\/p>\n","protected":false},"author":56,"featured_media":24987,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1216],"tags":[400],"class_list":["post-26347","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-groovy","tag-map"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Groovy Map Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In this tutorial, I will show you how to evaluate the power of Groovy maps. You will provided codes for each case and I assume that you have a little bit\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Groovy Map Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, I will show you how to evaluate the power of Groovy maps. You will provided codes for each case and I assume that you have a little bit\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2015-08-27T12:00:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-29T12:33:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/groovy-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=\"Huseyin Babal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@huseyinbabal\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Huseyin Babal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/\"},\"author\":{\"name\":\"Huseyin Babal\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/a64b2fa737b82194b7dfc39117f4a237\"},\"headline\":\"Groovy Map Example\",\"datePublished\":\"2015-08-27T12:00:43+00:00\",\"dateModified\":\"2019-03-29T12:33:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/\"},\"wordCount\":657,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/groovy-logo.jpg\",\"keywords\":[\"Map\"],\"articleSection\":[\"Groovy\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/\",\"name\":\"Groovy Map Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/groovy-logo.jpg\",\"datePublished\":\"2015-08-27T12:00:43+00:00\",\"dateModified\":\"2019-03-29T12:33:11+00:00\",\"description\":\"In this tutorial, I will show you how to evaluate the power of Groovy maps. You will provided codes for each case and I assume that you have a little bit\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/groovy-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/groovy-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JVM Languages\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/jvm-languages\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Groovy\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/jvm-languages\/groovy\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Groovy Map Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/a64b2fa737b82194b7dfc39117f4a237\",\"name\":\"Huseyin Babal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/Huseyin-Babal-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/Huseyin-Babal-96x96.jpg\",\"caption\":\"Huseyin Babal\"},\"description\":\"Huseyin Babal has deep experience in Full Stack Development since 2007. He is mainly developing applications with JAVA, Spring, PHP, NodeJS, AngularJS. He is also interested in DevOps Engineering since 2013 and using AWS, Heroku for Cloud deployment and playing with Docker and Consul for implementing infinite scalable systems. He likes to share his experience in public conferences and perform advanced workshops about Full Stack Development and Devops. He is the author of NodeJS in Action course in Udemy.\",\"sameAs\":[\"http:\/\/huseyinbabal.net\",\"https:\/\/www.linkedin.com\/in\/huseyinbabal\",\"https:\/\/x.com\/huseyinbabal\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/huseyin-babal\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Groovy Map Example - Java Code Geeks","description":"In this tutorial, I will show you how to evaluate the power of Groovy maps. You will provided codes for each case and I assume that you have a little bit","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:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/","og_locale":"en_US","og_type":"article","og_title":"Groovy Map Example - Java Code Geeks","og_description":"In this tutorial, I will show you how to evaluate the power of Groovy maps. You will provided codes for each case and I assume that you have a little bit","og_url":"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2015-08-27T12:00:43+00:00","article_modified_time":"2019-03-29T12:33:11+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/groovy-logo.jpg","type":"image\/jpeg"}],"author":"Huseyin Babal","twitter_card":"summary_large_image","twitter_creator":"@huseyinbabal","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Huseyin Babal","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/"},"author":{"name":"Huseyin Babal","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/a64b2fa737b82194b7dfc39117f4a237"},"headline":"Groovy Map Example","datePublished":"2015-08-27T12:00:43+00:00","dateModified":"2019-03-29T12:33:11+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/"},"wordCount":657,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/groovy-logo.jpg","keywords":["Map"],"articleSection":["Groovy"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/","url":"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/","name":"Groovy Map Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/groovy-logo.jpg","datePublished":"2015-08-27T12:00:43+00:00","dateModified":"2019-03-29T12:33:11+00:00","description":"In this tutorial, I will show you how to evaluate the power of Groovy maps. You will provided codes for each case and I assume that you have a little bit","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/groovy-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/groovy-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/jvm-languages\/groovy\/groovy-map-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"JVM Languages","item":"https:\/\/examples.javacodegeeks.com\/category\/jvm-languages\/"},{"@type":"ListItem","position":3,"name":"Groovy","item":"https:\/\/examples.javacodegeeks.com\/category\/jvm-languages\/groovy\/"},{"@type":"ListItem","position":4,"name":"Groovy Map Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/a64b2fa737b82194b7dfc39117f4a237","name":"Huseyin Babal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/Huseyin-Babal-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/Huseyin-Babal-96x96.jpg","caption":"Huseyin Babal"},"description":"Huseyin Babal has deep experience in Full Stack Development since 2007. He is mainly developing applications with JAVA, Spring, PHP, NodeJS, AngularJS. He is also interested in DevOps Engineering since 2013 and using AWS, Heroku for Cloud deployment and playing with Docker and Consul for implementing infinite scalable systems. He likes to share his experience in public conferences and perform advanced workshops about Full Stack Development and Devops. He is the author of NodeJS in Action course in Udemy.","sameAs":["http:\/\/huseyinbabal.net","https:\/\/www.linkedin.com\/in\/huseyinbabal","https:\/\/x.com\/huseyinbabal"],"url":"https:\/\/examples.javacodegeeks.com\/author\/huseyin-babal\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/26347","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/56"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=26347"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/26347\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/24987"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=26347"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=26347"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=26347"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}