【发布时间】:2020-01-10 16:58:24
【问题描述】:
对于Hash数据结构,比如HashSet、HashMap等,我们需要实现hashcode。但是,这不是很方便。我们可以改用 Hashable 或 Hasher 之类的东西吗?
以下是 Swift 中的示例: https://developer.apple.com/documentation/swift/hashable
【问题讨论】:
-
Apache Commons 有
HashCodeBuilder;这允许return HashCodeBuilder.reflectionHashCode(this);(以及其他形式)。 -
@ElliottFrisch 谢谢!!这是我正在寻找的数据结构。
-
感谢您的接受 :-)
标签: java hashmap hashcode hashable