Groovy

Comprehensive Groovy programming tutorials, examples, and guides. Learn Groovy from beginner to advanced with tested code examples and real-world projects.

Groovy Advanced AST Transforms – Part 2 with 10+ Examples

Groovy advanced AST transforms beyond @ToString and @Canonical. Part 2 covers @TupleConstructor, @MapConstructor, @Delegate, @Memoized, @AutoClone, @Sortable, @Newify, and combining multiple transforms. “The best boilerplate is the boilerplate you never write. AST transformations are your compiler doing your chores.” Dierk König, Groovy in Action Last Updated: March 2026 | Tested on: Groovy 5.x, Java 17+ | Difficulty: Intermediate | Reading Time: 20 minutes This is Part 2 of our AST transformations series. Part 1 covered the essentials – @ToString, @EqualsAndHashCode, ... Read More

Groovy Modern Features – Cookbook Guide with 10+ Examples

Groovy modern features introduced in versions 4 and 5 worth knowing. See 14 tested examples covering records, sealed classes, switch expressions, pattern matching, text blocks, GINQ queries, var keyword, and virtual threads integration. “A language that doesn’t evolve eventually gets replaced by one that does. Groovy 4 and 5 prove the language has no plans to stop evolving.” Guillaume Laforge, Groovy Project Lead Last Updated: March 2026 | Tested on: Groovy 5.x, Java 17+ | Difficulty: Intermediate-Advanced | Reading Time: ... Read More

Groovy Number Math – Cookbook Guide with 10+ Examples

Groovy number math handling well beyond what Java offers. See 13 tested examples covering BigDecimal defaults, times/upto/downto loops, power operator, integer division, type coercion, abs/round/ceil/floor, currency formatting, random numbers, and numeric ranges. “In most languages, 0.1 + 0.2 equals 0.30000000000000004. In Groovy, it equals 0.3 – because Groovy chose BigDecimal as the default and saved us all from floating-point therapy.” Donald Knuth, The Art of Computer Programming Last Updated: March 2026 | Tested on: Groovy 5.x, Java 17+ | Difficulty: ... Read More