Home » JVM Languages » Groovy (page 2)

Groovy

Groovy String Example

1. Introduction String related manipulations have been always important in almost all programming languages. If you are using Groovy, you will do String manipulation in an easy way. In other words, it is very easy to split, add, manipulate, initialize, escape Strings in Groovy. In this tutorial I will show you how to use Groovy String efficiently.       ...

Read More »

Groovy Closure Example

1. Introduction 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 code more dynamically ...

Read More »

Groovy Regex Example

1. Introduction 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.             2. Quick Start In Groovy, you ...

Read More »

Groovy Collect Example

1. Introduction 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 2. Collect When you have a look at the method signatures of collect below, we will see that collect can be executed with default closure which is Closure.IDENTITY, ...

Read More »

Groovy Date Example

1. Introduction 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 way. Let’s have ...

Read More »

Groovy Array Example

Table Of Contents 1. Introduction 2. Array Declaration 3. Access Array Items 4. Add Item Exception 5. Array Length 6. Array Min & Max Value 7. Remove Item 8. Array Ordering 9. Array Lookup 10. Conversion 11. Conclusion 1. Introduction In previous tutorials, we have mentioned about Groovy List and provided lots of examples. In this tutorial, I will show ...

Read More »

Grails tutorial for beginners

Grails is an open source framework based on Groovy and Java. It also supports MVC architecture to for developing web application. This tutorial will describe more details about Grails and represent a simple web application with Grails. 1.Groovy Groovy is a dynamic object-oriented programming language for the Java platform. It is compiled to Java Virtual Machine (JVM) byte code and integrates with all ...

Read More »

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 substring operation in software development world. In this tutorial, I will show you how to apply substring operations on a given string. In ...

Read More »

Groovy Console Example

1. Introduction 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 Groovy Console to ...

Read More »

Groovy List Example

Table Of Contents 1. Introduction 2. List Declaration 3. Add Items 4. Remove Items 5. Item Lookup 6. Split List 7. Count 8. Apply 9. Conclusion 1. Introduction 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 ...

Read More »