In Groovy, null is the smallest possible element, so everyone > null
assert 'tim' > null assert 0 > null assert -1 > null assert Double.NEGATIVE_INFINITY > null
This means that such things can work:
[ 1, null, 3 ].sort()
Otherwise, what will happen? If you want this to work, you must say: "null is less than anything" or "null is more than anything" ...
Groovy chose the former
tim_yates
source share