Fixes a bug in Collections.fill(), which never could have worked.  Adds a test for it.

Patch by: scottb, tobyr (pair prog)


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@1728 8db76d5a-ed1c-0410-87a9-c151d255dfc7
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 9659803..c9f778d 100644
--- a/user/super/com/google/gwt/emul/java/util/Collections.java
+++ b/user/super/com/google/gwt/emul/java/util/Collections.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Google Inc.
+ * Copyright 2008 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
@@ -260,6 +260,7 @@
 
   public static <T> void fill(List<? super T> list, T obj) {
     for (ListIterator<? super T> it = list.listIterator(); it.hasNext();) {
+      it.next();
       it.set(obj);
     }
   }
diff --git a/user/test/com/google/gwt/emultest/java/util/CollectionsTest.java b/user/test/com/google/gwt/emultest/java/util/CollectionsTest.java
index 45cb42d..51898e7 100644
--- a/user/test/com/google/gwt/emultest/java/util/CollectionsTest.java
+++ b/user/test/com/google/gwt/emultest/java/util/CollectionsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Google Inc.
+ * Copyright 2008 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
@@ -111,6 +111,16 @@
     assertEquals(3, ret);
   }
 
+  public void testFill() {
+    List a = createSortedList();
+    Collections.fill(a, null);
+    assertEquals(new Object[a.size()], a);
+
+    List b = createRandomList();
+    Collections.fill(b, null);
+    assertEquals(new Object[b.size()], b);
+  }
+
   public void testReverse() {
     List a = createSortedList();
     Collections.reverse(a);