SlideShare a Scribd company logo
Preview of Groovy 3.0
Presented by Vijay Shukla (vijay@nexthoughts.com)
Agenda
1. Parrot Parser
2. Improve the loop statement
3. Do-while statement
4. Supports Lambda Expressions
5. Support Method and Constructor Reference
6. Support try-with resource statement
7. Support Java-style array initialization
8. Support interface default method
9. New Operator
10. Support for secure retrieval
11. Support runtime Groovydoc
Parrot Parser
It has new parser Parrot which is far more flexible and maintainable thank the
previous versions of groovy.
It is enabled by default in Groovy 3.*
We can disable it by using a system property.
Use -Dgroovy.antlr4=false (set it via JAVA_OPTS)
Improve the loop statement
Comma-separate expression is now supported. (Java Syntax)
Do-While has been introduced.
Groovy support multi assignment since 1.6 but now it also supported in for loop.
Java Style Array Initialization
Groovy has always supported literal list/array definitions using square brackets ([])
and has avoided Java-style curly braces just to not conflict with closures.
Lambda Expressions
The Normal Variants of Java Lambda Expression supported in Groovy 3.0
● General Form
● Curly braces are optional for single expression
● Parameter Types are optional
● No Parenthesis required for a single parameter with no type
● No argument case
It has additional features such as default parameter value.
Method and Constructor Reference
Java 8 method reference syntax using double colon syntax is now supported.
Operators
1. !in
2. !instanceof
3. Elvis Operator (?=)
4. Identity comparison Operators (=== and !==)
5. Safe Indexing
Try with Resource
Java 7’s has try-with-resource statement for ARM (Automatic Resource
Management).
Groovy 3.0 also support the same syntax as Java 7.
Interface Default Method
Java 8 supports adding default implementations to interfaces. Groovy now
supports this too.
Example
https://github.com/vijayshukla30/Groovy-3-Preview
Extra Stuff
@Canonical:- It allows you to write classes in shortened form. It provide
combination of features of @ToString, @EqualsAndHashcode, @TupleConstructor.
@ToString:- default implementation of toString() method on the basis of fields in
class
@EqualsAnd Hashcode:- default implementation of equals() and hashcode().
@TupleConstructor:- provide classical constructor with default properties.
Constructor implementation depends upon the order of the variable declaration.
All above are defined in groovy.transform package
Thank You
Questions
Resource
http://sergiodelamo.es/preview-of-groovy-3/
http://groovy-lang.org/releasenotes/groovy-3.0.html

More Related Content

PPTX
Java 9 features
PDF
Metaprogramming Rails
PPTX
Test Driven In Groovy
PDF
Python master class 2
PPTX
study of java
PDF
Python master class part 1
KEY
Tdd With Groovy
PPT
Lecture on Java Concurrency Day 3 on Feb 11, 2009.
Java 9 features
Metaprogramming Rails
Test Driven In Groovy
Python master class 2
study of java
Python master class part 1
Tdd With Groovy
Lecture on Java Concurrency Day 3 on Feb 11, 2009.

What's hot (19)

PDF
Python45 2
PPTX
Binary Studio Academy PRO: ANTLR course by Alexander Vasiltsov (lesson 3)
PDF
Java object oriented programming - OOPS
PPTX
Java history, versions, types of errors and exception, quiz
PPTX
Java
DOCX
Static keyword u.s ass.(2)
PPTX
Java presentation
PPT
Google C++ Testing Framework in Visual Studio 2008
PPTX
The Awesome Python Class Part-2
PPT
Java findamentals2
KEY
Fall 2011 PHP Class - Session 2
PPTX
The Awesome Python Class Part-3
PDF
Java exception handling
PPTX
The Awesome Python Class Part-5
PPTX
Java principles
PDF
Jython 2.7 and techniques for integrating with Java - Frank Wierzbicki
PPTX
Build, logging, and unit test tools
Python45 2
Binary Studio Academy PRO: ANTLR course by Alexander Vasiltsov (lesson 3)
Java object oriented programming - OOPS
Java history, versions, types of errors and exception, quiz
Java
Static keyword u.s ass.(2)
Java presentation
Google C++ Testing Framework in Visual Studio 2008
The Awesome Python Class Part-2
Java findamentals2
Fall 2011 PHP Class - Session 2
The Awesome Python Class Part-3
Java exception handling
The Awesome Python Class Part-5
Java principles
Jython 2.7 and techniques for integrating with Java - Frank Wierzbicki
Build, logging, and unit test tools
Ad

Similar to Preview of Groovy 3 (20)

PPT
Future Programming Language
DOCX
Java interview questions and answers for cognizant By Data Council Pune
PPTX
Groovy features
DOCX
Viva file
PDF
Java Interview Questions PDF By ScholarHat
PDF
Java programming basics
PPTX
Suga java training_with_footer
PPT
Java for Mainframers
PDF
__ Java Technical round questions .pdf soo
PDF
Java se 8 language enhancements & features
PDF
Generics and collections in Java
PDF
Java Faqs useful for freshers and experienced
PPTX
Java interview questions 2
PDF
Top 371 java fa qs useful for freshers and experienced
PDF
Core Java Interview Questions PDF By ScholarHat
PPTX
Objects and classes in OO Programming concepts
PDF
Object Oriented Programming with Java Basic Syntax.pdf
PDF
1669617800196.pdf
PPTX
OCA Java SE 8 Exam Chapter 4 Methods Encapsulation
PDF
Java basic concept
Future Programming Language
Java interview questions and answers for cognizant By Data Council Pune
Groovy features
Viva file
Java Interview Questions PDF By ScholarHat
Java programming basics
Suga java training_with_footer
Java for Mainframers
__ Java Technical round questions .pdf soo
Java se 8 language enhancements & features
Generics and collections in Java
Java Faqs useful for freshers and experienced
Java interview questions 2
Top 371 java fa qs useful for freshers and experienced
Core Java Interview Questions PDF By ScholarHat
Objects and classes in OO Programming concepts
Object Oriented Programming with Java Basic Syntax.pdf
1669617800196.pdf
OCA Java SE 8 Exam Chapter 4 Methods Encapsulation
Java basic concept
Ad

More from Vijay Shukla (20)

PDF
Introduction of webpack 4
PDF
Jython
PPTX
Groovy closures
PPTX
Groovy
PPTX
Grails services
PPTX
Grails plugin
PPTX
Grails domain
PPTX
Grails custom tag lib
PPTX
Grails
PPTX
PPTX
Controller
PPTX
Config BuildConfig
PPTX
Command object
PPTX
Boot strap.groovy
PPTX
PPTX
Custom plugin
PPTX
Spring security
PPTX
PPTX
Config/BuildConfig
PPTX
Introduction of webpack 4
Jython
Groovy closures
Groovy
Grails services
Grails plugin
Grails domain
Grails custom tag lib
Grails
Controller
Config BuildConfig
Command object
Boot strap.groovy
Custom plugin
Spring security
Config/BuildConfig

Recently uploaded (20)

PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Big Data Technologies - Introduction.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Cloud computing and distributed systems.
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
cuic standard and advanced reporting.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPT
Teaching material agriculture food technology
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
Spectral efficient network and resource selection model in 5G networks
Network Security Unit 5.pdf for BCA BBA.
Big Data Technologies - Introduction.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Cloud computing and distributed systems.
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
“AI and Expert System Decision Support & Business Intelligence Systems”
Understanding_Digital_Forensics_Presentation.pptx
Electronic commerce courselecture one. Pdf
Unlocking AI with Model Context Protocol (MCP)
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Encapsulation_ Review paper, used for researhc scholars
cuic standard and advanced reporting.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Advanced methodologies resolving dimensionality complications for autism neur...
Teaching material agriculture food technology
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Reach Out and Touch Someone: Haptics and Empathic Computing

Preview of Groovy 3

  • 1. Preview of Groovy 3.0 Presented by Vijay Shukla (vijay@nexthoughts.com)
  • 2. Agenda 1. Parrot Parser 2. Improve the loop statement 3. Do-while statement 4. Supports Lambda Expressions 5. Support Method and Constructor Reference 6. Support try-with resource statement 7. Support Java-style array initialization 8. Support interface default method 9. New Operator 10. Support for secure retrieval 11. Support runtime Groovydoc
  • 3. Parrot Parser It has new parser Parrot which is far more flexible and maintainable thank the previous versions of groovy. It is enabled by default in Groovy 3.* We can disable it by using a system property. Use -Dgroovy.antlr4=false (set it via JAVA_OPTS)
  • 4. Improve the loop statement Comma-separate expression is now supported. (Java Syntax) Do-While has been introduced. Groovy support multi assignment since 1.6 but now it also supported in for loop.
  • 5. Java Style Array Initialization Groovy has always supported literal list/array definitions using square brackets ([]) and has avoided Java-style curly braces just to not conflict with closures.
  • 6. Lambda Expressions The Normal Variants of Java Lambda Expression supported in Groovy 3.0 ● General Form ● Curly braces are optional for single expression ● Parameter Types are optional ● No Parenthesis required for a single parameter with no type ● No argument case It has additional features such as default parameter value.
  • 7. Method and Constructor Reference Java 8 method reference syntax using double colon syntax is now supported.
  • 8. Operators 1. !in 2. !instanceof 3. Elvis Operator (?=) 4. Identity comparison Operators (=== and !==) 5. Safe Indexing
  • 9. Try with Resource Java 7’s has try-with-resource statement for ARM (Automatic Resource Management). Groovy 3.0 also support the same syntax as Java 7.
  • 10. Interface Default Method Java 8 supports adding default implementations to interfaces. Groovy now supports this too.
  • 12. Extra Stuff @Canonical:- It allows you to write classes in shortened form. It provide combination of features of @ToString, @EqualsAndHashcode, @TupleConstructor. @ToString:- default implementation of toString() method on the basis of fields in class @EqualsAnd Hashcode:- default implementation of equals() and hashcode(). @TupleConstructor:- provide classical constructor with default properties. Constructor implementation depends upon the order of the variable declaration. All above are defined in groovy.transform package