PROPOSAL: Sameness operators (version 2)

Derek Foster vapor1 at
Fri May 8 18:10:00 PDT 2009

Hi, Mark.

In case this wasn't clear from my previous replies... the intent (as specified in the proposal's "specification" section) is that the < and > operators will operate exactly the same as they currently do for values that are convertible to primitive types, so as to avoid introduction of any breaking changes. Therefore, unboxing conversion will first occur before comparison occurs.


-----Original Message-----
>From: Mark Thornton <mthornton at>
>Sent: May 1, 2009 3:38 AM
>To: Derek Foster <vapor1 at>
>Cc: Project Coin <coin-dev at>
>Subject: Re: PROPOSAL: Sameness operators (version 2)
>Derek Foster wrote:
>> and adds additional overloadings to existing operators:
>> a < b     a.compareTo(b) < 0, or a < b for primitive types.
>> a > b     a.compareTo(b) > 0, or a > b for primitive types.
>0f < Float.NaN is false
>Float.valueOf(0).compareTo(Float.valueOf(Float.NaN)) < 0 is true
>With Float objects, would the values be unboxed and then compared using 
>the existing '<' operator or left boxed and compared using compareTo? If 
>the former, then casting to Comparable would change the result, while 
>the second alternative would change the current result (obtained via 
>Mark Thornton

More information about the coin-dev mailing list