test/java/util/Collection/testlibrary/CollectionSupplier.java
Print this page
rev 7994 : 8024291: Rename Collection.removeIf(Predicate) back to removeAll(Predicate)
Reviewed-by: duke
*** 240,280 ****
final Collection<Integer> regularWithSlack = defaultConstructor.newInstance();
for (int i=0; i < (2 * size); i++) {
regularWithSlack.add(i);
}
! assertTrue(regularWithSlack.removeIf((x) -> {return x >= size;}));
collections.add(new TestCase("regularWithSlack",
className,
copyConstructor.newInstance(regularWithSlack),
regularWithSlack));
final Collection<Integer> reverseWithSlack = defaultConstructor.newInstance();
for (int i=2 * size; i >= 0; i--) {
reverseWithSlack.add(i);
}
! assertTrue(reverseWithSlack.removeIf((x) -> {return x < size;}));
collections.add(new TestCase("reverseWithSlack",
className,
copyConstructor.newInstance(reverseWithSlack),
reverseWithSlack));
final Collection<Integer> oddsWithSlack = defaultConstructor.newInstance();
for (int i = 0; i < 2 * size; i++) {
oddsWithSlack.add((i * 2) + 1);
}
! assertTrue(oddsWithSlack.removeIf((x) -> {return x >= size;}));
collections.add(new TestCase("oddsWithSlack",
className,
copyConstructor.newInstance(oddsWithSlack),
oddsWithSlack));
final Collection<Integer> evensWithSlack = defaultConstructor.newInstance();
for (int i = 0; i < 2 * size; i++) {
evensWithSlack.add(i * 2);
}
! assertTrue(evensWithSlack.removeIf((x) -> {return x >= size;}));
collections.add(new TestCase("evensWithSlack",
className,
copyConstructor.newInstance(evensWithSlack),
evensWithSlack));
--- 240,280 ----
final Collection<Integer> regularWithSlack = defaultConstructor.newInstance();
for (int i=0; i < (2 * size); i++) {
regularWithSlack.add(i);
}
! assertTrue(regularWithSlack.removeAll(x -> x >= size));
collections.add(new TestCase("regularWithSlack",
className,
copyConstructor.newInstance(regularWithSlack),
regularWithSlack));
final Collection<Integer> reverseWithSlack = defaultConstructor.newInstance();
for (int i=2 * size; i >= 0; i--) {
reverseWithSlack.add(i);
}
! assertTrue(reverseWithSlack.removeAll(x -> x < size));
collections.add(new TestCase("reverseWithSlack",
className,
copyConstructor.newInstance(reverseWithSlack),
reverseWithSlack));
final Collection<Integer> oddsWithSlack = defaultConstructor.newInstance();
for (int i = 0; i < 2 * size; i++) {
oddsWithSlack.add((i * 2) + 1);
}
! assertTrue(oddsWithSlack.removeAll(x -> x >= size));
collections.add(new TestCase("oddsWithSlack",
className,
copyConstructor.newInstance(oddsWithSlack),
oddsWithSlack));
final Collection<Integer> evensWithSlack = defaultConstructor.newInstance();
for (int i = 0; i < 2 * size; i++) {
evensWithSlack.add(i * 2);
}
! assertTrue(evensWithSlack.removeAll(x -> x >= size));
collections.add(new TestCase("evensWithSlack",
className,
copyConstructor.newInstance(evensWithSlack),
evensWithSlack));
*** 288,298 ****
}
fibonacciWithSlack.add(n);
prev2 = prev1;
prev1 = n;
}
! assertTrue(fibonacciWithSlack.removeIf((x) -> {return x < 20;}));
collections.add(new TestCase("fibonacciWithSlack",
className,
copyConstructor.newInstance(fibonacciWithSlack),
fibonacciWithSlack));
--- 288,298 ----
}
fibonacciWithSlack.add(n);
prev2 = prev1;
prev1 = n;
}
! assertTrue(fibonacciWithSlack.removeAll(x -> x < 20));
collections.add(new TestCase("fibonacciWithSlack",
className,
copyConstructor.newInstance(fibonacciWithSlack),
fibonacciWithSlack));