Skip to main content

language improvement

Please note these forums are being decommissioned and use the new and improved forums at
No replies
Joined: 2011-01-28

First, sorry very much if what I'm going to write is nothing new to you, but I just could not find anything about this in the time I spent reading about Java 7:
I had the hope that Java 7 would contain some necessary improvements in the language, that would make it easier and faster to write (like the multi-catch).
Unfortunately, I'm missing one nice thing, and I don't know if its just that its too difficult, not worth the effort, not needed or just nobody happened to think about it.
The thing is easy:

In if statements, you find things like this:

if(objetcA.accesstoparameterB() != null && objectA.accesstoparameterB().length > 0)....
isnt this verbose? Sometimes in my job i see really long lines because of this, and i know you can assign objectA.accesstoparameterB() to a variable and use it inside the if. However, programmers many times don't want to create variables to use then in just one line in an if statement, no matter how long they are. (I am too lazy for that, and I know I am not the only one).

So: why not: if(objectA.accesstoparameterB() != null && .length > 0)
This may look ugly, but what about this one:

if (a < 3 && a > 1)
what about if (a < 3 && > 1) I think here it doesn't look ugly at all, for me its easier to read, and sometimes "a" is a pretty long line.
So, here it goes my contribution to the next release. Would be great to see it implemented one day.

Thanks and regards,