concept action in category groovy

appears as: ction, action, n action, ctions
Groovy in Action, Second Edition

This is an excerpt from Manning's book Groovy in Action, Second Edition.

This is type inference in action and it controls how code completion works in the trailing code and even how method calls on keys and values of that map are known to be of type String. As an example, in line.contains(key) the key must be a String, and because IntelliJ infers that it is, there’s no warning marker.

Figure 3.1. Autoboxing in action: an Integer parameter is unboxed to an int for the Java method call, and an int return value is boxed into an Integer for use in Groovy.

The notation that Groovy uses to set its collective datatypes into action will be new to Java programmers, but as you’ll see, it’s easy to understand and remember. You’ll pick it up so quickly that you’ll hardly be able to imagine a time when you were new to the concept.

Listing 6.3. The if statement in action
if (true) assert true else assert false if (1) { assert true } else { assert false } if ('nonempty') assert true else if (['x']) assert false else assert false if (0) assert false else if ([]) assert false else assert true