Skip to content

Instantly share code, notes, and snippets.

@vaskoz
Created August 13, 2013 03:29
Show Gist options
  • Save vaskoz/6217651 to your computer and use it in GitHub Desktop.
Save vaskoz/6217651 to your computer and use it in GitHub Desktop.
Examples of how 'null' is less than everything in Groovy.
println "null < ${Long.MIN_VALUE}: ${null < Long.MIN_VALUE}"
println "null < ${Boolean.FALSE}: ${null < Boolean.FALSE}"
println "false < true: ${false < true}"
println "null < new Object(): ${null < new Object()}"
println "null < null: ${null < null}"
def data = ["1", 2, 3L, null, "foo"]
println data.sort()
null < -9223372036854775808: true
null < false: true
false < true: true
null < new Object(): true
null < null: false
[null, 2, 3, 1, foo]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment