Gary Gregory wrote:
WRT "Better put it in the lang guidelines though."

Sorry, see [collections] DEVELOPERS-GUIDE.

On Sun's doc, in the section "7.3 return statements" [4], quote:
A return statement with a value should not use parentheses unless they
make the return value more obvious in some way. Example:

return;

return myDisk.size();

return (size ? size : defaultSize);

The example should probably be a boolean, eg:

 return (isBig() ? size : defaultSize);
 return isBig() ? size : defaultSize;

and, yes, the former is a lot clearer to my eyes (with the brackets).

(For me, the brackets give a mental indication that you must scan the whole line to understand it, emphasising that it is a single expression. Whereas without the brackets, my mind must deduce that it is an expression from the return statement, which is more effort)

Stephen

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to