1/* 2 * Copyright (C) 2008 The Guava Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.google.common.collect; 18 19import com.google.common.annotations.GwtCompatible; 20 21/** 22 * Static methods for implementing hash-based collections. 23 * 24 * @author Kevin Bourrillion 25 * @author Jesse Wilson 26 */ 27@GwtCompatible 28final class Hashing { 29 private Hashing() {} 30 31 /* 32 * This method was written by Doug Lea with assistance from members of JCP 33 * JSR-166 Expert Group and released to the public domain, as explained at 34 * http://creativecommons.org/licenses/publicdomain 35 * 36 * As of 2010/06/11, this method is identical to the (package private) hash 37 * method in OpenJDK 7's java.util.HashMap class. 38 */ 39 static int smear(int hashCode) { 40 hashCode ^= (hashCode >>> 20) ^ (hashCode >>> 12); 41 return hashCode ^ (hashCode >>> 7) ^ (hashCode >>> 4); 42 } 43} 44