@Override public int hashCode() { if (hash == 0) { hash = bytes().hashCode(); } return hash; }
@Override public int hashCode() { int result = id.hashCode(); result = 31 * result + type.hashCode(); result = 31 * result + Long.hashCode(seqNo); result = 31 * result + Long.hashCode(primaryTerm); result = 31 * result + Long.hashCode(version); result = 31 * result + versionType.hashCode(); result = 31 * result + source.hashCode(); result = 31 * result + (routing != null ? routing.hashCode() : 0); result = 31 * result + (parent != null ? parent.hashCode() : 0); result = 31 * result + Long.hashCode(autoGeneratedIdTimestamp); return result; }
@Override public int hashCode() { int result = entity.getCacheIdentity().hashCode(); result = 31 * result + readerCacheKey.hashCode(); result = 31 * result + value.hashCode(); return result; } }
@Override public int hashCode() { int result = id.hashCode(); result = 31 * result + config.hashCode(); return result; } }
@Override public int hashCode() { int result = entity.getCacheIdentity().hashCode(); result = 31 * result + Long.hashCode(readerVersion); result = 31 * result + value.hashCode(); return result; } }
@Override public int hashCode() { if (hash == 0) { hash = bytes().hashCode(); } return hash; }
@Override public int hashCode() { int result = id.hashCode(); result = 31 * result + type.hashCode(); result = 31 * result + Long.hashCode(version); result = 31 * result + versionType.hashCode(); result = 31 * result + source.hashCode(); result = 31 * result + (routing != null ? routing.hashCode() : 0); result = 31 * result + (parent != null ? parent.hashCode() : 0); result = 31 * result + Long.hashCode(timestamp); result = 31 * result + Long.hashCode(autoGeneratedIdTimestamp); result = 31 * result + Long.hashCode(ttl); return result; }
@Override public int hashCode() { if (hash == 0) { hash = bytes().hashCode(); } return hash; }
@Override public int hashCode() { if (hash == 0) { hash = bytes().hashCode(); } return hash; }
@Override public int hashCode() { int result = entity.getCacheIdentity().hashCode(); result = 31 * result + readerCacheKey.hashCode(); result = 31 * result + value.hashCode(); return result; } }
@Override public int hashCode() { int result = id.hashCode(); result = 31 * result + type.hashCode(); result = 31 * result + Long.hashCode(seqNo); result = 31 * result + Long.hashCode(primaryTerm); result = 31 * result + Long.hashCode(version); result = 31 * result + versionType.hashCode(); result = 31 * result + source.hashCode(); result = 31 * result + (routing != null ? routing.hashCode() : 0); result = 31 * result + (parent != null ? parent.hashCode() : 0); result = 31 * result + Long.hashCode(autoGeneratedIdTimestamp); return result; }
public void testHashCode() throws IOException { // empty content must have hash 1 (JDK compat) BytesReference pbr = newBytesReference(0); assertEquals(Arrays.hashCode(BytesRef.EMPTY_BYTES), pbr.hashCode()); // test with content pbr = newBytesReference(randomIntBetween(0, PAGE_SIZE * randomIntBetween(2, 5))); int jdkHash = Arrays.hashCode(BytesReference.toBytes(pbr)); int pbrHash = pbr.hashCode(); assertEquals(jdkHash, pbrHash); // test hashes of slices int sliceFrom = randomIntBetween(0, pbr.length()); int sliceLength = randomIntBetween(0, pbr.length() - sliceFrom); BytesReference slice = pbr.slice(sliceFrom, sliceLength); int sliceJdkHash = Arrays.hashCode(BytesReference.toBytes(slice)); int sliceHash = slice.hashCode(); assertEquals(sliceJdkHash, sliceHash); }