Update HashAssociation.java and HashMultiAssociation.java
This commit is contained in:
parent
9d30be133e
commit
f1ca9c7ef8
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user