Java 类com.google.common.collect.ForwardingList 实例源码

项目:miniguava    文件:IteratorsTest.java   
@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();
}
项目:uzaygezen    文件:LinkedNodeList.java   
@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;
    }
  };
}