`
lovekikio
  • 浏览: 2715 次
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

hashcode

阅读更多
/**
     * Return hash code for Object x.
     * Since we are using power-of-two
     * tables, it is worth the effort to improve hashcode via
     * the same multiplicative scheme as used in IdentityHashMap.
     */
    private static int hash(Object x) {
        int h = x.hashCode();

        // Multiply by 127 (quickly, via shifts), and mix in some high
        // bits to help guard against bunching of codes that are
        // consecutive or equally spaced.
        return ((h << 7) - h + (h >>> 9) + (h >>> 17));
    }
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics