BucketConfig { @Override public int hashCode() { int result = timeUnit.hashCode(); result = 31 * result + Arrays.hashCode(buckets); return result; } BucketConfig(Builder builder); TimeUnit getTimeUnit(); String getTimeUnitAbbreviation(); long[] getBuckets(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testHashCode() throws Exception { BucketConfig config1 = new BucketConfig.Builder() .withTimeUnit(TimeUnit.SECONDS) .withBuckets(new long[]{7, 8, 9}) .build(); BucketConfig config2 = new BucketConfig.Builder() .withTimeUnit(TimeUnit.SECONDS) .withBuckets(new long[]{7, 8, 9}) .build(); BucketConfig config3 = new BucketConfig.Builder() .withTimeUnit(TimeUnit.SECONDS) .withBuckets(new long[]{7, 8, 91}) .build(); assertTrue(config1.hashCode() == config1.hashCode()); assertTrue(config1.hashCode() == config2.hashCode()); assertTrue(config1.hashCode() != config3.hashCode()); }