Examples of using range or a list in a switch statement

This are two examples of using ranges in switch statements.

(more…)

List the methods of a groovy class

This snippet show how to get a list of all methods in a groovy class.
(more…)

The inject method of list

The inject method of the list can be used for summing up the list contents.
(more…)

Filename filter

This shows the usage of the Java FilenameFilter with groovy.
(more…)

List filesystem roots

This shows how to use the function in groovy.
(more…)

List directory contents

This lists all files in a directory.
(more…)

Get all files of a specific type

This snippet shows howto get all *.txt files under the “test” directory.
(more…)

List files recursively

This shows how to list all files and directories under the current directory.
(more…)

List all subdirectories

Howto list all subdirectories under the current directory.
(more…)

List directories recursively

The following groovy snippet lists all subdirectories of the current directory.
(more…)