@Override public int hashCode() { return HashCode.compute(parent, segment); }
/** * Compute a combined hash code from the supplied objects. This method always returns 0 if no objects are supplied. * * @param objects the objects that should be used to compute the hash code * @return the hash code */ public static int compute(Object... objects) { return computeHashCode(0, objects); }
protected MultiSegmentPath(String[] segments) { this.segments = segments; assert size() > 1; this.hc = HashCode.compute(segments[0].hashCode(),segments[1].hashCode()); }
/** * Compute a combined hash code from the supplied objects. This method always returns 0 if no objects are supplied. * * @param objects the objects that should be used to compute the hash code * @return the hash code */ public static int compute(Object... objects) { return computeHashCode(0, objects); }
@Test public void shouldAcceptNoArguments() { assertThat(HashCode.compute(), is(0)); }
@Test public void shouldComputeHashCodeForOnePrimitive() { assertThat(HashCode.compute(1), is(not(0))); assertThat(HashCode.compute((long) 8), is(not(0))); assertThat(HashCode.compute((short) 3), is(not(0))); assertThat(HashCode.compute(1.0f), is(not(0))); assertThat(HashCode.compute(1.0d), is(not(0))); assertThat(HashCode.compute(true), is(not(0))); }
@Override public int hashCode() { return HashCode.compute(parent, segment); }
protected MultiSegmentPath(String[] segments) { this.segments = segments; assert size() > 1; this.hc = HashCode.compute(segments[0].hashCode(),segments[1].hashCode()); }