You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In using the ListSet#addAll(Collection<? extends T> c) we've run into unexpected behavior where only the first element of the collection c is added. We've encountered similar behavior in the ListSet#removeAll(Collection<?> c) method, except it seems to hang. We think both are due to a short circuit in the logical OR the methods employ.
Test class to reproduce:
classListSetTest {
privateListSet<Object> listSet;
privateObjectobjA;
privateObjectobjB;
privateObjectobjC;
privateSet<Object> testSet;
@BeforeEachvoidinit() {
listSet = newListSet<>();
objA = newObject();
objB = newObject();
objC = newObject();
testSet = newHashSet<>(Arrays.asList(objA, objB, objC));
}
@Test@Disabled("Seems to have a conditional short circuit")
voidtestAddAll() {
listSet.addAll(testSet); // only adds firstassertEquals(3, listSet.size()); // 1
}
@Test@Disabled("Loops: Seems to have a conditional short circuit")
voidtestRemoveAll() {
listSet.add(objA);
listSet.add(objB);
listSet.add(objC);
listSet.removeAll(testSet); // hangsassertEquals(0, listSet.size());
}
}
The text was updated successfully, but these errors were encountered:
In using the
ListSet#addAll(Collection<? extends T> c)
we've run into unexpected behavior where only the first element of the collectionc
is added. We've encountered similar behavior in theListSet#removeAll(Collection<?> c)
method, except it seems to hang. We think both are due to a short circuit in the logical OR the methods employ.Test class to reproduce:
The text was updated successfully, but these errors were encountered: