[
https://issues.apache.org/jira/browse/LUCENE-460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13712829#comment-13712829
]
Dawid Weiss commented on LUCENE-460:
------------------------------------
I didn't argue for the first version or the second one -- I was just saying
both are pretty straightforward. They're apples and oranges, hard to tell which
one is better. IntelliJ's version is based on a common pattern found throughout
the JDK -- I am pretty sure it has a common underlying academic source
somewhere :)
In general implementing equals and hashCode properly (so that the contract of
these methods is not violated and the hash code distribution is sensibly
random) is not trivial at all so anything that helps you get to the point is
probably sensible.
{code}
Integer.rotateLeft(31)
{code}
That example is actually a rotateLeft(1) -- you shift one bit to the left
(h<<1), then you OR ("insert") the leftmost bit shifted to the first bit's
position (h>>>31).
> hashCode improvements
> ---------------------
>
> Key: LUCENE-460
> URL: https://issues.apache.org/jira/browse/LUCENE-460
> Project: Lucene - Core
> Issue Type: Improvement
> Components: core/search
> Reporter: Yonik Seeley
> Assignee: Yonik Seeley
> Priority: Minor
>
> It would be nice for all Query classes to implement hashCode and equals to
> enable them to be used as keys when caching.
--
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
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]