jQuery in Action, 2nd edition*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Languages » Groovy
Bookmark "Groovy & Java" Watch "Groovy & Java" New topic
Author

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?

Mourougan
Open Source leads to Open Mind
Jon Dickinson
Author
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!

    Thanks,
    Jon.


    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: http://aspose.com/file-tools
     
    subject: Groovy & Java
     
    Similar Threads
    clojure vs scala
    How Groovy Helps Java Developers
    Grails 1.0 Web Application Development - TOC
    Groovy/Java Integration
    Groovy questions