commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Tripodi <simonetrip...@apache.org>
Subject Re: svn commit: r1197452 - /commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/MapPropertyAccessor.java
Date Fri, 04 Nov 2011 09:24:43 GMT
Hola Mau!

> URL: http://svn.apache.org/viewvc?rev=1197452&view=rev
> Log:
> OGNL-35 - Flipped equals() everywhere where a variable is tested against a String constant.
>

This is IMHO a very good improvement, expected values first in assertions!

> @@ -168,19 +169,19 @@ public class MapPropertyAccessor
>         {
>             String key = indexStr.replaceAll( "\"", "" );
>
> -            if ( key.equals( "size" ) )
> +            if ( "size".equals( key ) )
>             {
>                 return "";
>             }
> -            else if ( key.equals( "keys" ) || key.equals( "keySet" ) )
> +            else if ( "keys".equals( key ) || "keySet".equals( key ) )
>             {
>                 return "";
>             }
> -            else if ( key.equals( "values" ) )
> +            else if ( "values".equals( key ) )
>             {
>                 return "";
>             }
> -            else if ( key.equals( "isEmpty" ) )
> +            else if ( "isEmpty".equals( key ) )
>             {
>                 return "";
>             }
>

Can we group all these conditions in just one, since they all return
an empty string?
TIA, have a nice day!
Simo

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/
Mime
View raw message