Explore tens of thousands of sets crafted by our community.
Groovy Language Features
30
Flashcards
0/30
Closures
A closure in Groovy is an anonymous chunk of code that can take arguments, return a value and be assigned to a variable.
Dynamic Typing
Groovy is a dynamically typed language, which means variable types are checked at runtime and you do not need to specify them at compile time.
GDK (Groovy Development Kit)
A set of utility functionalities that extend the Java SDK to make it more powerful and easy to work with. These include methods added to standard Java classes.
Operator Overloading
Groovy allows you to overload the standard Java operators, so you can define how operators like + or * should work with your objects.
Default Parameters
Methods in Groovy can define default values for parameters, simplifying method overloading.
String Interpolation
Groovy provides easy syntax to embed expressions within strings using the dollar sign (
Multiline Strings
Groovy supports strings that span multiple lines, which are declared with three double quotes or three single quotes.
Safe Navigation Operator
The safe navigation operator (?.) protects against NullPointerException by safely returning null if an intermediate property or method is null.
Elvis Operator
The Elvis operator (?:) returns the not-null operand or an alternative if the first operand is null.
GStrings
GStrings are Groovy's version of String that supports interpolation.
Range Operator
Groovy includes a range operator '..' to create ranges of numbers or characters.
Spread Operator
The spread operator (*) is used to apply an expression over all elements of a collection.
Collection Literals
Groovy has syntax for list, map and set literals, allowing for shorter and cleaner initialization.
Traits
Traits in Groovy are reusable components that can be added to classes to inherit behavior and state.
Meta-programming
Groovy's meta-programming capabilities allow changing the behavior of classes at runtime.
Grape
Grape is a dependency management and auto-downloading tool integrated in Groovy.
Method Pointers
Method pointers in Groovy allow referencing a method as a first-class object using the `&` operator.
Groovy Shell
Groovy Shell is an interactive environment for writing and executing Groovy scripts.
Groovy Console
Groovy Console is a graphical user interface application for writing and evaluating Groovy scripts.
Groovy Categories
Groovy categories provide a way to add methods to classes temporarily during runtime.
Groovy SQL
Groovy SQL is a library that simplifies database access with a more intuitive syntax.
Groovy Markup
Groovy introduces a markup and builder syntax allowing the creation of structured data formats such as XML or HTML in a programmatic way.
GroovyObject
Every Groovy class implements the GroovyObject interface, which provides methods that are typically part of Groovy's dynamic nature.
Compile Static Annotation
@CompileStatic is an annotation that enables static compilation for annotated Groovy code, for performance close to Java's.
AST Transformations
AST (Abstract Syntax Tree) Transformations allow modification of the code structure before it is compiled, enabling powerful customizations.
Declarative Programming with Builders
Groovy's builders allow for declarative programming styles and can easily construct complex hierarchies such as UI components, JSON or XML.
Mixins
Mixins in Groovy allow a class to add the functionality of another class, effectively 'mixing in' methods and properties.
Lazy Evaluation
Groovy supports lazy evaluation to defer a computation until its value is needed, which can improve performance in some scenarios.
Native Syntax for Lists and Maps
Groovy provides a concise and developer-friendly syntax for creating and manipulating lists and maps.
Coercion and Type Conversion
Groovy performs automatic type conversion in many cases, which can be controlled or customized through coercion.
© Hypatia.Tech. 2024 All rights reserved.