lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Troy Howard (JIRA)" <>
Subject [Lucene.Net] [jira] [Commented] (LUCENENET-437) Port Contrib.Shingle from Java
Date Mon, 18 Jul 2011 23:18:57 GMT


Troy Howard commented on LUCENENET-437:

Well, it does, because of Object.hashCode()'s definition. 

It ensures equality, but does not ensure inequality. 

In other words, the contract ensures that for all types, this passes:


but does not ensure that this passes:


However, the docs state that while the equality of hashcodes may not be consistent with inequality
of hash codes, that all efforts should be made to ensure both.

The problem we face is that with Hashtable/HashSet, we generally care more about inequality
(eg Uniqueness) than we do about equality (eg Sameness). What we're trying to determine, using
hashCode/equals is the uniqueness of an item in the set, which is a different kind of logic
(though clearly related).

So, using .hashCode() to determine uniqueness of an item in a set is incorrect, it should
always be correct for determining sameness.

> Port Contrib.Shingle from Java
> ------------------------------
>                 Key: LUCENENET-437
>                 URL:
>             Project: Lucene.Net
>          Issue Type: Task
>          Components: Lucene.Net Contrib, Lucene.Net Test
>    Affects Versions: Lucene.Net 2.9.4, Lucene.Net 2.9.4g
>            Reporter: Troy Howard
>            Assignee: Troy Howard
>            Priority: Minor
>             Fix For: Lucene.Net 2.9.4, Lucene.Net 2.9.4g
> Port Contrib.Shingle from Java

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message