A closure is an anonymous code block that can take arguments, return value, and also can be assigned to a variable. When it comes to Groovy, a closure can contain a variable scope defined outside of the closure expression. Groovy offers extended features to formal closure definition. By using this features, we can write our … Continue reading Groovy Closure Example
Tag: Jcg
Groovy Regex Example
Regular Expression is a character sequence defines search pattern especially for pattern matching with strings. You may see Regular Expression as Regex or Regexp in software world. In this tutorial, I will show you how to use regex operations in Groovy by using pretty easy methods.
Groovy Collect Example
Groovy collect() is used for iterate through collections to apply closure to each element. In this tutorial, we will see how to use collect() for collection operations. Let’s get started
Groovy Date Example
Date operations may be painful in most of the programming languages. You may spend most of your time to convert dates from one format to another one. In Groovy, date operations are very easy. Groovy has lots of functions extended from JDK Date API, this allows us to use date related operations in an easier … Continue reading Groovy Date Example
Groovy Array Example
In previous tutorials, we have mentioned about Groovy List and provided lots of examples. In this tutorial, I will show you how to use Groovy arrays. Even if array and list seems to be same, they have differences in common. For example, arrays have fixed size while lists have dynamic size that means you can … Continue reading Groovy Array Example
Groovy Substring Example
Sometimes, the provided text may not be suitable for our needs. Because of this, we use string manipulation functions to convert it to desired format or extract specific part of it. You can hear this operation as substringoperation in software development world. In this tutorial, I will show you how to apply substring operations on … Continue reading Groovy Substring Example
Groovy Console Example
In this tutorial, I will show you how to use Groovy Console to run your Groovy scripts and also give you some details about Groovy Console itself. Actually, there are several ways to run Groovy scripts. You can run it on your favourite IDE, you can run it from command line, or you can use … Continue reading Groovy Console Example
Groovy List Example
List is generally used as stack in software development world in order to push items in it for future use and to be able to fetch back in a desired way. In this tutorial, I will show you how to use Groovy list like a senior developer. I assume, you have already set up Groovy … Continue reading Groovy List Example
Groovy Map Example
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’s have a look at map concepts in groovy step by step together. 1. Map Declaration Maps are generally used … Continue reading Groovy Map Example
Spring Data MongoDB REST Example
In this tutorial, I will show you how to develop a RESTful web application by using Spring and MongoDB without implementing boring uniform controllers.