什么是Java 8中的字符串键的替代散列? [英] What is alternative hashing for String keys in Java 8?

查看:132
本文介绍了什么是Java 8中的字符串键的替代散列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java 8为String键提供了可选的哈希,以便在遇到大量的键哈希码冲突时提高性能。

Java 8 is providing alternative hashing for String keys to improve performance when a large number of key hash code collisions are encountered. Can anybody explain what is that and how it will work?

推荐答案

: .org / gmane.comp.java.openjdk.core-libs.devel / 10361 p>

From this email of core-lib-devs@openjkd:



  • 引入了一个新界面Hashable32。

  • Hashable32提供了一个方法hash32 ()

  • String实现Hashable32和hash32()方法

  • HashMap等人识别String并调用hash32(),而不是hashCode >
  • A new interface Hashable32 is introduced.
  • Hashable32 provides a method hash32()
  • String implements Hashable32 and hash32() method
  • HashMap et al recognize String and invoke hash32() rather than hashCode()

代码的修订版本:

  • Murmur3 : https://code.google.com/p/smhasher/wiki/MurmurHash3
  • althashing "7" webrev : http://cr.openjdk.java.net/~mduigou/althashing7/8/webrev/
  • althashing "8" webrev : http://cr.openjdk.java.net/~mduigou/althashing8/8/webrev/

这篇关于什么是Java 8中的字符串键的替代散列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆