Add java.util Java 8 APIs for Collection, Arrays, Lists and Queues.

This change does not include stream and spliterator support.

Change-Id: If2ea891b1f6575fa7bf2999f3d3af10745f468e3
diff --git a/user/super/com/google/gwt/emul/java/util/ArrayList.java b/user/super/com/google/gwt/emul/java/util/ArrayList.java
index 6268efb..6cca168 100644
--- a/user/super/com/google/gwt/emul/java/util/ArrayList.java
+++ b/user/super/com/google/gwt/emul/java/util/ArrayList.java
@@ -18,18 +18,22 @@
 import static javaemul.internal.InternalPreconditions.checkArgument;
 import static javaemul.internal.InternalPreconditions.checkElement;
 import static javaemul.internal.InternalPreconditions.checkElementIndex;
+import static javaemul.internal.InternalPreconditions.checkNotNull;
 import static javaemul.internal.InternalPreconditions.checkPositionIndex;
 import static javaemul.internal.InternalPreconditions.checkPositionIndexes;
 import static javaemul.internal.InternalPreconditions.checkState;
 
 import java.io.Serializable;
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+import java.util.function.UnaryOperator;
 
 import javaemul.internal.ArrayHelper;
 
 /**
- * Resizeable array implementation of the List interface. <a
- * href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/ArrayList.html">[Sun
- * docs]</a>
+ * Resizeable array implementation of the List interface.
+ * See <a href="https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html">
+ * the official Java API doc</a> for details.
  *
  * <p>
  * This implementation differs from JDK 1.5 <code>ArrayList</code> in terms of
@@ -165,6 +169,14 @@
   }
 
   @Override
+  public void forEach(Consumer<? super E> consumer) {
+    checkNotNull(consumer);
+    for (E e : array) {
+      consumer.accept(e);
+    }
+  }
+
+  @Override
   public boolean isEmpty() {
     return array.length == 0;
   }
@@ -192,6 +204,36 @@
   }
 
   @Override
+  public boolean removeIf(Predicate<? super E> filter) {
+    checkNotNull(filter);
+    int length = array.length;
+    if (length == 0) {
+      return false;
+    }
+    E[] newArray = ArrayHelper.createFrom(array, length);
+    int i = 0;
+    for (E e : array) {
+      if (!filter.test(e)) {
+        newArray[i++] = e;
+      }
+    }
+    if (i == length) {
+      return false;
+    }
+    ArrayHelper.setLength(newArray, i);
+    array = newArray;
+    return true;
+  }
+
+  @Override
+  public void replaceAll(UnaryOperator<E> operator) {
+    checkNotNull(operator);
+    for (int i = 0; i < array.length; i++) {
+      array[i] = operator.apply(array[i]);
+    }
+  }
+
+  @Override
   public E set(int index, E o) {
     E previous = get(index);
     array[index] = o;
@@ -204,6 +246,11 @@
   }
 
   @Override
+  public void sort(Comparator<? super E> c) {
+    Arrays.sort(array, 0, array.length, c);
+  }
+
+  @Override
   public Object[] toArray() {
     return ArrayHelper.clone(array, 0, array.length);
   }
diff --git a/user/super/com/google/gwt/emul/java/util/Arrays.java b/user/super/com/google/gwt/emul/java/util/Arrays.java
index 374a557..aef8ac0 100644
--- a/user/super/com/google/gwt/emul/java/util/Arrays.java
+++ b/user/super/com/google/gwt/emul/java/util/Arrays.java
@@ -25,14 +25,16 @@
 import static javaemul.internal.InternalPreconditions.checkPositionIndexes;
 
 import java.io.Serializable;
+import java.util.function.Consumer;
+import java.util.function.UnaryOperator;
 
 import javaemul.internal.ArrayHelper;
 import javaemul.internal.LongCompareHolder;
 
 /**
- * Utility methods related to native arrays. <a
- * href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Arrays.html">[Sun
- * docs]</a>
+ * Utility methods related to native arrays.
+ * See <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Arrays.html">
+ * the official Java API doc</a> for details.
  */
 public class Arrays {
 
@@ -56,12 +58,28 @@
     }
 
     @Override
+    public void forEach(Consumer<? super E> consumer) {
+      checkNotNull(consumer);
+      for (E e : array) {
+        consumer.accept(e);
+      }
+    }
+
+    @Override
     public E get(int index) {
       checkElementIndex(index, size());
       return array[index];
     }
 
     @Override
+    public void replaceAll(UnaryOperator<E> operator) {
+      checkNotNull(operator);
+      for (int i = 0; i < array.length; i++) {
+        array[i] = operator.apply(array[i]);
+      }
+    }
+
+    @Override
     public E set(int index, E value) {
       E was = get(index);
       array[index] = value;
@@ -74,6 +92,11 @@
     }
 
     @Override
+    public void sort(Comparator<? super E> c) {
+      Arrays.sort(array, 0, array.length, c);
+    }
+
+    @Override
     public Object[] toArray() {
       return toArray(new Object[array.length]);
     }
diff --git a/user/super/com/google/gwt/emul/java/util/Collection.java b/user/super/com/google/gwt/emul/java/util/Collection.java
index 45b4b37..379be6d 100644
--- a/user/super/com/google/gwt/emul/java/util/Collection.java
+++ b/user/super/com/google/gwt/emul/java/util/Collection.java
@@ -15,10 +15,14 @@
  */
 package java.util;
 
+import static javaemul.internal.InternalPreconditions.checkNotNull;
+
+import java.util.function.Predicate;
+
 /**
- * General-purpose interface for storing collections of objects. <a
- * href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html">[Sun
- * docs]</a>
+ * General-purpose interface for storing collections of objects.
+ * See <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html">
+ * the official Java API doc</a> for details.
  *
  * @param <E> element type
  */
@@ -49,6 +53,18 @@
 
   boolean removeAll(Collection<?> c);
 
+  default boolean removeIf(Predicate<? super E> filter) {
+    checkNotNull(filter);
+    boolean removed = false;
+    for (Iterator<E> it = iterator(); it.hasNext();) {
+      if (filter.test(it.next())) {
+        it.remove();
+        removed = true;
+      }
+    }
+    return removed;
+  }
+
   boolean retainAll(Collection<?> c);
 
   int size();
diff --git a/user/super/com/google/gwt/emul/java/util/Collections.java b/user/super/com/google/gwt/emul/java/util/Collections.java
index 4347f66..a2d9276 100644
--- a/user/super/com/google/gwt/emul/java/util/Collections.java
+++ b/user/super/com/google/gwt/emul/java/util/Collections.java
@@ -23,9 +23,9 @@
 import java.io.Serializable;
 
 /**
- * Utility methods that operate on collections. <a
- * href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collections.html">[Sun
- * docs]</a>
+ * Utility methods that operate on collections.
+ * See <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Collections.html">
+ * the official Java API doc</a> for details.
  */
 public class Collections {
 
@@ -1276,14 +1276,11 @@
   }
 
   public static <T> void sort(List<T> target) {
-    sort(target, null);
+    target.sort(null);
   }
 
-  @SuppressWarnings("unchecked")
   public static <T> void sort(List<T> target, Comparator<? super T> c) {
-    Object[] x = target.toArray();
-    Arrays.sort(x, (Comparator<Object>) c);
-    replaceContents(target, x);
+    target.sort(c);
   }
 
   public static void swap(List<?> list, int i, int j) {
@@ -1344,22 +1341,6 @@
     return hashCode;
   }
 
-  /**
-   * Replace contents of a list from an array.
-   *
-   * @param <T> element type
-   * @param target list to replace contents from an array
-   * @param x an Object array which can contain only T instances
-   */
-  @SuppressWarnings("unchecked")
-  private static <T> void replaceContents(List<T> target, Object[] x) {
-    int size = target.size();
-    assert (x.length == size);
-    for (int i = 0; i < size; i++) {
-      target.set(i, (T) x[i]);
-    }
-  }
-
   private static <T> void swapImpl(List<T> list, int i, int j) {
     T t = list.get(i);
     list.set(i, list.get(j));
diff --git a/user/super/com/google/gwt/emul/java/util/List.java b/user/super/com/google/gwt/emul/java/util/List.java
index b6bd629..794515c 100644
--- a/user/super/com/google/gwt/emul/java/util/List.java
+++ b/user/super/com/google/gwt/emul/java/util/List.java
@@ -15,9 +15,14 @@
  */
 package java.util;
 
+import static javaemul.internal.InternalPreconditions.checkNotNull;
+
+import java.util.function.UnaryOperator;
+
 /**
- * Represents a sequence of objects. <a
- * href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/List.html">[Sun docs]</a>
+ * Represents a sequence of objects.
+ * See <a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html">
+ * the official Java API doc</a> for details.
  *
  * @param <E> element type
  */
@@ -72,6 +77,13 @@
   @Override
   boolean removeAll(Collection<?> c);
 
+  default void replaceAll(UnaryOperator<E> operator) {
+    checkNotNull(operator);
+    for (int i = 0, size = size(); i < size; i++) {
+      set(i, operator.apply(get(i)));
+    }
+  }
+
   @Override
   boolean retainAll(Collection<?> c);
 
@@ -80,6 +92,15 @@
   @Override
   int size();
 
+  @SuppressWarnings("unchecked")
+  default void sort(Comparator<? super E> c) {
+    Object[] a = toArray();
+    Arrays.sort(a, (Comparator<Object>) c);
+    for (int i = 0; i < a.length; i++) {
+      set(i, (E) a[i]);
+    }
+  }
+
   @Override
   default Spliterator<E> spliterator() {
     return Spliterators.spliterator(this, Spliterator.ORDERED);
diff --git a/user/super/com/google/gwt/emul/java/util/PriorityQueue.java b/user/super/com/google/gwt/emul/java/util/PriorityQueue.java
index 54eb4aa..aa53418 100644
--- a/user/super/com/google/gwt/emul/java/util/PriorityQueue.java
+++ b/user/super/com/google/gwt/emul/java/util/PriorityQueue.java
@@ -20,14 +20,17 @@
 import static javaemul.internal.InternalPreconditions.checkNotNull;
 
 /**
- * An unbounded priority queue based on a priority heap. <a
- * href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/PriorityQueue.html">[Sun
- * docs]</a>
- * 
+ * An unbounded priority queue based on a priority heap.
+ * See <a href="https://docs.oracle.com/javase/8/docs/api/java/util/PriorityQueue.html">
+ * the official Java API doc</a> for details.
+ * A priority queue does not permit {@code null} elements.
+ *
  * @param <E> element type.
  */
 public class PriorityQueue<E> extends AbstractQueue<E> {
 
+  private static final int DEFAULT_INITIAL_CAPACITY = 11;
+
   private static int getLeftChild(int node) {
     return 2 * node + 1;
   }
@@ -54,7 +57,7 @@
   private ArrayList<E> heap;
 
   public PriorityQueue() {
-    this(11);
+    this(DEFAULT_INITIAL_CAPACITY);
   }
 
   public PriorityQueue(Collection<? extends E> c) {
@@ -74,6 +77,10 @@
     this.cmp = cmp;
   }
 
+  public PriorityQueue(Comparator<? super E> comparator) {
+    this(DEFAULT_INITIAL_CAPACITY, comparator);
+  }
+
   @SuppressWarnings("unchecked")
   public PriorityQueue(PriorityQueue<? extends E> c) {
     // TODO(jat): better solution
diff --git a/user/super/com/google/gwt/emul/java/util/Vector.java b/user/super/com/google/gwt/emul/java/util/Vector.java
index 79f8f51..5d510bf 100644
--- a/user/super/com/google/gwt/emul/java/util/Vector.java
+++ b/user/super/com/google/gwt/emul/java/util/Vector.java
@@ -18,12 +18,15 @@
 import static javaemul.internal.InternalPreconditions.checkElement;
 
 import java.io.Serializable;
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+import java.util.function.UnaryOperator;
 
 /**
  * To keep performance characteristics in line with Java community expectations,
- * <code>Vector</code> is a wrapper around <code>ArrayList</code>. <a
- * href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Vector.html">[Sun
- * docs]</a>
+ * <code>Vector</code> is a wrapper around <code>ArrayList</code>.
+ * See <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Vector.html">
+ * the official Java API doc</a> for details.
  *
  * @param <E> element type.
  */
@@ -135,6 +138,11 @@
   }
 
   @Override
+  public void forEach(Consumer<? super E> consumer) {
+    arrayList.forEach(consumer);
+  }
+
+  @Override
   public E get(int index) {
     checkArrayElementIndex(index, size());
     return arrayList.get(index);
@@ -203,6 +211,16 @@
   }
 
   @Override
+  public boolean removeIf(Predicate<? super E> filter) {
+    return arrayList.removeIf(filter);
+  }
+
+  @Override
+  public void replaceAll(UnaryOperator<E> operator) {
+    arrayList.replaceAll(operator);
+  }
+
+  @Override
   public E set(int index, E elem) {
     checkArrayElementIndex(index, size());
     return arrayList.set(index, elem);
@@ -223,6 +241,11 @@
   }
 
   @Override
+  public void sort(Comparator<? super E> c) {
+    arrayList.sort(c);
+  }
+
+  @Override
   public List<E> subList(int fromIndex, int toIndex) {
     return arrayList.subList(fromIndex, toIndex);
   }
diff --git a/user/test/com/google/gwt/emultest/EmulJava8Suite.java b/user/test/com/google/gwt/emultest/EmulJava8Suite.java
index 0748378..ae851bc 100644
--- a/user/test/com/google/gwt/emultest/EmulJava8Suite.java
+++ b/user/test/com/google/gwt/emultest/EmulJava8Suite.java
@@ -16,12 +16,15 @@
 package com.google.gwt.emultest;
 
 import com.google.gwt.emultest.java8.math.BigIntegerConvertTest;
+import com.google.gwt.emultest.java8.util.ArrayListTest;
 import com.google.gwt.emultest.java8.util.ComparatorTest;
 import com.google.gwt.emultest.java8.util.DoubleSummaryStatisticsTest;
 import com.google.gwt.emultest.java8.util.HashMapTest;
 import com.google.gwt.emultest.java8.util.IdentityHashMapTest;
 import com.google.gwt.emultest.java8.util.IntSummaryStatisticsTest;
 import com.google.gwt.emultest.java8.util.LinkedHashMapTest;
+import com.google.gwt.emultest.java8.util.LinkedListTest;
+import com.google.gwt.emultest.java8.util.ListTest;
 import com.google.gwt.emultest.java8.util.LongSummaryStatisticsTest;
 import com.google.gwt.emultest.java8.util.MapEntryTest;
 import com.google.gwt.emultest.java8.util.MapTest;
@@ -33,6 +36,7 @@
 import com.google.gwt.emultest.java8.util.SpliteratorsTest;
 import com.google.gwt.emultest.java8.util.StringJoinerTest;
 import com.google.gwt.emultest.java8.util.TreeMapTest;
+import com.google.gwt.emultest.java8.util.VectorTest;
 import com.google.gwt.junit.tools.GWTTestSuite;
 
 import junit.framework.Test;
@@ -49,6 +53,10 @@
     suite.addTestSuite(BigIntegerConvertTest.class);
 
     //-- java.util
+    suite.addTestSuite(ArrayListTest.class);
+    suite.addTestSuite(LinkedListTest.class);
+    suite.addTestSuite(ListTest.class);
+    suite.addTestSuite(VectorTest.class);
     suite.addTestSuite(ComparatorTest.class);
     suite.addTestSuite(MapTest.class);
     suite.addTestSuite(MapEntryTest.class);
diff --git a/user/test/com/google/gwt/emultest/java/util/ArrayListTest.java b/user/test/com/google/gwt/emultest/java/util/ArrayListTest.java
index 48d5177..369f30e 100644
--- a/user/test/com/google/gwt/emultest/java/util/ArrayListTest.java
+++ b/user/test/com/google/gwt/emultest/java/util/ArrayListTest.java
@@ -15,8 +15,11 @@
  */
 package com.google.gwt.emultest.java.util;
 
+import static java.util.Arrays.asList;
+
 import java.util.AbstractList;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.ListIterator;
 
@@ -126,6 +129,20 @@
     assertEquals(0, l.size());
   }
 
+  public void testSort() {
+    ArrayList<String> list = new ArrayList<>();
+    list.sort(null);
+
+    Collections.addAll(list, "b", "a", "c");
+    list.sort(null);
+    assertEquals(asList("a", "b", "c"), list);
+
+    list = new ArrayList<>();
+    Collections.addAll(list, "b", "a", "c");
+    list.sort(Collections.reverseOrder());
+    assertEquals(asList("c", "b", "a"), list);
+  }
+
   @Override
   protected List makeEmptyList() {
     return new ArrayList();
diff --git a/user/test/com/google/gwt/emultest/java8/util/AbstractJava8ListTest.java b/user/test/com/google/gwt/emultest/java8/util/AbstractJava8ListTest.java
new file mode 100644
index 0000000..b686142
--- /dev/null
+++ b/user/test/com/google/gwt/emultest/java8/util/AbstractJava8ListTest.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.emultest.java8.util;
+
+import static java.util.Arrays.asList;
+
+import com.google.gwt.emultest.java.util.EmulTestBase;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.function.Predicate;
+import java.util.function.UnaryOperator;
+
+/**
+ * Tests for java.util.List implementing classes Java 8 API emulation.
+ */
+abstract class AbstractJava8ListTest extends EmulTestBase {
+
+  public void testForeach() {
+    List<String> list = createEmptyList();
+
+    try {
+      list.forEach(null);
+      fail();
+    } catch (NullPointerException expected) {
+    }
+
+    list.forEach(e -> fail());
+
+    list = createEmptyList();
+    list.addAll(asList("a", "b", "c"));
+    ArrayList<String> visited = new ArrayList<>();
+    list.forEach(visited::add);
+    assertEquals(asList("a", "b", "c"), visited);
+  }
+
+  public void testRemoveIf() {
+    List<String> list = createEmptyList();
+
+    try {
+      list.removeIf(null);
+      fail();
+    } catch (NullPointerException expected) {
+    }
+
+    list = createEmptyList();
+    list.addAll(asList("a", "b", "c"));
+    assertFalse(list.removeIf(e -> false));
+    assertEquals(asList("a", "b", "c"), list);
+
+    assertFalse(list.removeIf(Predicate.isEqual("")));
+    assertEquals(asList("a", "b", "c"), list);
+
+    assertTrue(list.removeIf(Predicate.isEqual("b")));
+    assertEquals(asList("a", "c"), list);
+
+    list.add("d");
+    assertTrue(list.removeIf(e -> e.equals("a") || e.equals("c")));
+    assertEquals(asList("d"), list);
+
+    assertTrue(list.removeIf(Predicate.isEqual("d")));
+    assertFalse(list.removeIf(Predicate.isEqual("d")));
+    assertTrue(list.isEmpty());
+
+    Collections.addAll(list, "a", "b");
+    assertFalse(list.removeIf(Objects::isNull));
+    assertEquals(asList("a", "b"), list);
+  }
+
+  public void testReplaceAll() {
+    ArrayList<String> list = new ArrayList<>();
+
+    try {
+      list.replaceAll(null);
+      fail();
+    } catch (NullPointerException expected) {
+    }
+
+    list.replaceAll(UnaryOperator.identity());
+    assertTrue(list.isEmpty());
+
+    Collections.addAll(list, "a", "b");
+    list.replaceAll(UnaryOperator.identity());
+    assertEquals(asList("a", "b"), list);
+
+    list.replaceAll(e -> e + "0");
+    assertEquals(asList("a0", "b0"), list);
+
+    list.add("c");
+    list.replaceAll(e -> e + "1");
+    assertEquals(asList("a01", "b01", "c1"), list);
+  }
+
+  protected abstract List<String> createEmptyList();
+
+}
diff --git a/user/test/com/google/gwt/emultest/java8/util/ArrayListTest.java b/user/test/com/google/gwt/emultest/java8/util/ArrayListTest.java
new file mode 100644
index 0000000..6ad583b
--- /dev/null
+++ b/user/test/com/google/gwt/emultest/java8/util/ArrayListTest.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.emultest.java8.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Java 8 methods to test in java.util.ArrayList.
+ */
+public class ArrayListTest extends AbstractJava8ListTest {
+  @Override
+  protected List<String> createEmptyList() {
+    return new ArrayList<>();
+  }
+}
diff --git a/user/test/com/google/gwt/emultest/java8/util/LinkedListTest.java b/user/test/com/google/gwt/emultest/java8/util/LinkedListTest.java
new file mode 100644
index 0000000..4d888bd
--- /dev/null
+++ b/user/test/com/google/gwt/emultest/java8/util/LinkedListTest.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.emultest.java8.util;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Java 8 methods to test in java.util.LinkedList.
+ */
+public class LinkedListTest extends AbstractJava8ListTest {
+  @Override
+  protected List<String> createEmptyList() {
+    return new LinkedList<>();
+  }
+}
diff --git a/user/test/com/google/gwt/emultest/java8/util/ListTest.java b/user/test/com/google/gwt/emultest/java8/util/ListTest.java
new file mode 100644
index 0000000..a2a06e9
--- /dev/null
+++ b/user/test/com/google/gwt/emultest/java8/util/ListTest.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.emultest.java8.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+/**
+ * Tests for java.util.List Java 8 API emulation.
+ */
+public class ListTest extends AbstractJava8ListTest {
+  @Override
+  protected List<String> createEmptyList() {
+    return new TestList<>();
+  }
+
+  private static class TestList<T> implements List<T> {
+    private final List<T> container = new ArrayList<>();
+
+    @Override
+    public int size() {
+      return container.size();
+    }
+
+    @Override
+    public boolean isEmpty() {
+      return container.isEmpty();
+    }
+
+    @Override
+    public boolean contains(Object o) {
+      return container.contains(o);
+    }
+
+    @Override
+    public Iterator<T> iterator() {
+      return container.iterator();
+    }
+
+    @Override
+    public Object[] toArray() {
+      return container.toArray();
+    }
+
+    @Override
+    public <E> E[] toArray(E[] a) {
+      return container.toArray(a);
+    }
+
+    @Override
+    public boolean add(T t) {
+      return container.add(t);
+    }
+
+    @Override
+    public boolean remove(Object o) {
+      return container.remove(o);
+    }
+
+    @Override
+    public boolean containsAll(Collection<?> c) {
+      return container.containsAll(c);
+    }
+
+    @Override
+    public boolean addAll(Collection<? extends T> c) {
+      return container.addAll(c);
+    }
+
+    @Override
+    public boolean addAll(int index, Collection<? extends T> c) {
+      return container.addAll(index, c);
+    }
+
+    @Override
+    public boolean removeAll(Collection<?> c) {
+      return container.removeAll(c);
+    }
+
+    @Override
+    public boolean retainAll(Collection<?> c) {
+      return container.retainAll(c);
+    }
+
+    @Override
+    public void clear() {
+      container.clear();
+    }
+
+    @Override
+    public T get(int index) {
+      return container.get(index);
+    }
+
+    @Override
+    public T set(int index, T element) {
+      return container.set(index, element);
+    }
+
+    @Override
+    public void add(int index, T element) {
+      container.add(index, element);
+    }
+
+    @Override
+    public T remove(int index) {
+      return container.remove(index);
+    }
+
+    @Override
+    public int indexOf(Object o) {
+      return container.indexOf(o);
+    }
+
+    @Override
+    public int lastIndexOf(Object o) {
+      return container.lastIndexOf(o);
+    }
+
+    @Override
+    public ListIterator<T> listIterator() {
+      return container.listIterator();
+    }
+
+    @Override
+    public ListIterator<T> listIterator(int index) {
+      return container.listIterator(index);
+    }
+
+    @Override
+    public List<T> subList(int fromIndex, int toIndex) {
+      return container.subList(fromIndex, toIndex);
+    }
+  }
+}
diff --git a/user/test/com/google/gwt/emultest/java8/util/VectorTest.java b/user/test/com/google/gwt/emultest/java8/util/VectorTest.java
new file mode 100644
index 0000000..229d597
--- /dev/null
+++ b/user/test/com/google/gwt/emultest/java8/util/VectorTest.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.emultest.java8.util;
+
+import java.util.List;
+import java.util.Vector;
+
+/**
+ * Java 8 methods to test in java.util.Vector.
+ */
+public class VectorTest extends AbstractJava8ListTest {
+  @Override
+  protected List<String> createEmptyList() {
+    return new Vector<>();
+  }
+}