Proposal: Sameness operators

Tom Hawtin Thomas.Hawtin at Sun.COM
Tue Mar 31 04:09:00 PDT 2009


Derek Foster wrote:
> a $$ b    "same as":              a==null ? b==null : a.equals(b), or a == b for primitive types.

$ and $$ are valid identifier in (existing) Java. Not a lot of people 
know that. http://jroller.com/tackline/entry/things_i_didn_t_know

> a !$ b    "not same as":          a==null ? b!=null : !a.equals(b), or a != b for primitive types.
> a >$ b    "greater than or same": a.compareTo(b) >= 0, or a >= b for primitive types.
> a <$ b    "less than or same":    a.compareTo(b) <= 0, or a <= b for primitive types.

That's going to be jolly confusing for BigDecimal users (but I guess 
that is not a state change).

Tom



More information about the coin-dev mailing list