Skip to content
Rain Hu's Workspace
Go back

[Java] HashMap中的hashCode設計原理

Rain Hu

程式碼

static final int hash(Object key){
    int h;
    return (key == null) ? 0 : (h = key.hashCode()) ^ (h >>> 16);
}

h >> 16 的用途

key.hashCode() ^ (h >> 16)


Share this post on:

Previous
[C++] The C++ Standard Template Library(STL) - map
Next
[C++] 易錯題目收集