commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chtom...@apache.org
Subject [10/77] [abbrv] commons-collections git commit: finish generics (minus one class)
Date Tue, 11 Jul 2017 17:54:55 GMT
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/AbstractTestOrderedMapIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/AbstractTestOrderedMapIterator.java b/src/test/org/apache/commons/collections/iterators/AbstractTestOrderedMapIterator.java
index 2b47647..a099be5 100644
--- a/src/test/org/apache/commons/collections/iterators/AbstractTestOrderedMapIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/AbstractTestOrderedMapIterator.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You 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.
@@ -33,17 +33,17 @@ import org.apache.commons.collections.OrderedMapIterator;
  * Concrete subclasses must provide the list iterator to be tested.
  * They must also specify certain details of how the list iterator operates by
  * overriding the supportsXxx() methods if necessary.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public abstract class AbstractTestOrderedMapIterator extends AbstractTestMapIterator {
+public abstract class AbstractTestOrderedMapIterator<K, V> extends AbstractTestMapIterator<K, V> {
 
     /**
      * JUnit constructor.
-     * 
+     *
      * @param testName  the test class name
      */
     public AbstractTestOrderedMapIterator(String testName) {
@@ -51,14 +51,10 @@ public abstract class AbstractTestOrderedMapIterator extends AbstractTestMapIter
     }
 
     //-----------------------------------------------------------------------
-    public final OrderedMapIterator makeEmptyOrderedMapIterator() {
-        return (OrderedMapIterator) makeEmptyMapIterator();
-    }
+    public abstract OrderedMapIterator<K, V> makeEmptyIterator();
+
+    public abstract OrderedMapIterator<K, V> makeObject();
 
-    public final OrderedMapIterator makeFullOrderedMapIterator() {
-        return (OrderedMapIterator) makeFullMapIterator();
-    }
-    
     //-----------------------------------------------------------------------
     /**
      * Test that the empty list iterator contract is correct.
@@ -69,9 +65,8 @@ public abstract class AbstractTestOrderedMapIterator extends AbstractTestMapIter
         }
 
         super.testEmptyMapIterator();
-        
-        OrderedMapIterator it = makeEmptyOrderedMapIterator();
-        Map map = getMap();
+
+        OrderedMapIterator<K, V> it = makeEmptyIterator();
         assertEquals(false, it.hasPrevious());
         try {
             it.previous();
@@ -89,29 +84,29 @@ public abstract class AbstractTestOrderedMapIterator extends AbstractTestMapIter
         }
 
         super.testFullMapIterator();
-        
-        OrderedMapIterator it = makeFullOrderedMapIterator();
-        Map map = getMap();
-        
+
+        OrderedMapIterator<K, V> it = makeObject();
+        Map<K, V> map = getMap();
+
         assertEquals(true, it.hasNext());
         assertEquals(false, it.hasPrevious());
-        Set set = new HashSet();
+        Set<K> set = new HashSet<K>();
         while (it.hasNext()) {
             // getKey
-            Object key = it.next();
+            K key = it.next();
             assertSame("it.next() should equals getKey()", key, it.getKey());
             assertTrue("Key must be in map",  map.containsKey(key));
             assertTrue("Key must be unique", set.add(key));
-            
+
             // getValue
-            Object value = it.getValue();
+            V value = it.getValue();
             if (isGetStructuralModify() == false) {
                 assertSame("Value must be mapped to key", map.get(key), value);
             }
             assertTrue("Value must be in map",  map.containsValue(value));
 
             assertEquals(true, it.hasPrevious());
-            
+
             verify();
         }
         while (it.hasPrevious()) {
@@ -120,7 +115,7 @@ public abstract class AbstractTestOrderedMapIterator extends AbstractTestMapIter
             assertSame("it.previous() should equals getKey()", key, it.getKey());
             assertTrue("Key must be in map",  map.containsKey(key));
             assertTrue("Key must be unique", set.remove(key));
-            
+
             // getValue
             Object value = it.getValue();
             if (isGetStructuralModify() == false) {
@@ -129,11 +124,11 @@ public abstract class AbstractTestOrderedMapIterator extends AbstractTestMapIter
             assertTrue("Value must be in map",  map.containsValue(value));
 
             assertEquals(true, it.hasNext());
-            
+
             verify();
         }
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Test that the iterator order matches the keySet order.
@@ -143,27 +138,27 @@ public abstract class AbstractTestOrderedMapIterator extends AbstractTestMapIter
             return;
         }
 
-        OrderedMapIterator it = makeFullOrderedMapIterator();
-        Map map = getMap();
-        
-        assertEquals("keySet() not consistent", new ArrayList(map.keySet()), new ArrayList(map.keySet()));
-        
-        Iterator it2 = map.keySet().iterator();
+        OrderedMapIterator<K, V> it = makeObject();
+        Map<K, V> map = getMap();
+
+        assertEquals("keySet() not consistent", new ArrayList<K>(map.keySet()), new ArrayList<K>(map.keySet()));
+
+        Iterator<K> it2 = map.keySet().iterator();
         assertEquals(true, it.hasNext());
         assertEquals(true, it2.hasNext());
-        List list = new ArrayList();
+        List<K> list = new ArrayList<K>();
         while (it.hasNext()) {
-            Object key = it.next();
+            K key = it.next();
             assertEquals(it2.next(), key);
             list.add(key);
         }
         assertEquals(map.size(), list.size());
         while (it.hasPrevious()) {
-            Object key = it.previous();
+            K key = it.previous();
             assertEquals(list.get(list.size() - 1), key);
             list.remove(list.size() - 1);
         }
         assertEquals(0, list.size());
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/TestArrayIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestArrayIterator.java b/src/test/org/apache/commons/collections/iterators/TestArrayIterator.java
index 6307740..44a3efc 100644
--- a/src/test/org/apache/commons/collections/iterators/TestArrayIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestArrayIterator.java
@@ -34,7 +34,7 @@ import junit.framework.TestSuite;
  * @author Morgan Delagrange
  * @author Stephen Colebourne
  */
-public class TestArrayIterator extends AbstractTestIterator {
+public class TestArrayIterator<E> extends AbstractTestIterator<E> {
 
     protected String[] testArray = { "One", "Two", "Three" };
 
@@ -46,24 +46,23 @@ public class TestArrayIterator extends AbstractTestIterator {
         super(testName);
     }
 
-    public Iterator makeEmptyIterator() {
-        return new ArrayIterator(new Object[0]);
+    public ArrayIterator<E> makeEmptyIterator() {
+        return new ArrayIterator<E>(new Object[0]);
     }
 
-    public Iterator makeFullIterator() {
-        return new ArrayIterator(testArray);
+    public ArrayIterator<E> makeObject() {
+        return new ArrayIterator<E>(testArray);
     }
 
     public boolean supportsRemove() {
         return false;
     }
 
-
     public void testIterator() {
-        Iterator iter = (Iterator) makeFullIterator();
+        Iterator<E> iter = makeObject();
         for (int i = 0; i < testArray.length; i++) {
             Object testValue = testArray[i];
-            Object iterValue = iter.next();
+            E iterValue = iter.next();
 
             assertEquals("Iteration value is correct", testValue, iterValue);
         }
@@ -71,7 +70,7 @@ public class TestArrayIterator extends AbstractTestIterator {
         assertTrue("Iterator should now be empty", !iter.hasNext());
 
         try {
-            Object testValue = iter.next();
+            iter.next();
         } catch (Exception e) {
             assertTrue(
                 "NoSuchElementException must be thrown",
@@ -81,14 +80,13 @@ public class TestArrayIterator extends AbstractTestIterator {
 
     public void testNullArray() {
         try {
-            Iterator iter = new ArrayIterator(null);
-
+            new ArrayIterator<Object>(null);
             fail("Constructor should throw a NullPointerException when constructed with a null array");
         } catch (NullPointerException e) {
             // expected
         }
 
-        ArrayIterator iter = new ArrayIterator();
+        ArrayIterator<Object> iter = new ArrayIterator<Object>();
         try {
             iter.setArray(null);
 
@@ -99,7 +97,7 @@ public class TestArrayIterator extends AbstractTestIterator {
     }
     
     public void testReset() {
-        ArrayIterator it = (ArrayIterator) makeFullIterator();
+        ArrayIterator<E> it = makeObject();
         it.next();
         it.reset();
         assertEquals("One", it.next());

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/TestArrayIterator2.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestArrayIterator2.java b/src/test/org/apache/commons/collections/iterators/TestArrayIterator2.java
index c4423cf..975c37b 100644
--- a/src/test/org/apache/commons/collections/iterators/TestArrayIterator2.java
+++ b/src/test/org/apache/commons/collections/iterators/TestArrayIterator2.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You 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.
@@ -24,13 +24,13 @@ import junit.framework.TestSuite;
 
 /**
  * Tests the ArrayIterator with primitive type arrays.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Morgan Delagrange
  * @author James Strachan
  */
-public class TestArrayIterator2 extends AbstractTestIterator {
+public class TestArrayIterator2<E> extends AbstractTestIterator<E> {
 
     protected int[] testArray = { 2, 4, 6, 8 };
 
@@ -42,41 +42,32 @@ public class TestArrayIterator2 extends AbstractTestIterator {
         super(testName);
     }
 
-    public Iterator makeEmptyIterator() {
-        return new ArrayIterator(new int[0]);
+    public ArrayIterator<E> makeEmptyIterator() {
+        return new ArrayIterator<E>(new int[0]);
     }
 
-    public Iterator makeFullIterator() {
-        return new ArrayIterator(testArray);
+    public ArrayIterator<E> makeObject() {
+        return new ArrayIterator<E>(testArray);
     }
 
-    /*
-     * We use these <code>makeArrayIterator</code> factory methods instead of
-     * directly calling the constructor so as to allow subclasses
-     * (e.g. TestArrayListIterator2) to use the existing test code.
-     * 
-     * @return ArrayIterator
-     */
-    public ArrayIterator makeArrayIterator() {
-        return (ArrayIterator) makeEmptyIterator();
+    public ArrayIterator<E> makeArrayIterator(Object array) {
+        return new ArrayIterator<E>(array);
     }
-    public ArrayIterator makeArrayIterator(Object array) {
-        return new ArrayIterator(array);
-    }
-    public ArrayIterator makeArrayIterator(Object array, int index) {
-        return new ArrayIterator(array, index);
+
+    public ArrayIterator<E> makeArrayIterator(Object array, int index) {
+        return new ArrayIterator<E>(array, index);
     }
-    public ArrayIterator makeArrayIterator(Object array, int start, int end) {
-        return new ArrayIterator(array, start, end);
+
+    public ArrayIterator<E> makeArrayIterator(Object array, int start, int end) {
+        return new ArrayIterator<E>(array, start, end);
     }
 
     public boolean supportsRemove() {
         return false;
     }
 
-
     public void testIterator() {
-        Iterator iter = (Iterator) makeFullIterator();
+        Iterator<E> iter = makeObject();
         for (int i = 0; i < testArray.length; i++) {
             Integer testValue = new Integer(testArray[i]);
             Number iterValue = (Number) iter.next();
@@ -87,7 +78,7 @@ public class TestArrayIterator2 extends AbstractTestIterator {
         assertTrue("Iterator should now be empty", !iter.hasNext());
 
         try {
-            Object testValue = iter.next();
+            iter.next();
         } catch (Exception e) {
             assertTrue(
                 "NoSuchElementException must be thrown",
@@ -96,9 +87,9 @@ public class TestArrayIterator2 extends AbstractTestIterator {
     }
 
     // proves that an ArrayIterator set with the constructor has the same number of elements
-    // as an ArrayIterator set with setArray(Object) 
+    // as an ArrayIterator set with setArray(Object)
     public void testSetArray() {
-        Iterator iter1 = makeArrayIterator(testArray);
+        Iterator<E> iter1 = makeArrayIterator(testArray);
         int count1 = 0;
         while (iter1.hasNext()) {
             ++count1;
@@ -107,7 +98,7 @@ public class TestArrayIterator2 extends AbstractTestIterator {
 
         assertEquals("the count should be right using the constructor", count1, testArray.length);
 
-        ArrayIterator iter2 = makeArrayIterator();
+        ArrayIterator<E> iter2 = makeObject();
         iter2.setArray(testArray);
         int count2 = 0;
         while (iter2.hasNext()) {
@@ -119,7 +110,7 @@ public class TestArrayIterator2 extends AbstractTestIterator {
     }
 
     public void testIndexedArray() {
-        Iterator iter = makeArrayIterator(testArray, 2);
+        Iterator<E> iter = makeArrayIterator(testArray, 2);
         int count = 0;
         while (iter.hasNext()) {
             ++count;

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/TestArrayListIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestArrayListIterator.java b/src/test/org/apache/commons/collections/iterators/TestArrayListIterator.java
index a51eb21..1c70fe2 100644
--- a/src/test/org/apache/commons/collections/iterators/TestArrayListIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestArrayListIterator.java
@@ -17,7 +17,6 @@
 package org.apache.commons.collections.iterators;
 
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.ListIterator;
 import java.util.NoSuchElementException;
 
@@ -30,7 +29,7 @@ import junit.framework.TestSuite;
  * @version $Revision$ $Date$
  * @author Neil O'Toole
  */
-public class TestArrayListIterator extends TestArrayIterator {
+public class TestArrayListIterator<E> extends TestArrayIterator<E> {
 
     public TestArrayListIterator(String testName) {
         super(testName);
@@ -40,16 +39,16 @@ public class TestArrayListIterator extends TestArrayIterator {
         return new TestSuite(TestArrayListIterator.class);
     }
 
-    public Iterator makeEmptyIterator() {
-        return new ArrayListIterator(new Object[0]);
+    public ArrayListIterator<E> makeEmptyIterator() {
+        return new ArrayListIterator<E>(new Object[0]);
     }
 
-    public Iterator makeFullIterator() {
-        return new ArrayListIterator(testArray);
+    public ArrayListIterator<E> makeObject() {
+        return new ArrayListIterator<E>(testArray);
     }
 
-    public ListIterator makeArrayListIterator(Object array) {
-        return new ArrayListIterator(array);
+    public ArrayListIterator<E> makeArrayListIterator(Object array) {
+        return new ArrayListIterator<E>(array);
     }
 
     public boolean supportsRemove() {
@@ -61,7 +60,7 @@ public class TestArrayListIterator extends TestArrayIterator {
      * <code>previous()</code>.
      */
     public void testListIterator() {
-        ListIterator iter = (ListIterator) makeFullIterator();
+        ListIterator<E> iter = makeObject();
 
         // TestArrayIterator#testIterator() has already tested the iterator forward,
         //  now we need to test it in reverse
@@ -81,7 +80,7 @@ public class TestArrayListIterator extends TestArrayIterator {
         assertTrue("Iterator should now be empty", !iter.hasPrevious());
 
         try {
-            Object testValue = iter.previous();
+            iter.previous();
         } catch (Exception e) {
             assertTrue(
                 "NoSuchElementException must be thrown",
@@ -93,17 +92,18 @@ public class TestArrayListIterator extends TestArrayIterator {
     /**
      * Tests the {@link java.util.ListIterator#set} operation.
      */
+    @SuppressWarnings("unchecked")
     public void testListIteratorSet() {
         String[] testData = new String[] { "a", "b", "c" };
 
         String[] result = new String[] { "0", "1", "2" };
 
-        ListIterator iter = (ListIterator) makeArrayListIterator(testData);
+        ListIterator<E> iter = makeArrayListIterator(testData);
         int x = 0;
 
         while (iter.hasNext()) {
             iter.next();
-            iter.set(Integer.toString(x));
+            iter.set((E) Integer.toString(x));
             x++;
         }
 
@@ -113,7 +113,7 @@ public class TestArrayListIterator extends TestArrayIterator {
         iter = makeArrayListIterator(testArray);
 
         try {
-            iter.set("should fail");
+            iter.set((E) "should fail");
             fail("ListIterator#set should fail if next() or previous() have not yet been called.");
         } catch (IllegalStateException e) {
             // expected

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/TestArrayListIterator2.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestArrayListIterator2.java b/src/test/org/apache/commons/collections/iterators/TestArrayListIterator2.java
index 86efe8f..cb2ea8c 100644
--- a/src/test/org/apache/commons/collections/iterators/TestArrayListIterator2.java
+++ b/src/test/org/apache/commons/collections/iterators/TestArrayListIterator2.java
@@ -16,8 +16,6 @@
  */
 package org.apache.commons.collections.iterators;
 
-import java.util.Iterator;
-
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
@@ -27,7 +25,7 @@ import junit.framework.TestSuite;
  * @version $Revision$ $Date$
  * @author Neil O'Toole
  */
-public class TestArrayListIterator2 extends TestArrayIterator2 {
+public class TestArrayListIterator2<E> extends TestArrayIterator2<E> {
 
     public TestArrayListIterator2(String testName) {
         super(testName);
@@ -37,28 +35,24 @@ public class TestArrayListIterator2 extends TestArrayIterator2 {
         return new TestSuite(TestArrayListIterator2.class);
     }
 
-    public Iterator makeEmptyIterator() {
-        return new ArrayListIterator(new int[0]);
-    }
-
-    public Iterator makeFullIterator() {
-        return new ArrayListIterator(testArray);
+    public ArrayListIterator<E> makeEmptyIterator() {
+        return new ArrayListIterator<E>(new int[0]);
     }
 
-    public ArrayIterator makeArrayIterator() {
-        return (ArrayIterator) makeEmptyIterator();
+    public ArrayListIterator<E> makeObject() {
+        return new ArrayListIterator<E>(testArray);
     }
 
-    public ArrayIterator makeArrayIterator(Object array) {
-        return new ArrayListIterator(array);
+    public ArrayListIterator<E> makeArrayListIterator(Object array) {
+        return new ArrayListIterator<E>(array);
     }
 
-    public ArrayIterator makeArrayIterator(Object array, int index) {
-        return new ArrayListIterator(array, index);
+    public ArrayListIterator<E> makeArrayListIterator(Object array, int index) {
+        return new ArrayListIterator<E>(array, index);
     }
 
-    public ArrayIterator makeArrayIterator(Object array, int start, int end) {
-        return new ArrayListIterator(array, start, end);
+    public ArrayListIterator<E> makeArrayListIterator(Object array, int start, int end) {
+        return new ArrayListIterator<E>(array, start, end);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/TestCollatingIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestCollatingIterator.java b/src/test/org/apache/commons/collections/iterators/TestCollatingIterator.java
index 2440d23..789576c 100644
--- a/src/test/org/apache/commons/collections/iterators/TestCollatingIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestCollatingIterator.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You 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.
@@ -18,7 +18,6 @@ package org.apache.commons.collections.iterators;
 
 import java.util.ArrayList;
 import java.util.Comparator;
-import java.util.Iterator;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -27,60 +26,60 @@ import org.apache.commons.collections.comparators.ComparableComparator;
 
 /**
  * Unit test suite for {@link CollatingIterator}.
- * 
+ *
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
-public class TestCollatingIterator extends AbstractTestIterator {
+public class TestCollatingIterator extends AbstractTestIterator<Integer> {
 
     //------------------------------------------------------------ Conventional
-    
+
     public TestCollatingIterator(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return new TestSuite(TestCollatingIterator.class);
     }
 
     //--------------------------------------------------------------- Lifecycle
 
-    private Comparator comparator = null;
-    private ArrayList evens = null; 
-    private ArrayList odds = null; 
-    private ArrayList fib = null; 
+    private Comparator<Integer> comparator = null;
+    private ArrayList<Integer> evens = null;
+    private ArrayList<Integer> odds = null;
+    private ArrayList<Integer> fib = null;
 
     public void setUp() throws Exception {
         super.setUp();
-        comparator = new ComparableComparator();
-        evens = new ArrayList();
-        odds = new ArrayList();
-        for(int i=0;i<20;i++) {
-            if(0 == i%2) {
-                evens.add(new Integer(i));
+        comparator = new ComparableComparator<Integer>();
+        evens = new ArrayList<Integer>();
+        odds = new ArrayList<Integer>();
+        for (int i = 0; i < 20; i++) {
+            if (0 == i % 2) {
+                evens.add(i);
             } else {
-                odds.add(new Integer(i));
+                odds.add(i);
             }
         }
-        fib = new ArrayList();
-        fib.add(new Integer(1));
-        fib.add(new Integer(1));
-        fib.add(new Integer(2));
-        fib.add(new Integer(3));
-        fib.add(new Integer(5));
-        fib.add(new Integer(8));
-        fib.add(new Integer(13));
-        fib.add(new Integer(21));
-    }       
+        fib = new ArrayList<Integer>();
+        fib.add(1);
+        fib.add(1);
+        fib.add(2);
+        fib.add(3);
+        fib.add(5);
+        fib.add(8);
+        fib.add(13);
+        fib.add(21);
+    }
 
     //---------------------------------------------------- TestIterator Methods
-    
-    public Iterator makeEmptyIterator() {
-        return new CollatingIterator(comparator);
+
+    public CollatingIterator<Integer> makeEmptyIterator() {
+        return new CollatingIterator<Integer>(comparator);
     }
 
-    public Iterator makeFullIterator() {
-        CollatingIterator iter = new CollatingIterator(comparator);
+    public CollatingIterator<Integer> makeObject() {
+        CollatingIterator<Integer> iter = new CollatingIterator<Integer>(comparator);
         iter.addIterator(evens.iterator());
         iter.addIterator(odds.iterator());
         iter.addIterator(fib.iterator());
@@ -90,36 +89,36 @@ public class TestCollatingIterator extends AbstractTestIterator {
     //------------------------------------------------------------------- Tests
 
     public void testGetSetComparator() {
-        CollatingIterator iter = new CollatingIterator();
+        CollatingIterator<Integer> iter = new CollatingIterator<Integer>();
         assertNull(iter.getComparator());
         iter.setComparator(comparator);
-        assertSame(comparator,iter.getComparator());
+        assertSame(comparator, iter.getComparator());
         iter.setComparator(null);
         assertNull(iter.getComparator());
     }
 
     public void testIterateEven() {
-        CollatingIterator iter = new CollatingIterator(comparator);
+        CollatingIterator<Integer> iter = new CollatingIterator<Integer>(comparator);
         iter.addIterator(evens.iterator());
-        for(int i=0;i<evens.size();i++) {
+        for (int i = 0; i < evens.size(); i++) {
             assertTrue(iter.hasNext());
-            assertEquals(evens.get(i),iter.next());
+            assertEquals(evens.get(i), iter.next());
         }
         assertTrue(!iter.hasNext());
     }
 
     public void testIterateEvenOdd() {
-        CollatingIterator iter = new CollatingIterator(comparator,evens.iterator(),odds.iterator());
-        for(int i=0;i<20;i++) {
+        CollatingIterator<Integer> iter = new CollatingIterator<Integer>(comparator, evens.iterator(), odds.iterator());
+        for (int i = 0; i < 20; i++) {
             assertTrue(iter.hasNext());
-            assertEquals(new Integer(i),iter.next());
+            assertEquals(new Integer(i), iter.next());
         }
         assertTrue(!iter.hasNext());
     }
 
     public void testIterateOddEven() {
-        CollatingIterator iter = new CollatingIterator(comparator,odds.iterator(),evens.iterator());
-        for(int i=0;i<20;i++) {
+        CollatingIterator<Integer> iter = new CollatingIterator<Integer>(comparator, odds.iterator(), evens.iterator());
+        for (int i = 0; i < 20; i++) {
             assertTrue(iter.hasNext());
             assertEquals(new Integer(i),iter.next());
         }
@@ -127,25 +126,24 @@ public class TestCollatingIterator extends AbstractTestIterator {
     }
 
     public void testIterateEvenEven() {
-        CollatingIterator iter = new CollatingIterator(comparator);
+        CollatingIterator<Integer> iter = new CollatingIterator<Integer>(comparator);
         iter.addIterator(evens.iterator());
         iter.addIterator(evens.iterator());
-        for(int i=0;i<evens.size();i++) {
+        for (int i = 0; i < evens.size(); i++) {
             assertTrue(iter.hasNext());
-            assertEquals(evens.get(i),iter.next());
+            assertEquals(evens.get(i), iter.next());
             assertTrue(iter.hasNext());
-            assertEquals(evens.get(i),iter.next());
+            assertEquals(evens.get(i), iter.next());
         }
         assertTrue(!iter.hasNext());
     }
 
-
     public void testIterateFibEvenOdd() {
-        CollatingIterator iter = new CollatingIterator(comparator);
+        CollatingIterator<Integer> iter = new CollatingIterator<Integer>(comparator);
         iter.addIterator(fib.iterator());
         iter.addIterator(evens.iterator());
         iter.addIterator(odds.iterator());
-        
+
         assertEquals(new Integer(0),iter.next());  // even   0
         assertEquals(new Integer(1),iter.next());  // fib    1
         assertEquals(new Integer(1),iter.next());  // fib    1
@@ -179,12 +177,13 @@ public class TestCollatingIterator extends AbstractTestIterator {
     }
 
     public void testRemoveFromSingle() {
-        CollatingIterator iter = new CollatingIterator(comparator);
+        CollatingIterator<Integer> iter = new CollatingIterator<Integer>(comparator);
         iter.addIterator(evens.iterator());
         int expectedSize = evens.size();
-        while(iter.hasNext()) {
-            Integer val = (Integer)(iter.next());
-            if(val.intValue() % 4 == 0) {
+        while (iter.hasNext()) {
+            Object o = iter.next();
+            Integer val = (Integer) o;
+            if (val.intValue() % 4 == 0) {
                 expectedSize--;
                 iter.remove();
             }
@@ -193,19 +192,20 @@ public class TestCollatingIterator extends AbstractTestIterator {
     }
 
     public void testRemoveFromDouble() {
-        CollatingIterator iter = new CollatingIterator(comparator);
+        CollatingIterator<Integer> iter = new CollatingIterator<Integer>(comparator);
         iter.addIterator(evens.iterator());
         iter.addIterator(odds.iterator());
         int expectedSize = evens.size() + odds.size();
-        while(iter.hasNext()) {
-            Integer val = (Integer)(iter.next());
-            if(val.intValue() % 4 == 0 || val.intValue() % 3 == 0 ) {
+        while (iter.hasNext()) {
+            Object o = iter.next();
+            Integer val = (Integer) o;
+            if (val.intValue() % 4 == 0 || val.intValue() % 3 == 0) {
                 expectedSize--;
                 iter.remove();
             }
         }
-        assertEquals(expectedSize,(evens.size() + odds.size()));
-    }   
+        assertEquals(expectedSize, (evens.size() + odds.size()));
+    }
 
 }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/TestFilterIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestFilterIterator.java b/src/test/org/apache/commons/collections/iterators/TestFilterIterator.java
index 1665a2d..9020153 100644
--- a/src/test/org/apache/commons/collections/iterators/TestFilterIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestFilterIterator.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You 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.
@@ -30,18 +30,17 @@ import junit.framework.TestSuite;
 
 import org.apache.commons.collections.Predicate;
 import org.apache.commons.collections.functors.NotNullPredicate;
-import org.apache.commons.collections.functors.TruePredicate;
 
 /**
  * Test the filter iterator.
  *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Jan Sorensen
  * @author Ralph Wagner
  * @author Huw Roberts
  */
-public class TestFilterIterator extends AbstractTestIterator {
+public class TestFilterIterator<E> extends AbstractTestIterator<E> {
 
     /** Creates new TestFilterIterator */
     public TestFilterIterator(String name) {
@@ -49,8 +48,9 @@ public class TestFilterIterator extends AbstractTestIterator {
     }
 
     private String[] array;
-    private List list;
-    private FilterIterator iterator;
+    private List<E> list;
+    private FilterIterator<E> iterator;
+
     /**
      * Set up instance variables required by this test case.
      */
@@ -76,22 +76,22 @@ public class TestFilterIterator extends AbstractTestIterator {
     /**
      * Returns an full iterator wrapped in a
      * FilterIterator that blocks all the elements
-     * 
+     *
      * @return "empty" FilterIterator
      */
-    public Iterator makeEmptyIterator() {
-        return makeBlockAllFilter(new ArrayIterator(array));
+    public FilterIterator<E> makeEmptyIterator() {
+        return makeBlockAllFilter(new ArrayIterator<E>(array));
     }
 
     /**
      * Returns an array with elements wrapped in a pass-through
      * FilterIterator
-     * 
-     * @return 
+     *
+     * @return
      */
-    public Iterator makeFullIterator() {
-        array = new String[] { "a", "b", "c" };
-        list = new ArrayList(Arrays.asList(array));
+    @SuppressWarnings("unchecked")
+    public FilterIterator<E> makeObject() {
+        list = new ArrayList<E>(Arrays.asList((E[]) array));
         return makePassThroughFilter(list.iterator());
     }
 
@@ -102,8 +102,9 @@ public class TestFilterIterator extends AbstractTestIterator {
     }
 
     public void testRepeatedNext() {
-        for (int i = 0; i < array.length; i++)
+        for (int i = 0; i < array.length; i++) {
             iterator.next();
+        }
         verifyNoMoreElements();
     }
 
@@ -122,15 +123,16 @@ public class TestFilterIterator extends AbstractTestIterator {
      * Test that when the iterator is changed, the hasNext method returns the
      * correct response for the new iterator.
      */
+    @SuppressWarnings("unchecked")
     public void testSetIterator() {
-        Iterator iter1 = Collections.singleton(new Object()).iterator();
-        Iterator iter2 = Collections.EMPTY_LIST.iterator();
-        
-        FilterIterator filterIterator = new FilterIterator(iter1);
+        Iterator<E> iter1 = Collections.singleton((E) new Object()).iterator();
+        Iterator<E> iter2 = Collections.<E>emptyList().iterator();
+
+        FilterIterator<E> filterIterator = new FilterIterator<E>(iter1);
         filterIterator.setPredicate(truePredicate());
         // this iterator has elements
         assertEquals(true, filterIterator.hasNext());
-        
+
         // this iterator has no elements
         filterIterator.setIterator(iter2);
         assertEquals(false, filterIterator.hasNext());
@@ -141,13 +143,13 @@ public class TestFilterIterator extends AbstractTestIterator {
      * correct response for the new predicate.
      */
     public void testSetPredicate() {
-        Iterator iter = Collections.singleton(null).iterator();
+        Iterator<E> iter = Collections.singleton((E) null).iterator();
 
-        FilterIterator filterIterator = new FilterIterator(iter);
+        FilterIterator<E> filterIterator = new FilterIterator<E>(iter);
         filterIterator.setPredicate(truePredicate());
         // this predicate matches
         assertEquals(true, filterIterator.hasNext());
-        
+
         // this predicate doesn't match
         filterIterator.setPredicate(NotNullPredicate.getInstance());
         assertEquals(false, filterIterator.hasNext());
@@ -165,11 +167,13 @@ public class TestFilterIterator extends AbstractTestIterator {
     }
 
     private void verifyElementsInPredicate(final String[] elements) {
-        Predicate pred = new Predicate() {
-            public boolean evaluate(Object x) {
-                for (int i = 0; i < elements.length; i++)
-                    if (elements[i].equals(x))
+        Predicate<E> pred = new Predicate<E>() {
+            public boolean evaluate(E x) {
+                for (int i = 0; i < elements.length; i++) {
+                    if (elements[i].equals(x)) {
                         return true;
+                    }
+                }
                 return false;
             }
         };
@@ -193,35 +197,35 @@ public class TestFilterIterator extends AbstractTestIterator {
     }
 
     private void initIterator() {
-        iterator = (FilterIterator) makeFullIterator();
+        iterator = makeObject();
     }
 
     /**
      * Returns a FilterIterator that does not filter
      * any of its elements
-     * 
+     *
      * @param i      the Iterator to "filter"
      * @return "filtered" iterator
      */
-    protected FilterIterator makePassThroughFilter(Iterator i) {
-        Predicate pred = new Predicate() {
-                public boolean evaluate(Object x) { return true; }
+    protected FilterIterator<E> makePassThroughFilter(Iterator<E> i) {
+        Predicate<E> pred = new Predicate<E>() {
+                public boolean evaluate(E x) { return true; }
         };
-        return new FilterIterator(i,pred);
+        return new FilterIterator<E>(i, pred);
     }
 
     /**
      * Returns a FilterIterator that blocks
      * all of its elements
-     * 
+     *
      * @param i      the Iterator to "filter"
      * @return "filtered" iterator
      */
-    protected FilterIterator makeBlockAllFilter(Iterator i) {
-        Predicate pred = new Predicate() {
-                public boolean evaluate(Object x) { return false; }
+    protected FilterIterator<E> makeBlockAllFilter(Iterator<E> i) {
+        Predicate<E> pred = new Predicate<E>() {
+                public boolean evaluate(E x) { return false; }
         };
-        return new FilterIterator(i,pred);
+        return new FilterIterator<E>(i, pred);
     }
 }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/TestFilterListIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestFilterListIterator.java b/src/test/org/apache/commons/collections/iterators/TestFilterListIterator.java
index 1597a4e..e0bab72 100644
--- a/src/test/org/apache/commons/collections/iterators/TestFilterListIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestFilterListIterator.java
@@ -48,69 +48,69 @@ public class TestFilterListIterator extends TestCase {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    private ArrayList list = null;
-    private ArrayList odds = null;
-    private ArrayList evens = null;
-    private ArrayList threes = null;
-    private ArrayList fours = null;
-    private ArrayList sixes = null;
-    private Predicate truePred = null;
-    private Predicate falsePred = null;
-    private Predicate evenPred = null;
-    private Predicate oddPred = null;
-    private Predicate threePred = null;
-    private Predicate fourPred = null;
+    private ArrayList<Integer> list = null;
+    private ArrayList<Integer> odds = null;
+    private ArrayList<Integer> evens = null;
+    private ArrayList<Integer> threes = null;
+    private ArrayList<Integer> fours = null;
+    private ArrayList<Integer> sixes = null;
+    private Predicate<Integer> truePred = null;
+    private Predicate<Integer> falsePred = null;
+    private Predicate<Integer> evenPred = null;
+    private Predicate<Integer> oddPred = null;
+    private Predicate<Integer> threePred = null;
+    private Predicate<Integer> fourPred = null;
     private Random random = new Random();
 
     public void setUp() {
-        list = new ArrayList();
-        odds = new ArrayList();
-        evens = new ArrayList();
-        threes = new ArrayList();
-        fours = new ArrayList();
-        sixes = new ArrayList();
-        for(int i=0;i<20;i++) {
+        list = new ArrayList<Integer>();
+        odds = new ArrayList<Integer>();
+        evens = new ArrayList<Integer>();
+        threes = new ArrayList<Integer>();
+        fours = new ArrayList<Integer>();
+        sixes = new ArrayList<Integer>();
+        for (int i = 0; i < 20; i++) {
             list.add(new Integer(i));
-            if(i%2 == 0) { evens.add(new Integer(i)); }
-            if(i%2 == 1) { odds.add(new Integer(i)); }
-            if(i%3 == 0) { threes.add(new Integer(i)); }
-            if(i%4 == 0) { fours.add(new Integer(i)); }
-            if(i%6 == 0) { sixes.add(new Integer(i)); }
+            if (i % 2 == 0) { evens.add(new Integer(i)); }
+            if (i % 2 == 1) { odds.add(new Integer(i)); }
+            if (i % 3 == 0) { threes.add(new Integer(i)); }
+            if (i % 4 == 0) { fours.add(new Integer(i)); }
+            if (i % 6 == 0) { sixes.add(new Integer(i)); }
         }
 
-        truePred = new Predicate() {
-            public boolean evaluate(Object x) { 
+        truePred = new Predicate<Integer>() {
+            public boolean evaluate(Integer x) { 
                 return true;
             }
         };
 
-        falsePred = new Predicate() {
-            public boolean evaluate(Object x) { 
+        falsePred = new Predicate<Integer>() {
+            public boolean evaluate(Integer x) { 
                 return true;
             }
         };
 
-        evenPred = new Predicate() {
-            public boolean evaluate(Object x) { 
-                return (((Integer)x).intValue()%2 == 0);
+        evenPred = new Predicate<Integer>() {
+            public boolean evaluate(Integer x) { 
+                return x % 2 == 0;
             }
         };
 
-        oddPred = new Predicate() {
-            public boolean evaluate(Object x) { 
-                return (((Integer)x).intValue()%2 == 1);
+        oddPred = new Predicate<Integer>() {
+            public boolean evaluate(Integer x) { 
+                return x % 2 == 1;
             }
         };
 
-        threePred = new Predicate() {
-            public boolean evaluate(Object x) { 
-                return (((Integer)x).intValue()%3 == 0);
+        threePred = new Predicate<Integer>() {
+            public boolean evaluate(Integer x) { 
+                return x % 3 == 0;
             }
         };
 
-        fourPred = new Predicate() {
-            public boolean evaluate(Object x) { 
-                return (((Integer)x).intValue()%4 == 0);
+        fourPred = new Predicate<Integer>() {
+            public boolean evaluate(Integer x) { 
+                return x % 4 == 0;
             }
         };
 
@@ -138,208 +138,207 @@ public class TestFilterListIterator extends TestCase {
 
     public void testManual() {
         // do this one "by hand" as a sanity check
-        FilterListIterator filtered = new FilterListIterator(list.listIterator(),threePred);
+        FilterListIterator<Integer> filtered = new FilterListIterator<Integer>(list.listIterator(), threePred);
         
-        assertEquals(new Integer(0),filtered.next());
-        assertEquals(new Integer(3),filtered.next());
-        assertEquals(new Integer(6),filtered.next());
-        assertEquals(new Integer(9),filtered.next());
-        assertEquals(new Integer(12),filtered.next());
-        assertEquals(new Integer(15),filtered.next());
-        assertEquals(new Integer(18),filtered.next());
-
-        assertEquals(new Integer(18),filtered.previous());
-        assertEquals(new Integer(15),filtered.previous());
-        assertEquals(new Integer(12),filtered.previous());
-        assertEquals(new Integer(9),filtered.previous());
-        assertEquals(new Integer(6),filtered.previous());
-        assertEquals(new Integer(3),filtered.previous());
-        assertEquals(new Integer(0),filtered.previous());
+        assertEquals(new Integer(0), filtered.next());
+        assertEquals(new Integer(3), filtered.next());
+        assertEquals(new Integer(6), filtered.next());
+        assertEquals(new Integer(9), filtered.next());
+        assertEquals(new Integer(12), filtered.next());
+        assertEquals(new Integer(15), filtered.next());
+        assertEquals(new Integer(18), filtered.next());
+
+        assertEquals(new Integer(18), filtered.previous());
+        assertEquals(new Integer(15), filtered.previous());
+        assertEquals(new Integer(12), filtered.previous());
+        assertEquals(new Integer(9), filtered.previous());
+        assertEquals(new Integer(6), filtered.previous());
+        assertEquals(new Integer(3), filtered.previous());
+        assertEquals(new Integer(0), filtered.previous());
     
         assertTrue(!filtered.hasPrevious());
 
-        assertEquals(new Integer(0),filtered.next());
-        assertEquals(new Integer(3),filtered.next());
-        assertEquals(new Integer(6),filtered.next());
-        assertEquals(new Integer(9),filtered.next());
-        assertEquals(new Integer(12),filtered.next());
-        assertEquals(new Integer(15),filtered.next());
-        assertEquals(new Integer(18),filtered.next());
+        assertEquals(new Integer(0), filtered.next());
+        assertEquals(new Integer(3), filtered.next());
+        assertEquals(new Integer(6), filtered.next());
+        assertEquals(new Integer(9), filtered.next());
+        assertEquals(new Integer(12), filtered.next());
+        assertEquals(new Integer(15), filtered.next());
+        assertEquals(new Integer(18), filtered.next());
 
         assertTrue(!filtered.hasNext());
 
-        assertEquals(new Integer(18),filtered.previous());
-        assertEquals(new Integer(15),filtered.previous());
-        assertEquals(new Integer(12),filtered.previous());
-        assertEquals(new Integer(9),filtered.previous());
-        assertEquals(new Integer(6),filtered.previous());
-        assertEquals(new Integer(3),filtered.previous());
-        assertEquals(new Integer(0),filtered.previous());
-
-        assertEquals(new Integer(0),filtered.next());
-        assertEquals(new Integer(0),filtered.previous());
-        assertEquals(new Integer(0),filtered.next());
-        
-        assertEquals(new Integer(3),filtered.next());
-        assertEquals(new Integer(6),filtered.next());
-        assertEquals(new Integer(6),filtered.previous());
-        assertEquals(new Integer(3),filtered.previous());
-        assertEquals(new Integer(3),filtered.next());
-        assertEquals(new Integer(6),filtered.next());
-
-        assertEquals(new Integer(9),filtered.next());
-        assertEquals(new Integer(12),filtered.next());
-        assertEquals(new Integer(15),filtered.next());
-        assertEquals(new Integer(15),filtered.previous());
-        assertEquals(new Integer(12),filtered.previous());
-        assertEquals(new Integer(9),filtered.previous());
-
+        assertEquals(new Integer(18), filtered.previous());
+        assertEquals(new Integer(15), filtered.previous());
+        assertEquals(new Integer(12), filtered.previous());
+        assertEquals(new Integer(9), filtered.previous());
+        assertEquals(new Integer(6), filtered.previous());
+        assertEquals(new Integer(3), filtered.previous());
+        assertEquals(new Integer(0), filtered.previous());
+
+        assertEquals(new Integer(0), filtered.next());
+        assertEquals(new Integer(0), filtered.previous());
+        assertEquals(new Integer(0), filtered.next());
+
+        assertEquals(new Integer(3), filtered.next());
+        assertEquals(new Integer(6), filtered.next());
+        assertEquals(new Integer(6), filtered.previous());
+        assertEquals(new Integer(3), filtered.previous());
+        assertEquals(new Integer(3), filtered.next());
+        assertEquals(new Integer(6), filtered.next());
+
+        assertEquals(new Integer(9), filtered.next());
+        assertEquals(new Integer(12), filtered.next());
+        assertEquals(new Integer(15), filtered.next());
+        assertEquals(new Integer(15), filtered.previous());
+        assertEquals(new Integer(12), filtered.previous());
+        assertEquals(new Integer(9), filtered.previous());
     }
 
     public void testTruePredicate() {
-        FilterListIterator filtered = new FilterListIterator(list.listIterator(),truePred);
-        walkLists(list,filtered);
+        FilterListIterator<Integer> filtered = new FilterListIterator<Integer>(list.listIterator(), truePred);
+        walkLists(list, filtered);
     }
     
     public void testFalsePredicate() {
-        FilterListIterator filtered = new FilterListIterator(list.listIterator(),falsePred);
-        walkLists(new ArrayList(),filtered);
+        FilterListIterator<Integer> filtered = new FilterListIterator<Integer>(list.listIterator(), falsePred);
+        walkLists(new ArrayList<Integer>(), filtered);
     }
 
     public void testEvens() {
-        FilterListIterator filtered = new FilterListIterator(list.listIterator(),evenPred);
-        walkLists(evens,filtered);
+        FilterListIterator<Integer> filtered = new FilterListIterator<Integer>(list.listIterator(), evenPred);
+        walkLists(evens, filtered);
     }
     
     public void testOdds() {
-        FilterListIterator filtered = new FilterListIterator(list.listIterator(),oddPred);
-        walkLists(odds,filtered);
+        FilterListIterator<Integer> filtered = new FilterListIterator<Integer>(list.listIterator(), oddPred);
+        walkLists(odds, filtered);
     }
 
     public void testThrees() {
-        FilterListIterator filtered = new FilterListIterator(list.listIterator(),threePred);
-        walkLists(threes,filtered);
+        FilterListIterator<Integer> filtered = new FilterListIterator<Integer>(list.listIterator(), threePred);
+        walkLists(threes, filtered);
     }
 
     public void testFours() {
-        FilterListIterator filtered = new FilterListIterator(list.listIterator(),fourPred);
-        walkLists(fours,filtered);
+        FilterListIterator<Integer> filtered = new FilterListIterator<Integer>(list.listIterator(), fourPred);
+        walkLists(fours, filtered);
     }
 
     public void testNestedSixes() {
-        FilterListIterator filtered = new FilterListIterator(
-                                        new FilterListIterator(list.listIterator(),threePred),
+        FilterListIterator<Integer> filtered = new FilterListIterator<Integer>(
+                                        new FilterListIterator<Integer>(list.listIterator(), threePred),
                                         evenPred
                                       );
-        walkLists(sixes,filtered);
+        walkLists(sixes, filtered);
     }
 
     public void testNestedSixes2() {
-        FilterListIterator filtered = new FilterListIterator(
-                                        new FilterListIterator(list.listIterator(),evenPred),
+        FilterListIterator<Integer> filtered = new FilterListIterator<Integer>(
+                                        new FilterListIterator<Integer>(list.listIterator(), evenPred),
                                         threePred
                                       );
-        walkLists(sixes,filtered);
+        walkLists(sixes, filtered);
     }
 
     public void testNestedSixes3() {        
-        FilterListIterator filtered = new FilterListIterator(
-                                        new FilterListIterator(list.listIterator(),threePred),
+        FilterListIterator<Integer> filtered = new FilterListIterator<Integer>(
+                                        new FilterListIterator<Integer>(list.listIterator(), threePred),
                                         evenPred
                                       );
-        walkLists(sixes,new FilterListIterator(filtered,truePred));
+        walkLists(sixes, new FilterListIterator<Integer>(filtered, truePred));
     }
 
     public void testNextChangesPrevious() {
         {
-            FilterListIterator filtered = new FilterListIterator(list.listIterator(),threePred);
-            nextNextPrevious(threes.listIterator(),filtered);
+            FilterListIterator<Integer> filtered = new FilterListIterator<Integer>(list.listIterator(), threePred);
+            nextNextPrevious(threes.listIterator(), filtered);
         }
     
         {
-            FilterListIterator filtered = new FilterListIterator(list.listIterator(),truePred);
-            nextNextPrevious(list.listIterator(),filtered);
+            FilterListIterator<Integer> filtered = new FilterListIterator<Integer>(list.listIterator(), truePred);
+            nextNextPrevious(list.listIterator(), filtered);
         }
     }
 
     public void testPreviousChangesNext() {
         {
-            FilterListIterator filtered = new FilterListIterator(list.listIterator(),threePred);
-            ListIterator expected = threes.listIterator();
+            FilterListIterator<Integer> filtered = new FilterListIterator<Integer>(list.listIterator(), threePred);
+            ListIterator<Integer> expected = threes.listIterator();
             walkForward(expected,filtered);
             previousPreviousNext(expected,filtered);
         }
         {
-            FilterListIterator filtered = new FilterListIterator(list.listIterator(),truePred);
-            ListIterator expected = list.listIterator();
-            walkForward(expected,filtered);
-            previousPreviousNext(expected,filtered);
+            FilterListIterator<Integer> filtered = new FilterListIterator<Integer>(list.listIterator(), truePred);
+            ListIterator<Integer> expected = list.listIterator();
+            walkForward(expected, filtered);
+            previousPreviousNext(expected, filtered);
         }
     }
 
     public void testFailingHasNextBug() {
-        FilterListIterator filtered = new FilterListIterator(list.listIterator(),fourPred);
-        ListIterator expected = fours.listIterator();
-        while(expected.hasNext()) {
+        FilterListIterator<Integer> filtered = new FilterListIterator<Integer>(list.listIterator(), fourPred);
+        ListIterator<Integer> expected = fours.listIterator();
+        while (expected.hasNext()) {
             expected.next();
             filtered.next();
         }
         assertTrue(filtered.hasPrevious());
         assertTrue(!filtered.hasNext());
-        assertEquals(expected.previous(),filtered.previous());
+        assertEquals(expected.previous(), filtered.previous());
     }
 
     // Utilities
 
-    private void walkForward(ListIterator expected, ListIterator testing) {
-        while(expected.hasNext()) {
-            assertEquals(expected.nextIndex(),testing.nextIndex());
-            assertEquals(expected.previousIndex(),testing.previousIndex());
+    private void walkForward(ListIterator<?> expected, ListIterator<?> testing) {
+        while (expected.hasNext()) {
+            assertEquals(expected.nextIndex(), testing.nextIndex());
+            assertEquals(expected.previousIndex(), testing.previousIndex());
             assertTrue(testing.hasNext());
-            assertEquals(expected.next(),testing.next());
+            assertEquals(expected.next(), testing.next());
         }
     }
 
-    private void walkBackward(ListIterator expected, ListIterator testing) {
-        while(expected.hasPrevious()) {
-            assertEquals(expected.nextIndex(),testing.nextIndex());
-            assertEquals(expected.previousIndex(),testing.previousIndex());
+    private void walkBackward(ListIterator<?> expected, ListIterator<?> testing) {
+        while (expected.hasPrevious()) {
+            assertEquals(expected.nextIndex(), testing.nextIndex());
+            assertEquals(expected.previousIndex(), testing.previousIndex());
             assertTrue(testing.hasPrevious());
-            assertEquals(expected.previous(),testing.previous());
+            assertEquals(expected.previous(), testing.previous());
         }
     }
 
-    private void nextNextPrevious(ListIterator expected, ListIterator testing) {
+    private void nextNextPrevious(ListIterator<?> expected, ListIterator<?> testing) {
         // calls to next() should change the value returned by previous()
         // even after previous() has been set by a call to hasPrevious()
-        assertEquals(expected.next(),testing.next());
-        assertEquals(expected.hasPrevious(),testing.hasPrevious());
+        assertEquals(expected.next(), testing.next());
+        assertEquals(expected.hasPrevious(), testing.hasPrevious());
         Object expecteda = expected.next();
         Object testinga = testing.next();
-        assertEquals(expecteda,testinga);
+        assertEquals(expecteda, testinga);
         Object expectedb = expected.previous();
         Object testingb = testing.previous();
-        assertEquals(expecteda,expectedb);
-        assertEquals(testinga,testingb);
+        assertEquals(expecteda, expectedb);
+        assertEquals(testinga, testingb);
     }
 
-    private void previousPreviousNext(ListIterator expected, ListIterator testing) {
+    private void previousPreviousNext(ListIterator<?> expected, ListIterator<?> testing) {
         // calls to previous() should change the value returned by next()
         // even after next() has been set by a call to hasNext()
-        assertEquals(expected.previous(),testing.previous());
-        assertEquals(expected.hasNext(),testing.hasNext());
+        assertEquals(expected.previous(), testing.previous());
+        assertEquals(expected.hasNext(), testing.hasNext());
         Object expecteda = expected.previous();
         Object testinga = testing.previous();
-        assertEquals(expecteda,testinga);
+        assertEquals(expecteda, testinga);
         Object expectedb = expected.next();
         Object testingb = testing.next();
-        assertEquals(expecteda,testingb);
-        assertEquals(expecteda,expectedb);
-        assertEquals(testinga,testingb);
+        assertEquals(expecteda, testingb);
+        assertEquals(expecteda, expectedb);
+        assertEquals(testinga, testingb);
     }
 
-    private void walkLists(List list, ListIterator testing) {
-        ListIterator expected = list.listIterator();
+    private <E> void walkLists(List<E> list, ListIterator<E> testing) {
+        ListIterator<E> expected = list.listIterator();
 
         // walk all the way forward
         walkForward(expected,testing);
@@ -348,74 +347,73 @@ public class TestFilterListIterator extends TestCase {
         walkBackward(expected,testing);
 
         // forward,back,forward
-        while(expected.hasNext()) {
-            assertEquals(expected.nextIndex(),testing.nextIndex());
-            assertEquals(expected.previousIndex(),testing.previousIndex());
+        while (expected.hasNext()) {
+            assertEquals(expected.nextIndex(), testing.nextIndex());
+            assertEquals(expected.previousIndex(), testing.previousIndex());
             assertTrue(testing.hasNext());
-            assertEquals(expected.next(),testing.next());
+            assertEquals(expected.next(), testing.next());
             assertTrue(testing.hasPrevious());
-            assertEquals(expected.previous(),testing.previous());
+            assertEquals(expected.previous(), testing.previous());
             assertTrue(testing.hasNext());
-            assertEquals(expected.next(),testing.next());
+            assertEquals(expected.next(), testing.next());
         }
 
-
         // walk all the way back
-        walkBackward(expected,testing);
+        walkBackward(expected, testing);
 
-        for(int i=0;i<list.size();i++) {
+        for (int i = 0; i < list.size(); i++) {
             // walk forward i
-            for(int j=0;j<i;j++) {
-                assertEquals(expected.nextIndex(),testing.nextIndex());
-                assertEquals(expected.previousIndex(),testing.previousIndex());
+            for (int j = 0; j < i; j++) {
+                assertEquals(expected.nextIndex(), testing.nextIndex());
+                assertEquals(expected.previousIndex(), testing.previousIndex());
                 assertTrue(expected.hasNext()); // if this one fails we've got a logic error in the test
                 assertTrue(testing.hasNext());
-                assertEquals(expected.next(),testing.next());
+                assertEquals(expected.next(), testing.next());
             }
             // walk back i/2
-            for(int j=0;j<i/2;j++) {
-                assertEquals(expected.nextIndex(),testing.nextIndex());
-                assertEquals(expected.previousIndex(),testing.previousIndex());
+            for (int j = 0; j < i / 2; j++) {
+                assertEquals(expected.nextIndex(), testing.nextIndex());
+                assertEquals(expected.previousIndex(), testing.previousIndex());
                 assertTrue(expected.hasPrevious()); // if this one fails we've got a logic error in the test
                 assertTrue(testing.hasPrevious());
-                assertEquals(expected.previous(),testing.previous());
+                assertEquals(expected.previous(), testing.previous());
             }
             // walk forward i/2
-            for(int j=0;j<i/2;j++) {
-                assertEquals(expected.nextIndex(),testing.nextIndex());
-                assertEquals(expected.previousIndex(),testing.previousIndex());
+            for (int j = 0; j < i / 2; j++) {
+                assertEquals(expected.nextIndex(), testing.nextIndex());
+                assertEquals(expected.previousIndex(), testing.previousIndex());
                 assertTrue(expected.hasNext()); // if this one fails we've got a logic error in the test
                 assertTrue(testing.hasNext());
-                assertEquals(expected.next(),testing.next());
+                assertEquals(expected.next(), testing.next());
             }
             // walk back i
-            for(int j=0;j<i;j++) {
-                assertEquals(expected.nextIndex(),testing.nextIndex());
-                assertEquals(expected.previousIndex(),testing.previousIndex());
+            for (int j = 0; j < i; j++) {
+                assertEquals(expected.nextIndex(), testing.nextIndex());
+                assertEquals(expected.previousIndex(), testing.previousIndex());
                 assertTrue(expected.hasPrevious()); // if this one fails we've got a logic error in the test
                 assertTrue(testing.hasPrevious());
-                assertEquals(expected.previous(),testing.previous());
+                assertEquals(expected.previous(), testing.previous());
             }
         }
 
         // random walk
         StringBuffer walkdescr = new StringBuffer(500);
-        for(int i=0;i<500;i++) {
-            if(random.nextBoolean()) {
+        for (int i = 0; i < 500; i++) {
+            if (random.nextBoolean()) {
                 // step forward
                 walkdescr.append("+");
-                if(expected.hasNext()) {
-                    assertEquals(walkdescr.toString(),expected.next(),testing.next());
+                if (expected.hasNext()) {
+                    assertEquals(walkdescr.toString(), expected.next(), testing.next());
                 }
             } else {
                 // step backward
                 walkdescr.append("-");
-                if(expected.hasPrevious()) {
-                    assertEquals(walkdescr.toString(),expected.previous(),testing.previous());
+                if (expected.hasPrevious()) {
+                    assertEquals(walkdescr.toString(), expected.previous(), testing.previous());
                 }
             }
-            assertEquals(walkdescr.toString(),expected.nextIndex(),testing.nextIndex());
-            assertEquals(walkdescr.toString(),expected.previousIndex(),testing.previousIndex());
+            assertEquals(walkdescr.toString(), expected.nextIndex(), testing.nextIndex());
+            assertEquals(walkdescr.toString(), expected.previousIndex(), testing.previousIndex());
         }
 
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/TestIteratorChain.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestIteratorChain.java b/src/test/org/apache/commons/collections/iterators/TestIteratorChain.java
index 9127ad0..eb3ed5e 100644
--- a/src/test/org/apache/commons/collections/iterators/TestIteratorChain.java
+++ b/src/test/org/apache/commons/collections/iterators/TestIteratorChain.java
@@ -36,15 +36,15 @@ import org.apache.commons.collections.Predicate;
  * @author Mauricio S. Moura
  * @author Morgan Delagrange
  */
-public class TestIteratorChain extends AbstractTestIterator {
+public class TestIteratorChain extends AbstractTestIterator<String> {
 
     protected String[] testArray = {
         "One", "Two", "Three", "Four", "Five", "Six"
     };
 
-    protected List list1 = null;
-    protected List list2 = null;
-    protected List list3 = null;
+    protected List<String> list1 = null;
+    protected List<String> list2 = null;
+    protected List<String> list3 = null;
 
     public static Test suite() {
         return new TestSuite(TestIteratorChain.class);
@@ -55,24 +55,24 @@ public class TestIteratorChain extends AbstractTestIterator {
     }
 
     public void setUp() {
-        list1 = new ArrayList();
+        list1 = new ArrayList<String>();
         list1.add("One");
         list1.add("Two");
         list1.add("Three");
-        list2 = new ArrayList();
+        list2 = new ArrayList<String>();
         list2.add("Four");
-        list3 = new ArrayList();
+        list3 = new ArrayList<String>();
         list3.add("Five");
         list3.add("Six");        
     }
 
-    public Iterator makeEmptyIterator() {
-        ArrayList list = new ArrayList();
-        return new IteratorChain(list.iterator());
+    public IteratorChain<String> makeEmptyIterator() {
+        ArrayList<String> list = new ArrayList<String>();
+        return new IteratorChain<String>(list.iterator());
     }
 
-    public Iterator makeFullIterator() {
-        IteratorChain chain = new IteratorChain();
+    public IteratorChain<String> makeObject() {
+        IteratorChain<String> chain = new IteratorChain<String>();
 
         chain.addIterator(list1.iterator());
         chain.addIterator(list2.iterator());
@@ -81,18 +81,18 @@ public class TestIteratorChain extends AbstractTestIterator {
     }
 
     public void testIterator() {
-        Iterator iter = (Iterator) makeFullIterator();
-        for ( int i = 0; i < testArray.length; i++ ) {
+        Iterator<String> iter = makeObject();
+        for (int i = 0; i < testArray.length; i++) {
             Object testValue = testArray[i];            
             Object iterValue = iter.next();
 
             assertEquals( "Iteration value is correct", testValue, iterValue );
         }
 
-        assertTrue("Iterator should now be empty", ! iter.hasNext() );
+        assertTrue("Iterator should now be empty", !iter.hasNext());
 
         try {
-            Object testValue = iter.next();
+            iter.next();
         } catch (Exception e) {
             assertTrue("NoSuchElementException must be thrown", 
                        e.getClass().equals((new NoSuchElementException()).getClass()));
@@ -101,38 +101,34 @@ public class TestIteratorChain extends AbstractTestIterator {
 
     public void testRemoveFromFilteredIterator() {
 
-        final Predicate myPredicate = new Predicate() {
-            public boolean evaluate( Object object ) {
-                Integer i = (Integer) object;
-                if (i.compareTo(new Integer(4)) < 0)
-                    return true;
-                return false;
+        final Predicate<Integer> myPredicate = new Predicate<Integer>() {
+            public boolean evaluate(Integer i) {
+                return i.compareTo(new Integer(4)) < 0;
             }
         };
 
-        List list1 = new ArrayList();
-        List list2 = new ArrayList();
+        List<Integer> list1 = new ArrayList<Integer>();
+        List<Integer> list2 = new ArrayList<Integer>();
 
         list1.add(new Integer(1));
         list1.add(new Integer(2));
         list2.add(new Integer(3));
         list2.add(new Integer(4)); // will be ignored by the predicate
 
-        Iterator it1 = IteratorUtils.filteredIterator(list1.iterator(), myPredicate );
-        Iterator it2 = IteratorUtils.filteredIterator(list2.iterator(), myPredicate );
+        Iterator<Integer> it1 = IteratorUtils.filteredIterator(list1.iterator(), myPredicate);
+        Iterator<Integer> it2 = IteratorUtils.filteredIterator(list2.iterator(), myPredicate);
 
-        Iterator it = IteratorUtils.chainedIterator(it1, it2);
+        Iterator<Integer> it = IteratorUtils.chainedIterator(it1, it2);
         while (it.hasNext()) {
             it.next();
             it.remove();
         }
-        assertEquals( 0, list1.size() );
-        assertEquals( 1, list2.size() );
-
+        assertEquals(0, list1.size());
+        assertEquals(1, list2.size());
     }
     
     public void testRemove() {
-        Iterator iter = (Iterator) makeFullIterator();
+        Iterator<String> iter = makeObject();
 
         try {
             iter.remove();
@@ -141,13 +137,13 @@ public class TestIteratorChain extends AbstractTestIterator {
 
         }
 
-        for ( int i = 0; i < testArray.length; i++ ) {
-            Object testValue = testArray[i];            
-            Object iterValue = iter.next();
+        for (int i = 0; i < testArray.length; i++) {
+            String testValue = testArray[i];            
+            String iterValue = iter.next();
 
-            assertEquals( "Iteration value is correct", testValue, iterValue );
+            assertEquals("Iteration value is correct", testValue, iterValue);
 
-            if (! iterValue.equals("Four")) {
+            if (!iterValue.equals("Four")) {
                 iter.remove();
             }
         }
@@ -158,12 +154,12 @@ public class TestIteratorChain extends AbstractTestIterator {
     }
 
     public void testFirstIteratorIsEmptyBug() {
-        List empty = new ArrayList();
-        List notEmpty = new ArrayList();
+        List<String> empty = new ArrayList<String>();
+        List<String> notEmpty = new ArrayList<String>();
         notEmpty.add("A");
         notEmpty.add("B");
         notEmpty.add("C");
-        IteratorChain chain = new IteratorChain();
+        IteratorChain<String> chain = new IteratorChain<String>();
         chain.addIterator(empty.iterator());
         chain.addIterator(notEmpty.iterator());
         assertTrue("should have next",chain.hasNext());
@@ -176,7 +172,7 @@ public class TestIteratorChain extends AbstractTestIterator {
     }
     
     public void testEmptyChain() {
-        IteratorChain chain = new IteratorChain();
+        IteratorChain<Object> chain = new IteratorChain<Object>();
         assertEquals(false, chain.hasNext());
         try {
             chain.next();

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/TestListIteratorWrapper.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestListIteratorWrapper.java b/src/test/org/apache/commons/collections/iterators/TestListIteratorWrapper.java
index 258f4e7..6f108b0 100644
--- a/src/test/org/apache/commons/collections/iterators/TestListIteratorWrapper.java
+++ b/src/test/org/apache/commons/collections/iterators/TestListIteratorWrapper.java
@@ -17,7 +17,6 @@
 package org.apache.commons.collections.iterators;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 import java.util.ListIterator;
 import java.util.NoSuchElementException;
@@ -31,16 +30,16 @@ import org.apache.commons.collections.ResettableListIterator;
  * a ListIterator correctly.
  *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Morgan Delagrange
  */
-public class TestListIteratorWrapper extends AbstractTestIterator {
+public class TestListIteratorWrapper<E> extends AbstractTestIterator<E> {
 
     protected String[] testArray = {
         "One", "Two", "Three", "Four", "Five", "Six"
     };
 
-    protected List list1 = null;
+    protected List<E> list1 = null;
 
     public static Test suite() {
         return new TestSuite(TestListIteratorWrapper.class);
@@ -50,49 +49,48 @@ public class TestListIteratorWrapper extends AbstractTestIterator {
         super(testName);
     }
 
+    @SuppressWarnings("unchecked")
     public void setUp() {
-        list1 = new ArrayList();
-        list1.add("One");
-        list1.add("Two");
-        list1.add("Three");
-        list1.add("Four");
-        list1.add("Five");
-        list1.add("Six");
+        list1 = new ArrayList<E>();
+        list1.add((E) "One");
+        list1.add((E) "Two");
+        list1.add((E) "Three");
+        list1.add((E) "Four");
+        list1.add((E) "Five");
+        list1.add((E) "Six");
     }
 
-    public Iterator makeEmptyIterator() {
-        ArrayList list = new ArrayList();
-        return new ListIteratorWrapper(list.iterator());
+    public ResettableListIterator<E> makeEmptyIterator() {
+        ArrayList<E> list = new ArrayList<E>();
+        return new ListIteratorWrapper<E>(list.iterator());
     }
 
-    public Iterator makeFullIterator() {
-        Iterator i = list1.iterator();
-
-        return new ListIteratorWrapper(i);
+    public ResettableListIterator<E> makeObject() {
+        return new ListIteratorWrapper<E>(list1.iterator());
     }
 
     public void testIterator() {
-        ListIterator iter = (ListIterator) makeFullIterator();
-        for ( int i = 0; i < testArray.length; i++ ) {
-            Object testValue = testArray[i];            
+        ListIterator<E> iter = makeObject();
+        for (int i = 0; i < testArray.length; i++) {
+            Object testValue = testArray[i];
             Object iterValue = iter.next();
 
-            assertEquals( "Iteration value is correct", testValue, iterValue );
+            assertEquals("Iteration value is correct", testValue, iterValue);
         }
 
-        assertTrue("Iterator should now be empty", ! iter.hasNext() );
+        assertTrue("Iterator should now be empty", !iter.hasNext());
 
         try {
             iter.next();
         } catch (Exception e) {
-            assertTrue("NoSuchElementException must be thrown", 
+            assertTrue("NoSuchElementException must be thrown",
                        e.getClass().equals((new NoSuchElementException()).getClass()));
         }
 
         // now, read it backwards
         for (int i = testArray.length - 1; i > -1; --i) {
             Object testValue = testArray[i];
-            Object iterValue = iter.previous();
+            E iterValue = iter.previous();
 
             assertEquals( "Iteration value is correct", testValue, iterValue );
         }
@@ -100,22 +98,22 @@ public class TestListIteratorWrapper extends AbstractTestIterator {
         try {
             iter.previous();
         } catch (Exception e) {
-            assertTrue("NoSuchElementException must be thrown", 
+            assertTrue("NoSuchElementException must be thrown",
                        e.getClass().equals((new NoSuchElementException()).getClass()));
         }
 
         // now, read it forwards again
-        for ( int i = 0; i < testArray.length; i++ ) {
-            Object testValue = testArray[i];            
+        for (int i = 0; i < testArray.length; i++) {
+            Object testValue = testArray[i];
             Object iterValue = iter.next();
 
-            assertEquals( "Iteration value is correct", testValue, iterValue );
+            assertEquals("Iteration value is correct", testValue, iterValue);
         }
 
     }
 
     public void testRemove() {
-        Iterator iter = (Iterator) makeFullIterator();
+        ListIterator<E> iter = makeObject();
 
         try {
             iter.remove();
@@ -127,23 +125,23 @@ public class TestListIteratorWrapper extends AbstractTestIterator {
     }
 
     public void testReset() {
-        ResettableListIterator iter = (ResettableListIterator) makeFullIterator();
-        Object first = iter.next();
-        Object second = iter.next();
-        
+        ResettableListIterator<E> iter = makeObject();
+        E first = iter.next();
+        E second = iter.next();
+
         iter.reset();
-        
+
         // after reset, there shouldn't be any previous elements
         assertFalse("No previous elements after reset()", iter.hasPrevious());
 
         // after reset, the results should be the same as before
         assertEquals("First element should be the same", first, iter.next());
         assertEquals("Second elment should be the same", second, iter.next());
-        
+
         // after passing the point, where we resetted, continuation should work as expected
         for (int i = 2; i < testArray.length; i++) {
             Object testValue = testArray[i];
-            Object iterValue = iter.next();
+            E iterValue = iter.next();
 
             assertEquals("Iteration value is correct", testValue, iterValue);
         }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/TestLoopingIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestLoopingIterator.java b/src/test/org/apache/commons/collections/iterators/TestLoopingIterator.java
index b3a7b9e..dfa572c 100644
--- a/src/test/org/apache/commons/collections/iterators/TestLoopingIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestLoopingIterator.java
@@ -48,7 +48,7 @@ public class TestLoopingIterator extends TestCase {
      */
     public void testConstructorEx() throws Exception {
         try {
-            new LoopingIterator(null);
+            new LoopingIterator<Object>(null);
             fail();
         } catch (NullPointerException ex) {
         }
@@ -59,8 +59,8 @@ public class TestLoopingIterator extends TestCase {
      * @throws Exception  If something unexpected occurs.
      */
     public void testLooping0() throws Exception {
-        List list = new ArrayList();
-        LoopingIterator loop = new LoopingIterator(list);
+        List<Object> list = new ArrayList<Object>();
+        LoopingIterator<Object> loop = new LoopingIterator<Object>(list);
         assertTrue("hasNext should return false", loop.hasNext() == false);
 
         try {
@@ -75,8 +75,8 @@ public class TestLoopingIterator extends TestCase {
      * @throws Exception  If something unexpected occurs.
      */
     public void testLooping1() throws Exception {
-        List list = new ArrayList(Arrays.asList(new String[] { "a" }));
-        LoopingIterator loop = new LoopingIterator(list);
+        List<String> list = Arrays.asList(new String[] { "a" });
+        LoopingIterator<String> loop = new LoopingIterator<String>(list);
 
         assertTrue("1st hasNext should return true", loop.hasNext());
         assertEquals("a", loop.next());
@@ -94,8 +94,8 @@ public class TestLoopingIterator extends TestCase {
      * @throws Exception  If something unexpected occurs.
      */
     public void testLooping2() throws Exception {
-        List list = new ArrayList(Arrays.asList(new String[] { "a", "b" }));
-        LoopingIterator loop = new LoopingIterator(list);
+        List<String> list = Arrays.asList(new String[] { "a", "b" });
+        LoopingIterator<String> loop = new LoopingIterator<String>(list);
 
         assertTrue("1st hasNext should return true", loop.hasNext());
         assertEquals("a", loop.next());
@@ -113,8 +113,8 @@ public class TestLoopingIterator extends TestCase {
      * @throws Exception  If something unexpected occurs.
      */
     public void testLooping3() throws Exception {
-        List list = new ArrayList(Arrays.asList(new String[] { "a", "b", "c" }));
-        LoopingIterator loop = new LoopingIterator(list);
+        List<String> list = Arrays.asList(new String[] { "a", "b", "c" });
+        LoopingIterator<String> loop = new LoopingIterator<String>(list);
 
         assertTrue("1st hasNext should return true", loop.hasNext());
         assertEquals("a", loop.next());
@@ -135,8 +135,8 @@ public class TestLoopingIterator extends TestCase {
      * @throws Exception  If something unexpected occurs.
      */
     public void testRemoving1() throws Exception {
-        List list = new ArrayList(Arrays.asList(new String[] { "a", "b", "c" }));
-        LoopingIterator loop = new LoopingIterator(list);
+        List<String> list = new ArrayList<String>(Arrays.asList(new String[] { "a", "b", "c" }));
+        LoopingIterator<String> loop = new LoopingIterator<String>(list);
         assertEquals("list should have 3 elements.", 3, list.size());
 
         assertTrue("1st hasNext should return true", loop.hasNext());
@@ -167,8 +167,8 @@ public class TestLoopingIterator extends TestCase {
      * @throws Exception  If something unexpected occurs.
      */
     public void testReset() throws Exception {
-        List list = new ArrayList(Arrays.asList(new String[] { "a", "b", "c" }));
-        LoopingIterator loop = new LoopingIterator(list);
+        List<String> list = Arrays.asList(new String[] { "a", "b", "c" });
+        LoopingIterator<String> loop = new LoopingIterator<String>(list);
 
         assertEquals("a", loop.next());
         assertEquals("b", loop.next());
@@ -189,8 +189,8 @@ public class TestLoopingIterator extends TestCase {
      * @throws Exception  If something unexpected occurs.
      */
     public void testSize() throws Exception {
-        List list = new ArrayList(Arrays.asList(new String[] { "a", "b", "c" }));
-        LoopingIterator loop = new LoopingIterator(list);
+        List<String> list = new ArrayList<String>(Arrays.asList(new String[] { "a", "b", "c" }));
+        LoopingIterator<String> loop = new LoopingIterator<String>(list);
 
         assertEquals(3, loop.size());
         loop.next();


Mime
View raw message