I recently came across this magical operator when digging into Groovy: <=>
Groovy has really made me happy with elvis operators ?. and ?: which I use constantly
Like many others mention, it's called the spaceship operator. Here's my test:
def a def b println 1 <=> 0 // 1 println 0 <=> 1 // -1 println 1 <=> a // 1 println b <=> 0 // -1 println a <=> b // 0 println "abc" <=> "def" // -1 println "abc" <=> 1 // throw exception: java.lang.ClassCastException