Download |
Documentation |
Developers |
Community |
API |
Getting Started guide |
SearchGroovy |
Groovy is a dynamically compiled object oriented language for the Java Virtual Machine (JVM).
Groovy features differentiating the language from Java 6 and earlier include:
Groovy as a dynamic language
A Groovy script is fully parsed, compiled, and generated before execution. The process occurs under the hood, and the compiled version is not saved as an artifact of the process.
Maps
A map is used to store "associative arrays" or "dictionaries", an unordered collection of heterogeneous, named data.
For example, we want to store names and IQ scores:
scores = [ "Brett":100, "Pete":"Did not finish", "Andrew":86.87934 ]
Note that each of the values stored in the map is of a different type. Brett's is an integer, Pete's is a string, and Andrew's is a floating point number. We can access the values in a map in two main ways:
println scores["Pete"]
println scores.Pete