You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Giacomo Pati <gi...@apache.org> on 2001/04/03 09:11:44 UTC

Re: cvs commit: xml-cocoon/webapp/WEB-INF web.xml

Quoting cziegeler@apache.org:

>   +        String value = conf.getInitParameter("allow-reload");
>   +        if (value == null || value.equals("yes") == true) {

Why are you writing the last statement that way? Would it be better to write it 
like 

     if ("yes".equals(value) == true) {

That way you don't need the additional test against null.

Giacomo

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: cvs commit: xml-cocoon/webapp/WEB-INF web.xml

Posted by "Peter C. Verhage" <pe...@zeelandnet.nl>.
Giacomo wrote:
: Why are you writing the last statement that way? Would it be better to
write it
: like
:
:      if ("yes".equals(value) == true) {
:
: That way you don't need the additional test against null.

That's true, but, why are you comparing the result of the equals test with
true? Because the equals method returns a boolean. So even more efficiently
would be:

    if ("yes".equals(value)) {

:))

Peter


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: AW: cvs commit: xml-cocoon/webapp/WEB-INF web.xml

Posted by Giacomo Pati <gi...@apache.org>.
Quoting Carsten Ziegeler <cz...@sundn.de>:

> > Giacomo Pati wrote:
> > Quoting cziegeler@apache.org:
> > 
> > >   +        String value = conf.getInitParameter("allow-reload");
> > >   +        if (value == null || value.equals("yes") == true) {
> > 
> > Why are you writing the last statement that way? Would it be better to
> > write it
> > like
> > 
> >      if ("yes".equals(value) == true) {
> > 
> > That way you don't need the additional test against null.
> > 
> Yes, you're right,
> 
> I accidentally used our company coding style. 
> Sorry for that, I will change it as soon as my cvs works again.

This has nothing to do with coding style. It's only simpler code IMHO.

Giacomo

> 
> Carsten
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


AW: cvs commit: xml-cocoon/webapp/WEB-INF web.xml

Posted by Carsten Ziegeler <cz...@sundn.de>.
> Giacomo Pati wrote:
> Quoting cziegeler@apache.org:
> 
> >   +        String value = conf.getInitParameter("allow-reload");
> >   +        if (value == null || value.equals("yes") == true) {
> 
> Why are you writing the last statement that way? Would it be better to
> write it
> like
> 
>      if ("yes".equals(value) == true) {
> 
> That way you don't need the additional test against null.
> 
Yes, you're right,

I accidentally used our company coding style. 
Sorry for that, I will change it as soon as my cvs works again.

Carsten


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org