functional-programming

Functional programming techniques: closures, higher-order functions, composition, currying, and method references, with tested examples.

Groovy Curry and Partial Application – Complete Guide with 10 Examples

Every Jenkins pipeline has a logging closure that takes a level, a tag, and a message, and every single call passes the same first two arguments. Groovy curry exists for exactly that itch: pre-fill some parameters of a closure and get back a leaner one. This guide covers curry(), rcurry(), and ncurry() with 10 tested examples on Groovy 5.0.6. “Currying is the art of asking for less — turning a function that needs three ingredients into one that already has ... Read More

Groovy Higher-Order Functions – collect, inject, groupBy with 10 Examples

Half the Groovy that shows up in code reviews is a loop that builds a list by hand. Groovy collect replaces that whole pattern with one line, inject folds a collection down to a single value, and groupBy partitions data for reports. This guide works through those higher-order functions, plus collectEntries and collectMany, with tested output on Groovy 5.0.6. “Give me a collection and a closure, and I will give you back a transformed world.” Last Updated: July 2026 | ... Read More

15 Essential Groovy Closure Examples – The Complete Guide

Groovy closures are one of the language’s most useful features. See 15 practical examples covering syntax, parameters, delegate, composition, and real-world patterns. Tested on Groovy 5.0.6. “Closures are the Swiss Army knife of Groovy. Once you understand them, every other feature clicks into place.” Last Updated: July 2026 | Tested on: Groovy 5.0.6, Java 17+ | Difficulty: Intermediate | Reading Time: 22 minutes If there’s one feature that defines Groovy’s personality, it’s closures. They show up everywhere — in loops, ... Read More