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 by applying closures to functions as parameter, caling anonymous code blocks inside functions, etc…. Let’s see closure in action with supporting examples.
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
The Hitchhiker’s Guide to Docker and Modulus
In this tutorial, we’re going to be taking a look a the history of containerization, Docker, its components, and how to get started using it in our day to day work. But before we dive too deeply into the tutorial, let’s take a look at what Docker is so that we gain an understand as to what it is with which we’ll be working.
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 way. Let’s have a look at how can we use Groovy date extension.
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 add item as much as you can after initialization of the list.
Build a Real-Time Chat Application With Modulus and Spring Boot
In this tutoral, we will use Spring Boot for the web development environment, Websockets for real-time communication, Tomcat for the Java application container, Gradle for building and managing the dependencies, Thymeleaf for template rendering, MongoDB for data storage, and finally there will be no XML for bean configurations. Just to make you inspired, at the end of this article, you will see a fully working application like the one shown below.
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 Groovy, you can use several ways to extract specific part of a given string. Let’s have a look at alternative ways to do some substring operations on strings
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 Groovy Console to run your scripts. Groovy Console is a Swing GUI for perform several operations to your Groovy scripts. You may want to use Groovy Console to write and run Groovy scripts instead of IDE or command line. Let’s see features together.
Build a Real-Time Chat Application With Modulus and Python
In this tutorial, I will show you how to implement a real-time chat application with Python and Flask, and then we will deploy this application to Modulus together.