commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Lachman (JIRA)" <>
Subject [jira] [Commented] (COLLECTIONS-242) Add Equator interface for more powerful collections
Date Tue, 26 Feb 2013 18:20:13 GMT


Matt Lachman commented on COLLECTIONS-242:

I found this after posting for something similar on StackOverflow [here|].
The Equator interface seems to have more potential uses (such as Maps and Sets using it for
determining uniqueness).

I think it would also be worthwhile to overload {{isEqualCollection}} on {{CollectionUtils}}
using this interface:

public static boolean isEqualCollection(Collection a,
    Collection b, Equator e)

If it makes sense, I can file this as a separate enhancement request dependent on this issue.
> Add Equator interface for more powerful collections
> ---------------------------------------------------
>                 Key: COLLECTIONS-242
>                 URL:
>             Project: Commons Collections
>          Issue Type: Improvement
>          Components: Comparator
>            Reporter: Stephen Kestle
>            Assignee: Stephen Kestle
>             Fix For: 4.0
> 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.
> e.g.: an database object that has a name, code and a value. Equality could be based on:
> * database id
> * code
> * name and code
> * case-insensitive name
> 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.
> I propose that it has two methods:
> boolean equate();
> int hash();
> I shall upload some files when I next get some time.
> NB: This ticket is a summary of the email conversation begun on 5 Jan 2007: "equator
interface" ( 
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).

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:

View raw message