1 3 11 package gnu.trove; 12 13 19 public final class HashFunctions { 20 25 public static final int hash(double value) { 26 long bits = Double.doubleToLongBits(value); 27 return (int)(bits ^ (bits >>> 32)); 28 } 32 33 38 public static final int hash(float value) { 39 return Float.floatToIntBits(value*663608941.737f); 40 } 43 44 57 public static final int hash(int value) { 58 60 return value; 61 62 70 } 71 72 77 public static final int hash(long value) { 78 return (int)(value ^ (value >> 32)); 79 80 97 } 98 99 104 public static final int hash(Object object) { 105 return object==null ? 0 : object.hashCode(); 106 } 107 } 108 | Popular Tags |