File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Groovy and the fly likes Groovy & Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Groovy
Bookmark "Groovy & Java" Watch "Groovy & Java" New topic

Groovy & Java

Mourouganandame Arunachalam
Ranch Hand

Joined: Oct 29, 2008
Posts: 396
Hi Jon,

Is there any areas that Groovy is stepping ahead or differs from Java? What are the key areas in Groovy that you like to highlight for the developers coming from Java background?

Open Source leads to Open Mind
Jon Dickinson
Ranch Hand

Joined: Feb 24, 2009
Posts: 45
Hi Mourougan,

Groovy is ahead of Java on language features. For example:

  • closures
  • meta-programming
  • the elvis operator
  • the safe navigation operator

  • I believe Java is introducing at least the safe navigation operator in version 7, and of course there has been a debate raging within the Java community for a while over closures. Of course Groovy has the benefit of not having to support such an enormous user base, so they have probably had more freedom from the beginning. Java will take a while, and may indeed never catch up with some of these features.

    The syntax for collections, such as Lists, Maps and ranges is also much less verbose in Groovy than Java.

    Of course, I cover the basics of these features in Chapter 4 of my book!


    Jon Dickinson
    Accolade Consulting
    Grails 1.1 Web Application Development
    Mourouganandame Arunachalam
    Ranch Hand

    Joined: Oct 29, 2008
    Posts: 396
    Bunch of thanks for the details Jon ...
    I agree. Here's the link:
    subject: Groovy & Java
    jQuery in Action, 3rd edition