Skip to content

Commit

Permalink
Adding test and implementation of 'equals' on hash collision nodes in…
Browse files Browse the repository at this point in the history
… multi-map.

Refers to issue #16.
  • Loading branch information
msteindorfer committed Jun 30, 2017
1 parent 649a816 commit 25c0120
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 11 deletions.
4 changes: 2 additions & 2 deletions capsule-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<parent>
<groupId>io.usethesource</groupId>
<artifactId>capsule-pom-parent</artifactId>
<version>0.3.0</version>
<version>0.3.2-SNAPSHOT</version>
</parent>

<groupId>io.usethesource</groupId>
<artifactId>capsule</artifactId>
<version>0.3.0</version>
<version>0.3.2-SNAPSHOT</version>
<packaging>jar</packaging>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2640,6 +2640,34 @@ PersistentTrieSet.AbstractSetNode<K> toSetNode(AtomicReference<Thread> mutator)
// (K[]) collisionContent.stream().map(Map.Entry::getKey).toArray());
// }

@Override
public boolean equals(final Object other) {
if (null == other) {
return false;
}
if (this == other) {
return true;
}
if (getClass() != other.getClass()) {
return false;
}

HashCollisionNode<?, ?> that = (HashCollisionNode<?, ?>) other;

if (hash != that.hash) {
return false;
}

if (collisionContent.size() != that.collisionContent.size()) {
return false;
}

/*
* Linear scan for each payload entry due to arbitrary element order.
*/
return collisionContent.stream().allMatch(that.collisionContent::contains);
}

@Override
byte sizePredicate() {
return SIZE_MORE_THAN_ONE;
Expand Down
6 changes: 3 additions & 3 deletions capsule-experimental/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<parent>
<groupId>io.usethesource</groupId>
<artifactId>capsule-pom-parent</artifactId>
<version>0.3.0</version>
<version>0.3.2-SNAPSHOT</version>
</parent>

<groupId>io.usethesource</groupId>
<artifactId>capsule-experimental</artifactId>
<version>0.3.0</version>
<version>0.3.2-SNAPSHOT</version>
<packaging>jar</packaging>

<properties>
Expand All @@ -20,7 +20,7 @@
<dependency>
<groupId>io.usethesource</groupId>
<artifactId>capsule</artifactId>
<version>0.3.0</version>
<version>0.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

Expand Down
8 changes: 4 additions & 4 deletions capsule-veritas/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<parent>
<groupId>io.usethesource</groupId>
<artifactId>capsule-pom-parent</artifactId>
<version>0.3.0</version>
<version>0.3.2-SNAPSHOT</version>
</parent>

<groupId>io.usethesource</groupId>
<artifactId>capsule-veritas</artifactId>
<version>0.3.0</version>
<version>0.3.2-SNAPSHOT</version>
<packaging>jar</packaging>

<properties>
Expand Down Expand Up @@ -42,12 +42,12 @@
<dependency>
<groupId>io.usethesource</groupId>
<artifactId>capsule</artifactId>
<version>0.3.0</version>
<version>0.3.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.usethesource</groupId>
<artifactId>capsule-experimental</artifactId>
<version>0.3.0</version>
<version>0.3.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.pholser</groupId>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

<groupId>io.usethesource</groupId>
<artifactId>capsule-pom-parent</artifactId>
<version>0.3.0</version>
<version>0.3.2-SNAPSHOT</version>
<packaging>pom</packaging>

<scm>
<developerConnection>scm:git:https://github.com/usethesource/capsule.git</developerConnection>
<tag>v0.3.0</tag>
<tag>HEAD</tag>
</scm>

<modules>
Expand Down

0 comments on commit 25c0120

Please sign in to comment.