@BenchmarkOptions(benchmarkRounds = 100, warmupRounds = 1) @Test public void computeHashTest() { int a = HashTool.compute(1, 2); int b = HashTool.compute(2, 1); assertNotEquals(a, b); assertEquals(a, HashTool.compute(1, 2)); int withNull1 = HashTool.compute(new YearWeek(2013, 1), null); int withNull2 = HashTool.compute(null, new YearWeek(2013, 1)); int withNull3 = HashTool.compute(new YearWeek(2013, 1), null); assertNotEquals(withNull1, withNull2); assertNotEquals(withNull2, withNull3); assertEquals(withNull1, withNull3); }
public static int compute(final Object... objs) { if (objs == null || objs.length == 0) return NULL_VALUE; int hash = NULL_VALUE; for (Object x : objs) { hash = hash * FACTOR + computeInternal(x); } return hash; }
HashTool { public static int compute(final Object... objs) { if (objs == null || objs.length == 0) return NULL_VALUE; int hash = NULL_VALUE; for (Object x : objs) { hash = hash * FACTOR + computeInternal(x); } return hash; } }
HashTool { public static int compute(final Object... objs) { if (objs == null || objs.length == 0) return NULL_VALUE; int hash = NULL_VALUE; for (Object x : objs) { hash = hash * FACTOR + computeInternal(x); } return hash; }  }
HashTool { public static int compute(final Object... objs) { if (objs == null || objs.length == 0) return NULL_VALUE; int hash = NULL_VALUE; for (Object x : objs) { hash = hash * FACTOR + computeInternal(x); } return hash; }  static int compute(final Object... objs); }
HashTool { public static int compute(final Object... objs) { if (objs == null || objs.length == 0) return NULL_VALUE; int hash = NULL_VALUE; for (Object x : objs) { hash = hash * FACTOR + computeInternal(x); } return hash; }  static int compute(final Object... objs); static final int NULL_VALUE; static final int ONE_VALUE; static final int FACTOR; }