Java Code Examples for

The following are top voted examples for showing how to use These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: miniguava   File:   Source Code and License 6 votes vote down vote up
@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")
Example 2
Project: uzaygezen   File:   Source Code and License 5 votes vote down vote up
@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;