@MiniGuavaSpecific // miniguava: Originally testsForRemoveAllAndRetainAll private static Test testsForRemoveAll() { return ListTestSuiteBuilder.using(new TestStringListGenerator() { @Override public List<String> create(final String[] elements) { final List<String> delegate = newArrayList(elements); return new ForwardingList<String>() { @Override protected List<String> delegate() { return delegate; } @Override public boolean removeAll(Collection<?> c) { return Iterators.removeAll(iterator(), c); } }; } }) .named("ArrayList with Iterators.removeAll") .withFeatures( ListFeature.GENERAL_PURPOSE, CollectionFeature.ALLOWS_NULL_VALUES, CollectionSize.ANY) .createTestSuite(); }
@Override public List<E> subList(int fromIndex, int toIndex) { // Using ForwardingList so removeAll(null) and retainAll(null) throw a NPE final List<E> delegate = super.subList(fromIndex, toIndex); return new ForwardingList<E>() { @Override protected List<E> delegate() { return delegate; } }; }