commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Carman <ja...@carmanconsulting.com>
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<mwooten.dev@gmail.com> 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,
as
> 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: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message