[ https://issues.apache.org/jira/browse/JDO-598?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12608631#action_12608631 ]
Craig Russell commented on JDO-598: ----------------------------------- I think that an implementation of compareTo that always returns zero would effectively disallow the class from being used for keys of Map or entries of Collection. The second entry would compare equal with the first entry and be disallowed. This might be confusing to the user. I think better would be to throw an exception if the key instance did not implement Comparable. This would allow the known good cases to work correctly and give a reasonable error message ("The key class Foo does not implement Comparable"). > Make SingleFieldIdentity classes implement Comparable > ----------------------------------------------------- > > Key: JDO-598 > URL: https://issues.apache.org/jira/browse/JDO-598 > Project: JDO > Issue Type: Improvement > Components: api2 > Reporter: Andy Jefferson > Fix For: JDO 2 maintenance release 2 > > Attachments: SingleFieldIdentity_Comparable.patch > > > Would be preferable for javax.jdo.identity classes to implement Comparable so > that we can store them in a TreeSet etc -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.