Java has Comparable and Comparator to compare objects. Object has an equals() method. But what are we meant to do when and object has multiple ways of being equal?

Consider an database row that has a name, code and a value. Equality could be based on

   * database id
   * code
   * name and code
   * case-insensitive name

Any of these could be appropriate in different situations - in the same way we use Comparators, we should be able to use Equators.

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 (a HashEquator interface may also be defined for this).

However, it is also useful for general coding and equality checking. Does this mean it's suitable for Lang (not really knowing anything about that project)? Is there a Predicate class in Lang?

If an Equator is determined to be something worthwhile for the next (generic) version of Collections, I can provide interfaces, default implementations tests etc.

Cheers

Stephen Kestle


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to