what is this operator called and what is it used for <=>

后端 未结 4 973
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-18 23:00

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

4条回答
  •  佛祖请我去吃肉
    2021-01-18 23:38

    Name : Spaceship operator

    Method that it uses : a.compareTo(b) //where a and b are the variables that has been used

    Class : java.lang.Comparable

    And this link explains about that operator in a bit more . Click Here

提交回复
热议问题