I use the ?: a lot!!!
I agree that an if/else is more readable, but in some situations the ?: is
better.
For example I use it to "normalize" method parameters:
void mmm(int i,String[] sss)
{
i = i < 0 ? 0 : i;
sss = sss == null ? new String[0] : sss;
...
}
The above is much more concise than:
void mmm(int i,String[] sss)
{
if( i < 0 )
i = 0;
if( sss == null )
sss = new String[0];
}
and I don't find it any less readable...
Sure enough in other cases an if/else is much better!!!
Bye
Paolo Rizzi
> -----Messaggio originale-----
> Da: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> conto di Paul
> Austin
> Inviato: mercoledì 2 luglio 2008 18.35
> A: OpenJump develop and use
> Oggetto: Re: [JPP-Devel] Style Sheet For Java FOSS Coding
>
>
> I think that using an if/.else statement is much more
> readable than the
> ?: operator.
>
> It's just another one of those coding religious wars such as if the {
> should be on the same or the next line.
>
> Paul
>
> --------------------------------------------------------------
> -----------
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
> _______________________________________________
> Jump-pilot-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Jump-pilot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel