Andrey Hihlovskiy

Professional blog on groovy, gradle, Java, Javascript and other stuff.

Tag Archives: spaceship

Groovy language, spaceship operator

x <=> y

Useful in comparisons:

  • returns -1 if x is smaller than y
  • return 0 if x equals to y
  • returns 1 if x is greater than y.

Isn’t it sweet?

Advertisements