Groovy Cookbook

Groovy programming language tutorials and howtos.

These 10 New Features Make Groovy 4.0 AWESOME!

Sealed types, switch expressions, and record types. Here are just a few new features introduced in the latest Groovy 4.0 release. In this video, I want to show you ten things that make Groovy 4.0 amazing. And to keep this video short, we’re not going to dive deep into each of them. Instead, I intend to give you a quick overview of the new features.

Groovy: split string and avoid getting IndexOutOfBoundsException

If you use Groovy for scripting or other similar tasks you probably faced a situation where you get an input as a text and you need to process it e.g. split by some delimiter and continue working with extracted values. In this post I will show you how to do it in 3 different ways.

Groovy script: closure does not modify @Field annotated variable

Recently I have answered a few questions on Stack Overflow related to Groovy scripts and how they work in combination with closures and delegated objects. Some of use cases may not be intuitive and today I’m gonna show you one of them and explain what happens under the hood.

Why "grails package" executes Config.groovy file?

This blog post is inspired by one of my recent Stack Overflow answers to following question: Grails: why is the Config.groovy file executed during compilation?. Here I’m going to show you step by step what makes grails package command executing Config.groovy script and how I’ve managed to find the answer to that question.

Related YouTube videos