Update HashAssociation.java and HashMultiAssociation.java

This commit is contained in:
Andrea Cavalli 2020-11-11 00:25:53 +01:00
parent 9d30be133e
commit f1ca9c7ef8
2 changed files with 2 additions and 2 deletions

View File

@ -45,7 +45,7 @@ public class HashAssociation<T, U> implements Association<T, U> {
}
}
if (!associations.computeIfAbsent(src, s -> new ObjectOpenHashSet<>(0)).add(dest)) {
if (!associations.computeIfAbsent(src, s -> new ObjectOpenHashSet<>(1)).add(dest)) {
throw new IllegalStateException("Association was partially linked");
}
return true;

View File

@ -64,7 +64,7 @@ public class HashMultiAssociation<T, U> implements MultiAssociation<T, U> {
@Override
public boolean link(T src, U dest) {
return associations.computeIfAbsent(src, s -> new ObjectOpenHashSet<>()).add(dest);
return associations.computeIfAbsent(src, s -> new ObjectOpenHashSet<>(1)).add(dest);
}
@Override