The Source for Java Technology Collaboration
User: Password:



Start New Message Delete Post a Reply

Article: 
 The Open Road: Looking Ahead to Java 7
Subject:  Groovy style of String expression
Date:  2007-12-25 22:14:07
From:  jianwu_chen


String literal in groovy is a big advantage compare to Java. So one of my big wish is Java can add support of groovy style of string expression:

1. Multi-Line Strings :
Instead of : “abc” + “\ndef” + “\nghi”, we can simply put:
“””
Abcdefghi
“””

2. Shortcut to embedded variable in String
Such as “Hello $name” instead of “Hello” + name.

I believe these changes won’t affect much in deep of the language, just the change of the source code parser. But this has great benefit for producing cleaner code.

 Feed java.net RSS Feeds