[Not really on topic] arithmetic/comparative operators

Pablo Grisafi pablogrisafi1975 at gmail.com
Mon Jun 4 08:08:21 PDT 2012


>You know, it would be really, really nice one day if arithmetic
>operators worked on BigInteger, or any ? extends Number.
>
>But that's a Coin for another time....

When that Coin is in progress, also remember make > and < work for ?
extend Comparable

There is something we can do right now: adding default methods
isGreaterThan, isLessOrEqualThan to Comparable will allow us
to write
if(a.isGreaterThan(b)){
....
}
which is  way better than
if(a.compareTo(b) > 0){
....
}

is something like that planned?


Pablo Grisafi
pablogrisafi1975 at gmail.com


More information about the lambda-dev mailing list