Re: String.equals()
- From: Steven Simpson <ss@xxxxxxxxxxxxxx>
- Date: Wed, 25 Jul 2007 19:24:14 +0100
Oliver Wong wrote:
In order to actually obey the contract of Comparator,
Why try, if you know that what you'll submit it to will only care
whether it gives zero or non-zero?
you're forced to
come up with a total-ordering of all your elements of a given type.
Sometimes this is difficult or impossible.
So just make a Comparator that returns 0 or 1, and put a note in the
docs saying it doesn't obey the contract. Anything wrong with that?
I've created an interface which
is like Comparator, but only checks two items for equality, instead of an
ordering. I couldn't come up with a good name though: it's called
Equalitor<T>.
(I'd vote for the already mentioned "Equator".)
--
ss at comp dot lancs dot ac dot uk |
.
- Follow-Ups:
- Re: String.equals()
- From: Oliver Wong
- Re: String.equals()
- References:
- String.equals()
- From: Chameleon
- Re: String.equals()
- From: Mike Schilling
- Re: String.equals()
- From: CatBurglerV8
- Re: String.equals()
- From: Mike Schilling
- Re: String.equals()
- From: Lew
- Re: String.equals()
- From: Oliver Wong
- String.equals()
- Prev by Date: How do you read the content of internal web pages?
- Next by Date: Re: How do you read the content of internal web pages?
- Previous by thread: Re: String.equals()
- Next by thread: Re: String.equals()
- Index(es):
Relevant Pages
|