Why is the following true in Groovy?
0 > null
Is it by choice or is it just a consequence of the implementation of compareTo?
I’m using Groovy 2.0.5.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In Groovy
nullis the lowest possible element, so everything is> nullThis means things like this can work:
Otherwise what would happen? If you want this to work, you have to say “null is lower than anything” or “null is higher than anything”…
Groovy chose the former