@Test public void testEqualsAndHashCode() throws IOException { POSDictionary dictA = loadDictionary("TagDictionaryCaseInsensitive.xml"); POSDictionary dictB = loadDictionary("TagDictionaryCaseInsensitive.xml"); Assert.assertEquals(dictA, dictB); Assert.assertEquals(dictA.hashCode(), dictB.hashCode()); }
@Override public int hashCode() { int[] keyHashes = new int[dictionary.size()]; int[] valueHashes = new int[dictionary.size()]; int i = 0; for (String word : this) { keyHashes[i] = word.hashCode(); valueHashes[i] = Arrays.hashCode(getTags(word)); i++; } Arrays.sort(keyHashes); Arrays.sort(valueHashes); return Objects.hash(Arrays.hashCode(keyHashes), Arrays.hashCode(valueHashes)); }
POSDictionary implements Iterable<String>, MutableTagDictionary, SerializableArtifact { @Override public int hashCode() { int[] keyHashes = new int[dictionary.size()]; int[] valueHashes = new int[dictionary.size()]; int i = 0; for (String word : this) { keyHashes[i] = word.hashCode(); valueHashes[i] = Arrays.hashCode(getTags(word)); i++; } Arrays.sort(keyHashes); Arrays.sort(valueHashes); return Objects.hash(Arrays.hashCode(keyHashes), Arrays.hashCode(valueHashes)); } }
POSDictionary implements Iterable<String>, MutableTagDictionary, SerializableArtifact { @Override public int hashCode() { int[] keyHashes = new int[dictionary.size()]; int[] valueHashes = new int[dictionary.size()]; int i = 0; for (String word : this) { keyHashes[i] = word.hashCode(); valueHashes[i] = Arrays.hashCode(getTags(word)); i++; } Arrays.sort(keyHashes); Arrays.sort(valueHashes); return Objects.hash(Arrays.hashCode(keyHashes), Arrays.hashCode(valueHashes)); } POSDictionary();  POSDictionary(boolean caseSensitive); }
POSDictionary implements Iterable<String>, MutableTagDictionary, SerializableArtifact { @Override public int hashCode() { int[] keyHashes = new int[dictionary.size()]; int[] valueHashes = new int[dictionary.size()]; int i = 0; for (String word : this) { keyHashes[i] = word.hashCode(); valueHashes[i] = Arrays.hashCode(getTags(word)); i++; } Arrays.sort(keyHashes); Arrays.sort(valueHashes); return Objects.hash(Arrays.hashCode(keyHashes), Arrays.hashCode(valueHashes)); } POSDictionary();  POSDictionary(boolean caseSensitive); String[] getTags(String word); Iterator<String> iterator(); void serialize(OutputStream out); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); static POSDictionary create(InputStream in); String[] put(String word, String... tags); boolean isCaseSensitive(); @Override Class<?> getArtifactSerializerClass(); }
POSDictionary implements Iterable<String>, MutableTagDictionary, SerializableArtifact { @Override public int hashCode() { int[] keyHashes = new int[dictionary.size()]; int[] valueHashes = new int[dictionary.size()]; int i = 0; for (String word : this) { keyHashes[i] = word.hashCode(); valueHashes[i] = Arrays.hashCode(getTags(word)); i++; } Arrays.sort(keyHashes); Arrays.sort(valueHashes); return Objects.hash(Arrays.hashCode(keyHashes), Arrays.hashCode(valueHashes)); } POSDictionary();  POSDictionary(boolean caseSensitive); String[] getTags(String word); Iterator<String> iterator(); void serialize(OutputStream out); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); static POSDictionary create(InputStream in); String[] put(String word, String... tags); boolean isCaseSensitive(); @Override Class<?> getArtifactSerializerClass();  }