DefaultContentMetadata implements ContentMetadata { @Override public int hashCode() { if (hashCode == 0) { int result = 0; for (Entry<String, byte[]> entry : metadata.entrySet()) { result += entry.getKey().hashCode() ^ Arrays.hashCode(entry.getValue()); } hashCode = result; } return hashCode; } DefaultContentMetadata();  DefaultContentMetadata(Map<String, byte[]> metadata); DefaultContentMetadata copyWithMutationsApplied(ContentMetadataMutations mutations); Set<Entry<String, byte[]>> entrySet(); @Override @Nullable final byte[] get(String name, @Nullable byte[] defaultValue); @Override @Nullable final String get(String name, @Nullable String defaultValue); @Override final long get(String name, long defaultValue); @Override final boolean contains(String name); @Override boolean equals(@Nullable Object o); @Override int hashCode(); static final DefaultContentMetadata EMPTY; }
@Test public void testNotEquals() throws Exception { DefaultContentMetadata metadata1 = createContentMetadata("metadata1", new byte[] {1, 2, 3}); DefaultContentMetadata metadata2 = createContentMetadata("metadata1", new byte[] {3, 2, 1}); assertThat(metadata1).isNotEqualTo(metadata2); assertThat(metadata1.hashCode()).isNotEqualTo(metadata2.hashCode()); }