Why not allow an external interface to provide hashCode/equals for a HashMap?

前端 未结 9 1854
闹比i
闹比i 2020-12-17 15:28

With a TreeMap it\'s trivial to provide a custom Comparator, thus overriding the semantics provided by Comparable objects added to the

9条回答
  •  南笙
    南笙 (楼主)
    2020-12-17 16:00

    There's such a feature in com.google.common.collect.CustomConcurrentHashMap, unfortunately, there's currently no public way how to set the Equivalence (their Hasharator). Maybe they're not yet done with it, maybe they don't consider the feature to be useful enough. Ask at the guava mailing list.

    I wonder why it haven't happened yet, as it was mentioned in this talk over two years ago.

提交回复
热议问题