Draft proposal: allow the use of relational operators on Comparable classes

Neal Gafter neal at gafter.com
Tue Mar 10 09:21:16 PDT 2009


This proposal is incompatible with the existing behavior of the
comparison operators on the boxed value classes, particularly for
Float and Double.

On Tue, Mar 10, 2009 at 9:09 AM, Vilya Harvey <vilya.harvey at gmail.com> wrote:
> I've attached a draft of a proposal to allow classes which implement the
> Comparable interface to be used as operands for the relational operators. So
> for example if you had two Strings, a and b, you would be able to write
>
> if (a < b) {
>    ...
> }
>
> instead of
>
> if (a.compareTo(b) < 0) {
>    ...
> }
>
> and you could do the same with your own classes as well.
>
> Thanks in advance for any feedback,
>
> Vil.
>
>
>
>



More information about the coin-dev mailing list