You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mahout.apache.org by "Sean Owen (JIRA)" <ji...@apache.org> on 2012/11/16 12:00:12 UTC

[jira] [Commented] (MAHOUT-1116) WeightedVectors do not implement equals()

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

Sean Owen commented on MAHOUT-1116:
-----------------------------------

(There are many subtle Java contract problems like this in the project -- I had tried to fix a lot over the years. The main offenders are bad equals(), not paired with hashCode(), wrong or missing clone(). I'd again encourage people to understand these and try to fix what code they committed or worked on.)

Here -- it's not technically wrong for the ordering to define no strict ordering over objects that are even not equal, but, it's certainly weird, certainly unintended here, and has few if any legit use cases.
                
> WeightedVectors do not implement equals()
> -----------------------------------------
>
>                 Key: MAHOUT-1116
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-1116
>             Project: Mahout
>          Issue Type: Bug
>          Components: Math
>    Affects Versions: 1.0
>            Reporter: Dan Filimon
>            Priority: Minor
>              Labels: newbie
>         Attachments: WeightedVector_MAHOUT_1116.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> WeightedVectors [1] implement compareTo but not equals so in cases where just the weights or the indices differ, despire compareTo returning 0, equals returns false.
> [1] https://github.com/apache/mahout/blob/trunk/math/src/main/java/org/apache/mahout/math/WeightedVector.java

--
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