Skip to content

Commit

Permalink
LeafList.hashCode() fixed #1818
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslansennov committed Jan 16, 2017
1 parent be0b078 commit cfa3de4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ public LeafNode<K, V> getNext() {

@Override
public int hashCode() {
return Objects.hash(hash, value, tail);
return Objects.hash(hash, value) + tail.hashCode();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public void shouldRecognizeNonEqualityOfHAMTOfDifferentSize() {
public void shouldEqualsIgnoreOrder() {
HashArrayMappedTrie<String, Integer> map = HashArrayMappedTrie.<String, Integer> empty().put("Aa", 1).put("BB", 2);
HashArrayMappedTrie<String, Integer> map2 = HashArrayMappedTrie.<String, Integer> empty().put("BB", 2).put("Aa", 1);
assertThat(map.hashCode()).isEqualTo(map2.hashCode());
assertThat(map).isEqualTo(map2);
}

Expand Down

0 comments on commit cfa3de4

Please sign in to comment.