本文介绍了在Scala中实现equals和hashCode的标准习语是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Scala中实现 equals hashCode 方法的标准惯用法是什么?

What is the standard idiom for implementing the equals and hashCode methods in Scala?

我知道首选方法已在 ,但我目前无法访问该书。

I know the preferred approach is discussed in Programming in Scala, but I don't currently have access to the book.

推荐答案

有免费的第一版PinS也讨论了这个主题。但是,我认为 best 的来源是由Odersky讨论Java中的平等。 PinS中的讨论是iirc,是本文的缩写。

There's a free 1st edition of PinS that discuss this subject just as well. However, I think the best source is this article by Odersky discussing equality in Java. The discussion in PinS is, iirc, an abbreviated version of this article.

这篇关于在Scala中实现equals和hashCode的标准习语是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 14:01