That could be one implementation of the Equalator interface. Another
trivial impelmetantion might do "return (a == b);" and be called
IdentityEqualator

The specific case I'm working on is using Metaphone (from codec). The
impelemtatnion of MetaphoneEqualator looks like this:

...
private Metaphone mEncoder = new Metaphone();
...
public boolean equals(Object a, Object b) {
        try {
            Object encoded0 = mEncoder.encode(a);
            Object encoded1 = mEncoder.encode(b);
            if (encoded0.equals(encoded1)) {
                return true;
            } else {
                return false;
            }
        } catch (EncoderException exception) {
            return false;
        }
}

-----Original Message-----
From: Hookom, Jacob [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 11, 2004 2:47 PM
To: 'Jakarta Commons Developers List'
Subject: RE: [lang] Equalator?


There's this method on Object called "equals"... I suppose you could
write a single object called Equalator that does:

Public Boolean equals(object a, object b) {
        Return a.equals(b);
}

-----Original Message-----
From: Edelson, Justin [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 11, 2004 1:25 PM
To: Jakarta Commons Developers List
Subject: [lang] Equalator?

I'm writing a few classes that currently implement Comparator, but I
really don't care about comparisons - I just want to use an object to
test equality, ergo Equalator. Does such an interface exist somewhere in
lang (I can't find anything similar).

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

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


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

Reply via email to