What's the difference between == and .equals in Scala?

前端 未结 5 1768
小鲜肉
小鲜肉 2020-11-28 02:28

What is the difference between == and .equals() in Scala, and when to use which?

Is the implementation same as in Java?

EDIT: The r

5条回答
  •  旧巷少年郎
    2020-11-28 02:56

    You normally use ==, it routes to equals, except that it treats nulls properly. Reference equality (rarely used) is eq.

提交回复
热议问题