Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Groovy & Java

 
Mourouganandame Arunachalam
Ranch Hand
Posts: 396
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Jon Dickinson
Author
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
     
    Mourouganandame Arunachalam
    Ranch Hand
    Posts: 396
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Bunch of thanks for the details Jon ...
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic