| Reporter: |
|
Stephen Kestle |
| Created: |
|
Fri, 9 Mar 2007 02:14:20 -0800 (PST) |
| Updated: |
|
Wed, 25 Jun 2008 16:19:31 -0700 (PDT) |
| Key: |
|
COLLECTIONS-242 |
| Versions: |
|
Not provided |
| Environment: |
|
|
| Priority: |
|
3 |
| Status: |
|
Reopened |
| Resolution: |
|
Unresolved |
| Original Link: |
|
http://issues.apache.org/jira/browse/COLLECTIONS-242 |
| Summary: |
|
Add Equator interface for more powerful collections |
Description:
Java has Comparable and Comparator to compare objects, and objects have an equals() method. But there is no interface for when an object has multiple ways of being equal.
<p>e.g.: an database object that has a name, code and a value. Equality could be based on:</p>
<ul>
<li>database id</li>
<li>code</li>
<li>name and code</li>
<li>case-insensitive name</li>
</ul>
<p>When extended to collections, this allows us to search for specific
values (with an EqualsPredicate that takes an Equator), and implement
Maps and Sets that use specific equators to determine uniqueness.</p>
<p>I propose that it has two methods:
boolean equate();
int hash();</p>
<p>I shall upload some files when I next get some time.</p>
<p>NB: This ticket is a summary of the email conversation begun on 5 Jan 2007: "equator interface" (<span class="nobr"><a href="
http://archives.devshed.com/forums/java-118/equator-interface-2126195.html">
http://archives.devshed.com/forums/java-118/equator-interface-2126195.html<sup><img class="rendericon" src="
https://issues.apache.org/jira/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"/></sup></a></span>). Stephen C made reference there to creating a FlexiMap, but in my mind, that's additional to this issue (this interface still needs to be created to be able to stand alone).</p>
Comments:
| scolebourne |
Fri, 9 Mar 2007 15:23:06 -0800 (PST) |
| shammah |
Wed, 2 Apr 2008 00:58:01 -0700 (PDT) |
| rahul |
Wed, 2 Apr 2008 12:39:09 -0700 (PDT) |
| shammah |
Wed, 25 Jun 2008 16:19:31 -0700 (PDT) |