commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Carman <>
Subject Re: [LANG] Suggestions For New Features
Date Thu, 20 Aug 2009 12:27:57 GMT
On Thu, Aug 20, 2009 at 8:23 AM, Michael Wooten<> wrote:
> I was assuming I would use the fact that compareTo() returns 0 for the case
> of equality. My original assumption was the test would be as simple as
> ((value.compareTo(start) >= 0) && (value.compareTo(end) <= 0)).  However,
> the documentation for Comparable states, compareTo()'s 0 return may not be
> equivalent to equals(), so feel free to debate how this would be
> implemented. It may just be the case that the behavior be documented in the
> API.
> Additional thoughts?

I meant how are you going to allow for less than vs. less than or
equal to on the boundaries of your range with this API?

And, compareTo() == 0 only means that objects are equivalent with
respect to the comparison being performed.  It doesn't necessarily
mean they're the same object, as you pointed out (two distinct Person
objects with the same last name would show a comparison value of 0 if
comparing by last name only).

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message