commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Allon Mureinik (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-804) Redundant check for zero in HashCodeBuilder ctor
Date Tue, 03 Sep 2013 19:19:54 GMT

    [ https://issues.apache.org/jira/browse/LANG-804?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13756951#comment-13756951
] 

Allon Mureinik commented on LANG-804:
-------------------------------------

There's nothing wrong with using negative params to create negative hash codes.
Integer.valueOf(-100).hashCode() gives -100, so if its good enough for the JDK, it should
be good enough for commons-lang :-)

I've created a pull request on GitHub to remove the redundant checks, for your evaluation:
https://github.com/apache/commons-lang/pull/10
                
> Redundant check for zero in HashCodeBuilder ctor
> ------------------------------------------------
>
>                 Key: LANG-804
>                 URL: https://issues.apache.org/jira/browse/LANG-804
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.builder.*
>            Reporter: Sebb
>            Priority: Minor
>
> The HashCodeBuilder(int, int) ctor checks both parameters for zero, as well as checking
for an odd number.
> Zero is never odd, so the zero check could be eliminated.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message