commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chtom...@apache.org
Subject [09/77] [abbrv] commons-collections git commit: finish generics (minus one class)
Date Tue, 11 Jul 2017 17:54:54 GMT
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/TestLoopingListIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestLoopingListIterator.java b/src/test/org/apache/commons/collections/iterators/TestLoopingListIterator.java
index cbee9f6..9f4e2ce 100644
--- a/src/test/org/apache/commons/collections/iterators/TestLoopingListIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestLoopingListIterator.java
@@ -47,7 +47,7 @@ public class TestLoopingListIterator extends TestCase {
      */
     public void testConstructorEx() throws Exception {
         try {
-            new LoopingListIterator(null);
+            new LoopingListIterator<Object>(null);
             fail();
         } catch (NullPointerException ex) {
         }
@@ -57,8 +57,8 @@ public class TestLoopingListIterator extends TestCase {
      * Tests whether an empty looping list iterator works.
      */
     public void testLooping0() throws Exception {
-        List list = new ArrayList();
-        LoopingListIterator loop = new LoopingListIterator(list);
+        List<Object> list = new ArrayList<Object>();
+        LoopingListIterator<Object> loop = new LoopingListIterator<Object>(list);
         assertFalse(loop.hasNext());
         assertFalse(loop.hasPrevious());
         
@@ -80,8 +80,8 @@ public class TestLoopingListIterator extends TestCase {
      * one element.
      */
     public void testLooping1() throws Exception {
-        List list = new ArrayList(Arrays.asList(new String[] { "a" }));
-        LoopingListIterator loop = new LoopingListIterator(list); // <a>
+        List<String> list = Arrays.asList(new String[] { "a" });
+        LoopingListIterator<String> loop = new LoopingListIterator<String>(list); // <a>
 
         assertTrue(loop.hasNext());
         assertEquals("a", loop.next());     // <a>
@@ -107,8 +107,8 @@ public class TestLoopingListIterator extends TestCase {
      * elements.
      */
     public void testLooping2() throws Exception {
-        List list = new ArrayList(Arrays.asList(new String[] { "a", "b" }));
-        LoopingListIterator loop = new LoopingListIterator(list); // <a> b
+        List<String> list = Arrays.asList(new String[] { "a", "b" });
+        LoopingListIterator<String> loop = new LoopingListIterator<String>(list); // <a> b
 
         assertTrue(loop.hasNext());
         assertEquals("a", loop.next());     // a <b>
@@ -137,8 +137,8 @@ public class TestLoopingListIterator extends TestCase {
      * the begin/end boundary of the list.
      */
     public void testJoggingNotOverBoundary() {
-        List list = new ArrayList(Arrays.asList(new String[] { "a", "b" }));
-        LoopingListIterator loop = new LoopingListIterator(list); // <a> b
+        List<String> list = Arrays.asList(new String[] { "a", "b" });
+        LoopingListIterator<String> loop = new LoopingListIterator<String>(list); // <a> b
     
         // Try jogging back and forth between the elements, but not
         // over the begin/end boundary.
@@ -157,8 +157,8 @@ public class TestLoopingListIterator extends TestCase {
      * begin/end boundary of the list.
      */
     public void testJoggingOverBoundary() {
-        List list = new ArrayList(Arrays.asList(new String[] { "a", "b" }));
-        LoopingListIterator loop = new LoopingListIterator(list); // <a> b
+        List<String> list = Arrays.asList(new String[] { "a", "b" });
+        LoopingListIterator<String> loop = new LoopingListIterator<String>(list); // <a> b
     
         // Try jogging back and forth between the elements, but not
         // over the begin/end boundary.
@@ -175,8 +175,8 @@ public class TestLoopingListIterator extends TestCase {
      * Tests removing an element from a wrapped ArrayList.
      */
     public void testRemovingElementsAndIteratingForward() {
-        List list = new ArrayList(Arrays.asList(new String[] { "a", "b", "c" }));
-        LoopingListIterator loop = new LoopingListIterator(list); // <a> b c
+        List<String> list = new ArrayList<String>(Arrays.asList(new String[] { "a", "b", "c" }));
+        LoopingListIterator<String> loop = new LoopingListIterator<String>(list); // <a> b c
 
         assertTrue(loop.hasNext());
         assertEquals("a", loop.next()); // a <b> c
@@ -205,8 +205,8 @@ public class TestLoopingListIterator extends TestCase {
      * Tests removing an element from a wrapped ArrayList.
      */
     public void testRemovingElementsAndIteratingBackwards() {
-        List list = new ArrayList(Arrays.asList(new String[] { "a", "b", "c" }));
-        LoopingListIterator loop = new LoopingListIterator(list); // <a> b c
+        List<String> list = new ArrayList<String>(Arrays.asList(new String[] { "a", "b", "c" }));
+        LoopingListIterator<String> loop = new LoopingListIterator<String>(list); // <a> b c
 
         assertTrue(loop.hasPrevious());
         assertEquals("c", loop.previous()); // a b <c>
@@ -235,8 +235,8 @@ public class TestLoopingListIterator extends TestCase {
      * Tests the reset method.
      */
     public void testReset() {
-        List list = new ArrayList(Arrays.asList(new String[] { "a", "b", "c" }));
-        LoopingListIterator loop = new LoopingListIterator(list); // <a> b c
+        List<String> list = Arrays.asList(new String[] { "a", "b", "c" });
+        LoopingListIterator<String> loop = new LoopingListIterator<String>(list); // <a> b c
 
         assertEquals("a", loop.next()); // a <b> c
         assertEquals("b", loop.next()); // a b <c>
@@ -262,8 +262,8 @@ public class TestLoopingListIterator extends TestCase {
      * Tests the add method.
      */
     public void testAdd() {
-        List list = new ArrayList(Arrays.asList(new String[] { "b", "e", "f" }));
-        LoopingListIterator loop = new LoopingListIterator(list); // <b> e f
+        List<String> list = new ArrayList<String>(Arrays.asList(new String[] { "b", "e", "f" }));
+        LoopingListIterator<String> loop = new LoopingListIterator<String>(list); // <b> e f
 
         loop.add("a");                      // <a> b e f
         assertEquals("b", loop.next());     // a <b> e f
@@ -287,8 +287,8 @@ public class TestLoopingListIterator extends TestCase {
         assertEquals("f", loop.next());     // <a> b c d e f
         assertEquals("a", loop.next());     // a <b> c d e f
 
-        list = new ArrayList(Arrays.asList(new String[] { "b", "e", "f" }));
-        loop = new LoopingListIterator(list); // <b> e f        
+        list = new ArrayList<String>(Arrays.asList(new String[] { "b", "e", "f" }));
+        loop = new LoopingListIterator<String>(list); // <b> e f        
 
         loop.add("a");                      // a <b> e f
         assertEquals("a", loop.previous()); // a b e <f>
@@ -316,8 +316,8 @@ public class TestLoopingListIterator extends TestCase {
      * Tests nextIndex and previousIndex.
      */
     public void testNextAndPreviousIndex() {
-        List list = new ArrayList(Arrays.asList(new String[] { "a", "b", "c" }));
-        LoopingListIterator loop = new LoopingListIterator(list); // <a> b c
+        List<String> list = Arrays.asList(new String[] { "a", "b", "c" });
+        LoopingListIterator<String> loop = new LoopingListIterator<String>(list); // <a> b c
 
         assertEquals(0, loop.nextIndex());
         assertEquals(2, loop.previousIndex());
@@ -347,8 +347,8 @@ public class TestLoopingListIterator extends TestCase {
      * Tests using the set method to change elements.
      */
     public void testSet() {
-        List list = new ArrayList(Arrays.asList(new String[] { "q", "r", "z" }));
-        LoopingListIterator loop = new LoopingListIterator(list); // <q> r z
+        List<String> list = Arrays.asList(new String[] { "q", "r", "z" });
+        LoopingListIterator<String> loop = new LoopingListIterator<String>(list); // <q> r z
 
         assertEquals("z", loop.previous()); // q r <z>
         loop.set("c");                      // q r <c>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/TestObjectArrayIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestObjectArrayIterator.java b/src/test/org/apache/commons/collections/iterators/TestObjectArrayIterator.java
index d158236..13f270a 100644
--- a/src/test/org/apache/commons/collections/iterators/TestObjectArrayIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestObjectArrayIterator.java
@@ -32,7 +32,7 @@ import junit.framework.TestSuite;
  * @author Morgan Delagrange
  * @author Stephen Colebourne
  */
-public class TestObjectArrayIterator extends AbstractTestIterator {
+public class TestObjectArrayIterator<E> extends AbstractTestIterator<E> {
 
     protected String[] testArray = { "One", "Two", "Three" };
 
@@ -44,28 +44,30 @@ public class TestObjectArrayIterator extends AbstractTestIterator {
         super(testName);
     }
 
-    public Iterator makeEmptyIterator() {
-        return new ObjectArrayIterator(new Object[0]);
+    @SuppressWarnings("unchecked")
+    public ObjectArrayIterator<E> makeEmptyIterator() {
+        return new ObjectArrayIterator<E>((E[]) new Object[0]);
     }
 
-    public Iterator makeFullIterator() {
-        return new ObjectArrayIterator(testArray);
+    @SuppressWarnings("unchecked")
+    public ObjectArrayIterator<E> makeObject() {
+        return new ObjectArrayIterator<E>((E[]) testArray);
     }
 
-    public ObjectArrayIterator makeArrayIterator() {
-        return new ObjectArrayIterator();
+    public ObjectArrayIterator<E> makeArrayIterator() {
+        return new ObjectArrayIterator<E>();
     }
 
-    public ObjectArrayIterator makeArrayIterator(Object[] array) {
-        return new ObjectArrayIterator(array);
+    public ObjectArrayIterator<E> makeArrayIterator(E[] array) {
+        return new ObjectArrayIterator<E>(array);
     }
 
-    public ObjectArrayIterator makeArrayIterator(Object[] array, int index) {
-        return new ObjectArrayIterator(array, index);
+    public ObjectArrayIterator<E> makeArrayIterator(E[] array, int index) {
+        return new ObjectArrayIterator<E>(array, index);
     }
 
-    public ObjectArrayIterator makeArrayIterator(Object[] array, int start, int end) {
-        return new ObjectArrayIterator(array, start, end);
+    public ObjectArrayIterator<E> makeArrayIterator(E[] array, int start, int end) {
+        return new ObjectArrayIterator<E>(array, start, end);
     }
 
     public boolean supportsRemove() {
@@ -73,10 +75,10 @@ public class TestObjectArrayIterator extends AbstractTestIterator {
     }
 
     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);
         }
@@ -84,7 +86,7 @@ public class TestObjectArrayIterator 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",
@@ -94,14 +96,14 @@ public class TestObjectArrayIterator extends AbstractTestIterator {
 
     public void testNullArray() {
         try {
-            Iterator iter = makeArrayIterator(null);
+            makeArrayIterator(null);
 
             fail("Constructor should throw a NullPointerException when constructed with a null array");
         } catch (NullPointerException e) {
             // expected
         }
 
-        ObjectArrayIterator iter = makeArrayIterator();
+        ObjectArrayIterator<E> iter = makeArrayIterator();
         try {
             iter.setArray(null);
 
@@ -111,18 +113,20 @@ public class TestObjectArrayIterator extends AbstractTestIterator {
         }
     }
 
+    @SuppressWarnings("unchecked")
     public void testDoubleSet() {
-        ObjectArrayIterator it = makeArrayIterator();
-        it.setArray(new String[0]);
+        ObjectArrayIterator<E> it = makeArrayIterator();
+        it.setArray((E[]) new String[0]);
         try {
-            it.setArray(new String[0]);
+            it.setArray((E[]) new String[0]);
             fail();
         } catch (IllegalStateException ex) {
         }
     }
 
+    @SuppressWarnings("unchecked")
     public void testReset() {
-        ObjectArrayIterator it = makeArrayIterator(testArray);
+        ObjectArrayIterator<E> it = makeArrayIterator((E[]) testArray);
         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/TestObjectArrayListIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestObjectArrayListIterator.java b/src/test/org/apache/commons/collections/iterators/TestObjectArrayListIterator.java
index d71fe52..01c3bc6 100644
--- a/src/test/org/apache/commons/collections/iterators/TestObjectArrayListIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestObjectArrayListIterator.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;
 
@@ -31,7 +30,7 @@ import junit.framework.TestSuite;
  * 
  * @author Neil O'Toole
  */
-public class TestObjectArrayListIterator extends TestObjectArrayIterator {
+public class TestObjectArrayListIterator<E> extends TestObjectArrayIterator<E> {
 
     public TestObjectArrayListIterator(String testName) {
         super(testName);
@@ -41,16 +40,18 @@ public class TestObjectArrayListIterator extends TestObjectArrayIterator {
         return new TestSuite(TestObjectArrayListIterator.class);
     }
 
-    public Iterator makeEmptyIterator() {
-        return new ObjectArrayListIterator(new Object[0]);
+    @SuppressWarnings("unchecked")
+    public ObjectArrayListIterator<E> makeEmptyIterator() {
+        return new ObjectArrayListIterator<E>((E[]) new Object[0]);
     }
 
-    public Iterator makeFullIterator() {
-        return new ObjectArrayListIterator(testArray);
+    @SuppressWarnings("unchecked")
+    public ObjectArrayListIterator<E> makeObject() {
+        return new ObjectArrayListIterator<E>((E[]) testArray);
     }
 
-    public ListIterator makeArrayListIterator(Object[] array) {
-        return new ObjectArrayListIterator(array);
+    public ObjectArrayListIterator<E> makeArrayListIterator(E[] array) {
+        return new ObjectArrayListIterator<E>(array);
     }
 
     /**
@@ -58,7 +59,7 @@ public class TestObjectArrayListIterator extends TestObjectArrayIterator {
      * <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
@@ -78,7 +79,7 @@ public class TestObjectArrayListIterator extends TestObjectArrayIterator {
         assertTrue("Iterator should now be empty", !iter.hasPrevious());
 
         try {
-            Object testValue = iter.previous();
+            iter.previous();
         } catch (Exception e) {
             assertTrue(
                 "NoSuchElementException must be thrown",
@@ -90,27 +91,28 @@ public class TestObjectArrayListIterator extends TestObjectArrayIterator {
     /**
      * 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((E[]) testData);
         int x = 0;
 
         while (iter.hasNext()) {
             iter.next();
-            iter.set(Integer.toString(x));
+            iter.set((E) Integer.toString(x));
             x++;
         }
 
         assertTrue("The two arrays should have the same value, i.e. {0,1,2}", Arrays.equals(testData, result));
 
         // a call to set() before a call to next() or previous() should throw an IllegalStateException
-        iter = makeArrayListIterator(testArray);
+        iter = makeArrayListIterator((E[]) 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/TestObjectArrayListIterator2.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestObjectArrayListIterator2.java b/src/test/org/apache/commons/collections/iterators/TestObjectArrayListIterator2.java
index 63e7c00..9ef2d31 100644
--- a/src/test/org/apache/commons/collections/iterators/TestObjectArrayListIterator2.java
+++ b/src/test/org/apache/commons/collections/iterators/TestObjectArrayListIterator2.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.
@@ -16,22 +16,20 @@
  */
 package org.apache.commons.collections.iterators;
 
-import java.util.ListIterator;
-
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
 /**
  * Tests the ObjectArrayListIterator class.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestObjectArrayListIterator2 extends AbstractTestListIterator {
+public class TestObjectArrayListIterator2<E> extends AbstractTestListIterator<E> {
 
     protected String[] testArray = { "One", "Two", "Three" };
-    
+
     public TestObjectArrayListIterator2(String testName) {
         super(testName);
     }
@@ -40,22 +38,24 @@ public class TestObjectArrayListIterator2 extends AbstractTestListIterator {
         return new TestSuite(TestObjectArrayListIterator2.class);
     }
 
-    public ListIterator makeEmptyListIterator() {
-        return new ObjectArrayListIterator(new Object[0]);
+    @SuppressWarnings("unchecked")
+    public ObjectArrayListIterator<E> makeEmptyIterator() {
+        return new ObjectArrayListIterator<E>((E[]) new Object[0]);
     }
 
-    public ListIterator makeFullListIterator() {
-        return new ObjectArrayListIterator(testArray);
+    @SuppressWarnings("unchecked")
+    public ObjectArrayListIterator<E> makeObject() {
+        return new ObjectArrayListIterator<E>((E[]) testArray);
     }
 
-    public ListIterator makeArrayListIterator(Object[] array) {
-        return new ObjectArrayListIterator(array);
+    public ObjectArrayListIterator<E> makeArrayListIterator(E[] array) {
+        return new ObjectArrayListIterator<E>(array);
     }
 
     public boolean supportsAdd() {
         return false;
     }
-    
+
     public boolean supportsRemove() {
         return false;
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/TestObjectGraphIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestObjectGraphIterator.java b/src/test/org/apache/commons/collections/iterators/TestObjectGraphIterator.java
index ca224db..69d0e3d 100644
--- a/src/test/org/apache/commons/collections/iterators/TestObjectGraphIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestObjectGraphIterator.java
@@ -35,14 +35,14 @@ import org.apache.commons.collections.Transformer;
  * 
  * @author Stephen Colebourne
  */
-public class TestObjectGraphIterator extends AbstractTestIterator {
+public class TestObjectGraphIterator extends AbstractTestIterator<Object> {
 
     protected String[] testArray = { "One", "Two", "Three", "Four", "Five", "Six" };
 
-    protected List list1 = null;
-    protected List list2 = null;
-    protected List list3 = null;
-    protected List iteratorList = null;
+    protected List<String> list1 = null;
+    protected List<String> list2 = null;
+    protected List<String> list3 = null;
+    protected List<Iterator<String>> iteratorList = null;
 
     public TestObjectGraphIterator(String testName) {
         super(testName);
@@ -57,34 +57,34 @@ public class TestObjectGraphIterator 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");
-        iteratorList = new ArrayList();
+        iteratorList = new ArrayList<Iterator<String>>();
         iteratorList.add(list1.iterator());
         iteratorList.add(list2.iterator());
         iteratorList.add(list3.iterator());
     }
 
     //-----------------------------------------------------------------------
-    public Iterator makeEmptyIterator() {
-        ArrayList list = new ArrayList();
-        return new ObjectGraphIterator(list.iterator(), null);
+    public ObjectGraphIterator<Object> makeEmptyIterator() {
+        ArrayList<Object> list = new ArrayList<Object>();
+        return new ObjectGraphIterator<Object>(list.iterator());
     }
 
-    public Iterator makeFullIterator() {
-        return new ObjectGraphIterator(iteratorList.iterator(), null);
+    public ObjectGraphIterator<Object> makeObject() {
+        return new ObjectGraphIterator<Object>(iteratorList.iterator());
     }
 
     //-----------------------------------------------------------------------
     public void testIteratorConstructor_null1() {
-        Iterator it = new ObjectGraphIterator(null);
+        Iterator<Object> it = new ObjectGraphIterator<Object>(null);
 
         assertEquals(false, it.hasNext());
         try {
@@ -100,7 +100,7 @@ public class TestObjectGraphIterator extends AbstractTestIterator {
     }
 
     public void testIteratorConstructor_null_next() {
-        Iterator it = new ObjectGraphIterator(null);
+        Iterator<Object> it = new ObjectGraphIterator<Object>(null);
         try {
             it.next();
             fail();
@@ -109,7 +109,7 @@ public class TestObjectGraphIterator extends AbstractTestIterator {
     }
 
     public void testIteratorConstructor_null_remove() {
-        Iterator it = new ObjectGraphIterator(null);
+        Iterator<Object> it = new ObjectGraphIterator<Object>(null);
         try {
             it.remove();
             fail();
@@ -119,8 +119,8 @@ public class TestObjectGraphIterator extends AbstractTestIterator {
 
     //-----------------------------------------------------------------------
     public void testIteratorConstructorIteration_Empty() {
-        List iteratorList = new ArrayList();
-        Iterator it = new ObjectGraphIterator(iteratorList.iterator());
+        List<Iterator<Object>> iteratorList = new ArrayList<Iterator<Object>>();
+        Iterator<Object> it = new ObjectGraphIterator<Object>(iteratorList.iterator());
 
         assertEquals(false, it.hasNext());
         try {
@@ -136,11 +136,11 @@ public class TestObjectGraphIterator extends AbstractTestIterator {
     }
 
     public void testIteratorConstructorIteration_Simple() {
-        List iteratorList = new ArrayList();
+        List<Iterator<String>> iteratorList = new ArrayList<Iterator<String>>();
         iteratorList.add(list1.iterator());
         iteratorList.add(list2.iterator());
         iteratorList.add(list3.iterator());
-        Iterator it = new ObjectGraphIterator(iteratorList.iterator());
+        Iterator<Object> it = new ObjectGraphIterator<Object>(iteratorList.iterator());
 
         for (int i = 0; i < 6; i++) {
             assertEquals(true, it.hasNext());
@@ -155,11 +155,11 @@ public class TestObjectGraphIterator extends AbstractTestIterator {
     }
 
     public void testIteratorConstructorIteration_SimpleNoHasNext() {
-        List iteratorList = new ArrayList();
+        List<Iterator<String>> iteratorList = new ArrayList<Iterator<String>>();
         iteratorList.add(list1.iterator());
         iteratorList.add(list2.iterator());
         iteratorList.add(list3.iterator());
-        Iterator it = new ObjectGraphIterator(iteratorList.iterator());
+        Iterator<Object> it = new ObjectGraphIterator<Object>(iteratorList.iterator());
 
         for (int i = 0; i < 6; i++) {
             assertEquals(testArray[i], it.next());
@@ -172,15 +172,15 @@ public class TestObjectGraphIterator extends AbstractTestIterator {
     }
 
     public void testIteratorConstructorIteration_WithEmptyIterators() {
-        List iteratorList = new ArrayList();
-        iteratorList.add(IteratorUtils.EMPTY_ITERATOR);
+        List<Iterator<String>> iteratorList = new ArrayList<Iterator<String>>();
+        iteratorList.add(IteratorUtils.<String>emptyIterator());
         iteratorList.add(list1.iterator());
-        iteratorList.add(IteratorUtils.EMPTY_ITERATOR);
+        iteratorList.add(IteratorUtils.<String>emptyIterator());
         iteratorList.add(list2.iterator());
-        iteratorList.add(IteratorUtils.EMPTY_ITERATOR);
+        iteratorList.add(IteratorUtils.<String>emptyIterator());
         iteratorList.add(list3.iterator());
-        iteratorList.add(IteratorUtils.EMPTY_ITERATOR);
-        Iterator it = new ObjectGraphIterator(iteratorList.iterator());
+        iteratorList.add(IteratorUtils.<String>emptyIterator());
+        Iterator<Object> it = new ObjectGraphIterator<Object>(iteratorList.iterator());
 
         for (int i = 0; i < 6; i++) {
             assertEquals(true, it.hasNext());
@@ -195,11 +195,11 @@ public class TestObjectGraphIterator extends AbstractTestIterator {
     }
 
     public void testIteratorConstructorRemove() {
-        List iteratorList = new ArrayList();
+        List<Iterator<String>> iteratorList = new ArrayList<Iterator<String>>();
         iteratorList.add(list1.iterator());
         iteratorList.add(list2.iterator());
         iteratorList.add(list3.iterator());
-        Iterator it = new ObjectGraphIterator(iteratorList.iterator());
+        Iterator<Object> it = new ObjectGraphIterator<Object>(iteratorList.iterator());
 
         for (int i = 0; i < 6; i++) {
             assertEquals(testArray[i], it.next());
@@ -213,11 +213,11 @@ public class TestObjectGraphIterator extends AbstractTestIterator {
 
     //-----------------------------------------------------------------------
     public void testIteration_IteratorOfIterators() {
-        List iteratorList = new ArrayList();
+        List<Iterator<String>> iteratorList = new ArrayList<Iterator<String>>();
         iteratorList.add(list1.iterator());
         iteratorList.add(list2.iterator());
         iteratorList.add(list3.iterator());
-        Iterator it = new ObjectGraphIterator(iteratorList.iterator(), null);
+        Iterator<Object> it = new ObjectGraphIterator<Object>(iteratorList.iterator(), null);
 
         for (int i = 0; i < 6; i++) {
             assertEquals(true, it.hasNext());
@@ -227,15 +227,15 @@ public class TestObjectGraphIterator extends AbstractTestIterator {
     }
 
     public void testIteration_IteratorOfIteratorsWithEmptyIterators() {
-        List iteratorList = new ArrayList();
-        iteratorList.add(IteratorUtils.EMPTY_ITERATOR);
+        List<Iterator<String>> iteratorList = new ArrayList<Iterator<String>>();
+        iteratorList.add(IteratorUtils.<String>emptyIterator());
         iteratorList.add(list1.iterator());
-        iteratorList.add(IteratorUtils.EMPTY_ITERATOR);
+        iteratorList.add(IteratorUtils.<String>emptyIterator());
         iteratorList.add(list2.iterator());
-        iteratorList.add(IteratorUtils.EMPTY_ITERATOR);
+        iteratorList.add(IteratorUtils.<String>emptyIterator());
         iteratorList.add(list3.iterator());
-        iteratorList.add(IteratorUtils.EMPTY_ITERATOR);
-        Iterator it = new ObjectGraphIterator(iteratorList.iterator(), null);
+        iteratorList.add(IteratorUtils.<String>emptyIterator());
+        Iterator<Object> it = new ObjectGraphIterator<Object>(iteratorList.iterator(), null);
 
         for (int i = 0; i < 6; i++) {
             assertEquals(true, it.hasNext());
@@ -246,7 +246,7 @@ public class TestObjectGraphIterator extends AbstractTestIterator {
 
     //-----------------------------------------------------------------------
     public void testIteration_RootNull() {
-        Iterator it = new ObjectGraphIterator(null, null);
+        Iterator<Object> it = new ObjectGraphIterator<Object>(null, null);
 
         assertEquals(false, it.hasNext());
         try {
@@ -263,7 +263,7 @@ public class TestObjectGraphIterator extends AbstractTestIterator {
 
     public void testIteration_RootNoTransformer() {
         Forest forest = new Forest();
-        Iterator it = new ObjectGraphIterator(forest, null);
+        Iterator<Object> it = new ObjectGraphIterator<Object>(forest, null);
 
         assertEquals(true, it.hasNext());
         assertSame(forest, it.next());
@@ -278,7 +278,7 @@ public class TestObjectGraphIterator extends AbstractTestIterator {
     public void testIteration_Transformed1() {
         Forest forest = new Forest();
         Leaf l1 = forest.addTree().addBranch().addLeaf();
-        Iterator it = new ObjectGraphIterator(forest, new LeafFinder());
+        Iterator<Object> it = new ObjectGraphIterator<Object>(forest, new LeafFinder());
 
         assertEquals(true, it.hasNext());
         assertSame(l1, it.next());
@@ -298,7 +298,7 @@ public class TestObjectGraphIterator extends AbstractTestIterator {
         Branch b1 = forest.getTree(0).addBranch();
         Branch b2 = forest.getTree(0).addBranch();
         Branch b3 = forest.getTree(2).addBranch();
-        Branch b4 = forest.getTree(2).addBranch();
+        /* Branch b4 = */ forest.getTree(2).addBranch();
         Branch b5 = forest.getTree(2).addBranch();
         Leaf l1 = b1.addLeaf();
         Leaf l2 = b1.addLeaf();
@@ -306,7 +306,7 @@ public class TestObjectGraphIterator extends AbstractTestIterator {
         Leaf l4 = b3.addLeaf();
         Leaf l5 = b5.addLeaf();
 
-        Iterator it = new ObjectGraphIterator(forest, new LeafFinder());
+        Iterator<Object> it = new ObjectGraphIterator<Object>(forest, new LeafFinder());
 
         assertEquals(true, it.hasNext());
         assertSame(l1, it.next());
@@ -335,14 +335,14 @@ public class TestObjectGraphIterator extends AbstractTestIterator {
         Branch b2 = forest.getTree(1).addBranch();
         Branch b3 = forest.getTree(2).addBranch();
         Branch b4 = forest.getTree(2).addBranch();
-        Branch b5 = forest.getTree(2).addBranch();
+        /* Branch b5 = */ forest.getTree(2).addBranch();
         Leaf l1 = b1.addLeaf();
         Leaf l2 = b1.addLeaf();
         Leaf l3 = b2.addLeaf();
         Leaf l4 = b3.addLeaf();
         Leaf l5 = b4.addLeaf();
 
-        Iterator it = new ObjectGraphIterator(forest, new LeafFinder());
+        Iterator<Object> it = new ObjectGraphIterator<Object>(forest, new LeafFinder());
 
         assertEquals(true, it.hasNext());
         assertSame(l1, it.next());
@@ -363,7 +363,7 @@ public class TestObjectGraphIterator extends AbstractTestIterator {
     }
 
     //-----------------------------------------------------------------------
-    static class LeafFinder implements Transformer {
+    static class LeafFinder implements Transformer<Object, Object> {
         public Object transform(Object input) {
             if (input instanceof Forest) {
                 return ((Forest) input).treeIterator();
@@ -383,7 +383,7 @@ public class TestObjectGraphIterator extends AbstractTestIterator {
 
     //-----------------------------------------------------------------------
     static class Forest {
-        List trees = new ArrayList();
+        List<Tree> trees = new ArrayList<Tree>();
 
         Tree addTree() {
             trees.add(new Tree());
@@ -394,13 +394,13 @@ public class TestObjectGraphIterator extends AbstractTestIterator {
             return (Tree) trees.get(index);
         }
 
-        Iterator treeIterator() {
+        Iterator<Tree> treeIterator() {
             return trees.iterator();
         }
     }
 
     static class Tree {
-        List branches = new ArrayList();
+        List<Branch> branches = new ArrayList<Branch>();
 
         Branch addBranch() {
             branches.add(new Branch());
@@ -411,13 +411,13 @@ public class TestObjectGraphIterator extends AbstractTestIterator {
             return (Branch) branches.get(index);
         }
 
-        Iterator branchIterator() {
+        Iterator<Branch> branchIterator() {
             return branches.iterator();
         }
     }
 
     static class Branch {
-        List leaves = new ArrayList();
+        List<Leaf> leaves = new ArrayList<Leaf>();
 
         Leaf addLeaf() {
             leaves.add(new Leaf());
@@ -428,7 +428,7 @@ public class TestObjectGraphIterator extends AbstractTestIterator {
             return (Leaf) leaves.get(index);
         }
 
-        Iterator leafIterator() {
+        Iterator<Leaf> leafIterator() {
             return leaves.iterator();
         }
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/TestReverseListIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestReverseListIterator.java b/src/test/org/apache/commons/collections/iterators/TestReverseListIterator.java
index 7520a28..86203c5 100644
--- a/src/test/org/apache/commons/collections/iterators/TestReverseListIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestReverseListIterator.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,7 +33,7 @@ import org.apache.commons.collections.ResettableListIterator;
  *
  * @version $Revision: $ $Date$
  */
-public class TestReverseListIterator extends AbstractTestListIterator {
+public class TestReverseListIterator<E> extends AbstractTestListIterator<E> {
 
     protected String[] testArray = { "One", "Two", "Three", "Four" };
 
@@ -50,33 +50,33 @@ public class TestReverseListIterator extends AbstractTestListIterator {
         super(testName);
     }
 
-    public ListIterator makeEmptyListIterator() {
-        List list = new ArrayList();
-        return new ReverseListIterator(list);
+    public ListIterator<E> makeEmptyIterator() {
+        return new ReverseListIterator<E>(new ArrayList<E>());
     }
 
-    public ListIterator makeFullListIterator() {
-        List list = new ArrayList(Arrays.asList(testArray));
-        return new ReverseListIterator(list);
+    @SuppressWarnings("unchecked")
+    public ReverseListIterator<E> makeObject() {
+        List<E> list = new ArrayList<E>(Arrays.asList((E[]) testArray));
+        return new ReverseListIterator<E>(list);
     }
 
     // overrides
     //-----------------------------------------------------------------------
     public void testEmptyListIteratorIsIndeedEmpty() {
-        ListIterator it = makeEmptyListIterator();
-        
+        ListIterator<E> it = makeEmptyIterator();
+
         assertEquals(false, it.hasNext());
         assertEquals(-1, it.nextIndex());  // reversed index
         assertEquals(false, it.hasPrevious());
         assertEquals(0, it.previousIndex());  // reversed index
-        
+
         // next() should throw a NoSuchElementException
         try {
             it.next();
             fail("NoSuchElementException must be thrown from empty ListIterator");
         } catch (NoSuchElementException e) {
         }
-        
+
         // previous() should throw a NoSuchElementException
         try {
             it.previous();
@@ -86,16 +86,16 @@ public class TestReverseListIterator extends AbstractTestListIterator {
     }
 
     public void testWalkForwardAndBack() {
-        ArrayList list = new ArrayList();
-        ListIterator it = makeFullListIterator();
+        ArrayList<E> list = new ArrayList<E>();
+        ListIterator<E> it = makeObject();
         while (it.hasNext()) {
             list.add(it.next());
         }
-        
+
         // check state at end
         assertEquals(false, it.hasNext());
         assertEquals(true, it.hasPrevious());
-        
+
         // this had to be commented out, as there is a bug in the JDK before JDK1.5
         // where calling previous at the start of an iterator would push the cursor
         // back to an invalid negative value
@@ -104,16 +104,16 @@ public class TestReverseListIterator extends AbstractTestListIterator {
 //            fail("NoSuchElementException must be thrown from next at end of ListIterator");
 //        } catch (NoSuchElementException e) {
 //        }
-        
+
         // loop back through comparing
         for (int i = list.size() - 1; i >= 0; i--) {
             assertEquals("" + i, list.size() - i - 2, it.nextIndex());  // reversed index
             assertEquals(list.size() - i - 1, it.previousIndex());  // reversed index
-            
+
             Object obj = list.get(i);
             assertEquals(obj, it.previous());
         }
-        
+
         // check state at start
         assertEquals(true, it.hasNext());
         assertEquals(false, it.hasPrevious());
@@ -126,7 +126,7 @@ public class TestReverseListIterator extends AbstractTestListIterator {
 
     //-----------------------------------------------------------------------
     public void testReverse() {
-        ListIterator it = makeFullListIterator();
+        ListIterator<E> it = makeObject();
         assertEquals(true, it.hasNext());
         assertEquals(3, it.nextIndex());
         assertEquals(false, it.hasPrevious());
@@ -158,7 +158,7 @@ public class TestReverseListIterator extends AbstractTestListIterator {
     }
 
     public void testReset() {
-        ResettableListIterator it = (ResettableListIterator) makeFullListIterator();
+        ResettableListIterator<E> it = makeObject();
         assertEquals("Four", it.next());
         it.reset();
         assertEquals("Four", it.next());

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/TestSingletonIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestSingletonIterator.java b/src/test/org/apache/commons/collections/iterators/TestSingletonIterator.java
index 9c0efad..7c22098 100644
--- a/src/test/org/apache/commons/collections/iterators/TestSingletonIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestSingletonIterator.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.
@@ -29,35 +29,36 @@ import org.apache.commons.collections.ResettableIterator;
  * perform the iteration rather than the hasNext() method.
  *
  * @version $Revision$ $Date$
- * 
+ *
  * @author James Strachan
  */
-public class TestSingletonIterator extends AbstractTestIterator {
+public class TestSingletonIterator<E> extends AbstractTestIterator<E> {
 
     private static final Object testValue = "foo";
-    
+
     public static Test suite() {
         return new TestSuite(TestSingletonIterator.class);
     }
-    
+
     public TestSingletonIterator(String testName) {
         super(testName);
     }
-    
+
     /**
-     * Returns a SingletonIterator from which 
+     * Returns a SingletonIterator from which
      * the element has already been removed.
      */
-    public Iterator makeEmptyIterator() {
-        SingletonIterator iter = (SingletonIterator)makeFullIterator();
+    public SingletonIterator<E> makeEmptyIterator() {
+        SingletonIterator<E> iter = makeObject();
         iter.next();
-        iter.remove();        
+        iter.remove();
         iter.reset();
         return iter;
     }
 
-    public Iterator makeFullIterator() {
-        return new SingletonIterator( testValue );
+    @SuppressWarnings("unchecked")
+    public SingletonIterator<E> makeObject() {
+        return new SingletonIterator<E>((E) testValue);
     }
 
     public boolean supportsRemove() {
@@ -69,10 +70,10 @@ public class TestSingletonIterator extends AbstractTestIterator {
     }
 
     public void testIterator() {
-        Iterator iter = (Iterator) makeObject();
+        Iterator<E> iter = makeObject();
         assertTrue("Iterator has a first item", iter.hasNext());
 
-        Object iterValue = iter.next();
+        E iterValue = iter.next();
         assertEquals("Iteration value is correct", testValue, iterValue);
 
         assertTrue("Iterator should now be empty", !iter.hasNext());
@@ -85,33 +86,34 @@ public class TestSingletonIterator extends AbstractTestIterator {
                 e.getClass().equals((new NoSuchElementException()).getClass()));
         }
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testSingletonIteratorRemove() {
-        ResettableIterator iter = new SingletonIterator("xyzzy");
+        ResettableIterator<E> iter = new SingletonIterator<E>((E) "xyzzy");
         assertTrue(iter.hasNext());
         assertEquals("xyzzy",iter.next());
         iter.remove();
         iter.reset();
         assertTrue(! iter.hasNext());
     }
-    
+
     public void testReset() {
-        ResettableIterator it = (ResettableIterator) makeObject();
-        
+        ResettableIterator<E> it = makeObject();
+
         assertEquals(true, it.hasNext());
         assertEquals(testValue, it.next());
         assertEquals(false, it.hasNext());
 
         it.reset();
-        
+
         assertEquals(true, it.hasNext());
         assertEquals(testValue, it.next());
         assertEquals(false, it.hasNext());
-        
+
         it.reset();
         it.reset();
-        
+
         assertEquals(true, it.hasNext());
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/TestSingletonIterator2.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestSingletonIterator2.java b/src/test/org/apache/commons/collections/iterators/TestSingletonIterator2.java
index 6318ccb..e76378d 100644
--- a/src/test/org/apache/commons/collections/iterators/TestSingletonIterator2.java
+++ b/src/test/org/apache/commons/collections/iterators/TestSingletonIterator2.java
@@ -32,7 +32,7 @@ import org.apache.commons.collections.ResettableIterator;
  * 
  * @author James Strachan
  */
-public class TestSingletonIterator2 extends AbstractTestIterator {
+public class TestSingletonIterator2<E> extends AbstractTestIterator<E> {
 
     private static final Object testValue = "foo";
 
@@ -45,16 +45,18 @@ public class TestSingletonIterator2 extends AbstractTestIterator {
     }
 
     //-----------------------------------------------------------------------
-    public Iterator makeEmptyIterator() {
-        SingletonIterator iter = new SingletonIterator(testValue);
+    @SuppressWarnings("unchecked")
+    public SingletonIterator<E> makeEmptyIterator() {
+        SingletonIterator<E> iter = new SingletonIterator<E>((E) testValue);
         iter.next();
         iter.remove();
         iter.reset();
         return iter;
     }
 
-    public Iterator makeFullIterator() {
-        return new SingletonIterator(testValue, false);
+    @SuppressWarnings("unchecked")
+    public SingletonIterator<E> makeObject() {
+        return new SingletonIterator<E>((E) testValue, false);
     }
 
     public boolean supportsRemove() {
@@ -67,10 +69,10 @@ public class TestSingletonIterator2 extends AbstractTestIterator {
 
     //-----------------------------------------------------------------------
     public void testIterator() {
-        Iterator iter = (Iterator) makeObject();
+        Iterator<E> iter = makeObject();
         assertTrue("Iterator has a first item", iter.hasNext());
 
-        Object iterValue = iter.next();
+        E iterValue = iter.next();
         assertEquals("Iteration value is correct", testValue, iterValue);
 
         assertTrue("Iterator should now be empty", !iter.hasNext());
@@ -85,7 +87,7 @@ public class TestSingletonIterator2 extends AbstractTestIterator {
     }
 
     public void testReset() {
-        ResettableIterator it = (ResettableIterator) makeObject();
+        ResettableIterator<E> it = makeObject();
 
         assertEquals(true, it.hasNext());
         assertEquals(testValue, it.next());

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java b/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java
index ef409d4..2132302 100644
--- a/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java
@@ -31,7 +31,7 @@ import org.apache.commons.collections.ResettableListIterator;
  * 
  * @author Stephen Colebourne
  */
-public class TestSingletonListIterator extends AbstractTestListIterator {
+public class TestSingletonListIterator<E> extends AbstractTestListIterator<E> {
 
     private static final Object testValue = "foo";
     
@@ -47,16 +47,17 @@ public class TestSingletonListIterator extends AbstractTestListIterator {
      * Returns a SingletonListIterator from which 
      * the element has already been removed.
      */
-    public ListIterator makeEmptyListIterator() {
-        SingletonListIterator iter = (SingletonListIterator)makeFullIterator();
+    public SingletonListIterator<E> makeEmptyIterator() {
+        SingletonListIterator<E> iter = makeObject();
         iter.next();
         iter.remove();
         iter.reset();        
         return iter;
     }
 
-    public ListIterator makeFullListIterator() {
-        return new SingletonListIterator( testValue );
+    @SuppressWarnings("unchecked")
+    public SingletonListIterator<E> makeObject() {
+        return new SingletonListIterator<E>((E) testValue);
     }
 
     public boolean supportsAdd() {
@@ -72,7 +73,7 @@ public class TestSingletonListIterator extends AbstractTestListIterator {
     }
 
     public void testIterator() {
-        ListIterator iter = (ListIterator) makeObject();
+        ListIterator<E> iter = makeObject();
         assertTrue( "Iterator should have next item", iter.hasNext() );
         assertTrue( "Iterator should have no previous item", !iter.hasPrevious() );
         assertEquals( "Iteration next index", 0, iter.nextIndex() );
@@ -118,7 +119,7 @@ public class TestSingletonListIterator extends AbstractTestListIterator {
     }
     
     public void testReset() {
-        ResettableListIterator it = (ResettableListIterator) makeObject();
+        ResettableListIterator<E> it = makeObject();
         
         assertEquals(true, it.hasNext());
         assertEquals(false, it.hasPrevious());

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/TestUniqueFilterIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestUniqueFilterIterator.java b/src/test/org/apache/commons/collections/iterators/TestUniqueFilterIterator.java
index f04f8c4..ba86b51 100644
--- a/src/test/org/apache/commons/collections/iterators/TestUniqueFilterIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestUniqueFilterIterator.java
@@ -34,13 +34,13 @@ import junit.framework.TestSuite;
  * @author Morgan Delagrange
  * @author Stephen Colebourne
  */
-public class TestUniqueFilterIterator extends AbstractTestIterator {
+public class TestUniqueFilterIterator<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(TestUniqueFilterIterator.class);
@@ -50,36 +50,36 @@ public class TestUniqueFilterIterator extends AbstractTestIterator {
         super(testName);
     }
 
+    @SuppressWarnings("unchecked")
     public void setUp() {
-        list1 = new ArrayList();
-        list1.add("One");
-        list1.add("Two");
-        list1.add("Three");
-        list1.add("Two");
-        list1.add("One");
-        list1.add("Four");
-        list1.add("Five");
-        list1.add("Five");
-        list1.add("Six");
-        list1.add("Five");
+        list1 = new ArrayList<E>();
+        list1.add((E) "One");
+        list1.add((E) "Two");
+        list1.add((E) "Three");
+        list1.add((E) "Two");
+        list1.add((E) "One");
+        list1.add((E) "Four");
+        list1.add((E) "Five");
+        list1.add((E) "Five");
+        list1.add((E) "Six");
+        list1.add((E) "Five");
     }
 
-    public Iterator makeEmptyIterator() {
-        ArrayList list = new ArrayList();
-        return new UniqueFilterIterator(list.iterator());
+    public UniqueFilterIterator<E> makeEmptyIterator() {
+        ArrayList<E> list = new ArrayList<E>();
+        return new UniqueFilterIterator<E>(list.iterator());
     }
 
-    public Iterator makeFullIterator() {
-        Iterator i = list1.iterator();
-
-        return new UniqueFilterIterator(i);
+    public UniqueFilterIterator<E> makeObject() {
+        Iterator<E> i = list1.iterator();
+        return new UniqueFilterIterator<E>(i);
     }
 
     public void testIterator() {
-        Iterator iter = (Iterator) makeFullIterator();
-        for ( int i = 0; i < testArray.length; i++ ) {
+        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 );
         }
@@ -87,7 +87,7 @@ public class TestUniqueFilterIterator 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", 
                        e.getClass().equals((new NoSuchElementException()).getClass()));

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/TestUnmodifiableIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestUnmodifiableIterator.java b/src/test/org/apache/commons/collections/iterators/TestUnmodifiableIterator.java
index 78bdcc1..05eac16 100644
--- a/src/test/org/apache/commons/collections/iterators/TestUnmodifiableIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestUnmodifiableIterator.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.
@@ -29,15 +29,15 @@ import org.apache.commons.collections.Unmodifiable;
 
 /**
  * Tests the UnmodifiableIterator.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestUnmodifiableIterator extends AbstractTestIterator {
+public class TestUnmodifiableIterator<E> extends AbstractTestIterator<E> {
 
     protected String[] testArray = { "One", "Two", "Three" };
-    protected List testList = new ArrayList(Arrays.asList(testArray));
+    protected List<E> testList;
 
     public static Test suite() {
         return new TestSuite(TestUnmodifiableIterator.class);
@@ -47,11 +47,21 @@ public class TestUnmodifiableIterator extends AbstractTestIterator {
         super(testName);
     }
 
-    public Iterator makeEmptyIterator() {
-        return UnmodifiableIterator.decorate(Collections.EMPTY_LIST.iterator());
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        testList = new ArrayList<E>(Arrays.asList((E[]) testArray));
     }
 
-    public Iterator makeFullIterator() {
+    public Iterator<E> makeEmptyIterator() {
+        return UnmodifiableIterator.decorate(Collections.<E>emptyList().iterator());
+    }
+
+    public Iterator<E> makeObject() {
         return UnmodifiableIterator.decorate(testList.iterator());
     }
 
@@ -63,14 +73,14 @@ public class TestUnmodifiableIterator extends AbstractTestIterator {
     public void testIterator() {
         assertTrue(makeEmptyIterator() instanceof Unmodifiable);
     }
-    
+
     public void testDecorateFactory() {
-        Iterator it = makeFullIterator();
+        Iterator<E> it = makeObject();
         assertSame(it, UnmodifiableIterator.decorate(it));
-        
+
         it = testList.iterator();
         assertTrue(it != UnmodifiableIterator.decorate(it));
-        
+
         try {
             UnmodifiableIterator.decorate(null);
             fail();

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/TestUnmodifiableListIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestUnmodifiableListIterator.java b/src/test/org/apache/commons/collections/iterators/TestUnmodifiableListIterator.java
index 4f5afb7..e7275e2 100644
--- a/src/test/org/apache/commons/collections/iterators/TestUnmodifiableListIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestUnmodifiableListIterator.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.
@@ -29,15 +29,15 @@ import org.apache.commons.collections.Unmodifiable;
 
 /**
  * Tests the UnmodifiableListIterator.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestUnmodifiableListIterator extends AbstractTestListIterator {
+public class TestUnmodifiableListIterator<E> extends AbstractTestListIterator<E> {
 
     protected String[] testArray = { "One", "Two", "Three" };
-    protected List testList = new ArrayList(Arrays.asList(testArray));
+    protected List<E> testList;
 
     public static Test suite() {
         return new TestSuite(TestUnmodifiableListIterator.class);
@@ -47,11 +47,21 @@ public class TestUnmodifiableListIterator extends AbstractTestListIterator {
         super(testName);
     }
 
-    public ListIterator makeEmptyListIterator() {
-        return UnmodifiableListIterator.decorate(Collections.EMPTY_LIST.listIterator());
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        testList = new ArrayList<E>(Arrays.asList((E[]) testArray));
     }
 
-    public ListIterator makeFullListIterator() {
+    public ListIterator<E> makeEmptyIterator() {
+        return UnmodifiableListIterator.decorate(Collections.<E>emptyList().listIterator());
+    }
+
+    public ListIterator<E> makeObject() {
         return UnmodifiableListIterator.decorate(testList.listIterator());
     }
 
@@ -69,16 +79,16 @@ public class TestUnmodifiableListIterator extends AbstractTestListIterator {
 
     //-----------------------------------------------------------------------
     public void testListIterator() {
-        assertTrue(makeEmptyListIterator() instanceof Unmodifiable);
+        assertTrue(makeEmptyIterator() instanceof Unmodifiable);
     }
-    
+
     public void testDecorateFactory() {
-        ListIterator it = makeFullListIterator();
+        ListIterator<E> it = makeObject();
         assertSame(it, UnmodifiableListIterator.decorate(it));
-        
+
         it = testList.listIterator();
         assertTrue(it != UnmodifiableListIterator.decorate(it));
-        
+
         try {
             UnmodifiableListIterator.decorate(null);
             fail();

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/TestUnmodifiableMapIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestUnmodifiableMapIterator.java b/src/test/org/apache/commons/collections/iterators/TestUnmodifiableMapIterator.java
index ed7fd44..828db76 100644
--- a/src/test/org/apache/commons/collections/iterators/TestUnmodifiableMapIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestUnmodifiableMapIterator.java
@@ -22,19 +22,19 @@ import java.util.Map;
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-import org.apache.commons.collections.BidiMap;
+import org.apache.commons.collections.IterableMap;
 import org.apache.commons.collections.MapIterator;
 import org.apache.commons.collections.Unmodifiable;
 import org.apache.commons.collections.bidimap.DualHashBidiMap;
 
 /**
  * Tests the UnmodifiableMapIterator.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestUnmodifiableMapIterator extends AbstractTestMapIterator {
+public class TestUnmodifiableMapIterator<K, V> extends AbstractTestMapIterator<K, V> {
 
     public static Test suite() {
         return new TestSuite(TestUnmodifiableMapIterator.class);
@@ -44,27 +44,29 @@ public class TestUnmodifiableMapIterator extends AbstractTestMapIterator {
         super(testName);
     }
 
-    public MapIterator makeEmptyMapIterator() {
-        return UnmodifiableMapIterator.decorate(new DualHashBidiMap().mapIterator());
+    public MapIterator<K, V> makeEmptyIterator() {
+        return UnmodifiableMapIterator.decorate(new DualHashBidiMap<K, V>().mapIterator());
     }
 
-    public MapIterator makeFullMapIterator() {
-        return UnmodifiableMapIterator.decorate(((BidiMap) getMap()).mapIterator());
+    public MapIterator<K, V> makeObject() {
+        return UnmodifiableMapIterator.decorate(getMap().mapIterator());
     }
-    
-    public Map getMap() {
-        Map testMap = new DualHashBidiMap();
-        testMap.put("A", "a");
-        testMap.put("B", "b");
-        testMap.put("C", "c");
+
+    @SuppressWarnings("unchecked")
+    public IterableMap<K, V> getMap() {
+        IterableMap<K, V> testMap = new DualHashBidiMap<K, V>();
+        testMap.put((K) "A", (V) "a");
+        testMap.put((K) "B", (V)"b");
+        testMap.put((K) "C", (V) "c");
         return testMap;
     }
 
-    public Map getConfirmedMap() {
-        Map testMap = new HashMap();
-        testMap.put("A", "a");
-        testMap.put("B", "b");
-        testMap.put("C", "c");
+    @SuppressWarnings("unchecked")
+    public Map<K, V> getConfirmedMap() {
+        Map<K, V> testMap = new HashMap<K, V>();
+        testMap.put((K) "A", (V) "a");
+        testMap.put((K) "B", (V)"b");
+        testMap.put((K) "C", (V) "c");
         return testMap;
     }
 
@@ -75,19 +77,19 @@ public class TestUnmodifiableMapIterator extends AbstractTestMapIterator {
     public boolean supportsSetValue() {
         return false;
     }
-    
+
     //-----------------------------------------------------------------------
     public void testMapIterator() {
-        assertTrue(makeEmptyMapIterator() instanceof Unmodifiable);
+        assertTrue(makeEmptyIterator() instanceof Unmodifiable);
     }
-    
+
     public void testDecorateFactory() {
-        MapIterator it = makeFullMapIterator();
+        MapIterator<K, V> it = makeObject();
         assertSame(it, UnmodifiableMapIterator.decorate(it));
-        
-        it = ((BidiMap) getMap()).mapIterator() ;
+
+        it = getMap().mapIterator() ;
         assertTrue(it != UnmodifiableMapIterator.decorate(it));
-        
+
         try {
             UnmodifiableMapIterator.decorate(null);
             fail();

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/TestUnmodifiableOrderedMapIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestUnmodifiableOrderedMapIterator.java b/src/test/org/apache/commons/collections/iterators/TestUnmodifiableOrderedMapIterator.java
index fddec8a..9dcb26d 100644
--- a/src/test/org/apache/commons/collections/iterators/TestUnmodifiableOrderedMapIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestUnmodifiableOrderedMapIterator.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.
@@ -23,7 +23,6 @@ import java.util.TreeMap;
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-import org.apache.commons.collections.MapIterator;
 import org.apache.commons.collections.OrderedMap;
 import org.apache.commons.collections.OrderedMapIterator;
 import org.apache.commons.collections.Unmodifiable;
@@ -31,12 +30,12 @@ import org.apache.commons.collections.map.ListOrderedMap;
 
 /**
  * Tests the UnmodifiableOrderedMapIterator.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestUnmodifiableOrderedMapIterator extends AbstractTestOrderedMapIterator {
+public class TestUnmodifiableOrderedMapIterator<K, V> extends AbstractTestOrderedMapIterator<K, V> {
 
     public static Test suite() {
         return new TestSuite(TestUnmodifiableOrderedMapIterator.class);
@@ -46,29 +45,30 @@ public class TestUnmodifiableOrderedMapIterator extends AbstractTestOrderedMapIt
         super(testName);
     }
 
-    public MapIterator makeEmptyMapIterator() {
+    public OrderedMapIterator<K, V> makeEmptyIterator() {
         return UnmodifiableOrderedMapIterator.decorate(
-            ListOrderedMap.decorate(new HashMap()).orderedMapIterator());
+                ListOrderedMap.decorate(new HashMap<K, V>()).mapIterator());
     }
 
-    public MapIterator makeFullMapIterator() {
-        return UnmodifiableOrderedMapIterator.decorate(
-            ((OrderedMap) getMap()).orderedMapIterator());
+    public OrderedMapIterator<K, V> makeObject() {
+        return UnmodifiableOrderedMapIterator.decorate(getMap().mapIterator());
     }
-    
-    public Map getMap() {
-        Map testMap = ListOrderedMap.decorate(new HashMap());
-        testMap.put("A", "a");
-        testMap.put("B", "b");
-        testMap.put("C", "c");
+
+    @SuppressWarnings("unchecked")
+    public OrderedMap<K, V> getMap() {
+        OrderedMap<K, V> testMap = ListOrderedMap.decorate(new HashMap<K, V>());
+        testMap.put((K) "A", (V) "a");
+        testMap.put((K) "B", (V) "b");
+        testMap.put((K) "C", (V) "c");
         return testMap;
     }
 
-    public Map getConfirmedMap() {
-        Map testMap = new TreeMap();
-        testMap.put("A", "a");
-        testMap.put("B", "b");
-        testMap.put("C", "c");
+    @SuppressWarnings("unchecked")
+    public Map<K, V> getConfirmedMap() {
+        Map<K, V> testMap = new TreeMap<K, V>();
+        testMap.put((K) "A", (V) "a");
+        testMap.put((K) "B", (V) "b");
+        testMap.put((K) "C", (V) "c");
         return testMap;
     }
 
@@ -79,19 +79,19 @@ public class TestUnmodifiableOrderedMapIterator extends AbstractTestOrderedMapIt
     public boolean supportsSetValue() {
         return false;
     }
-    
+
     //-----------------------------------------------------------------------
     public void testOrderedMapIterator() {
-        assertTrue(makeEmptyOrderedMapIterator() instanceof Unmodifiable);
+        assertTrue(makeEmptyIterator() instanceof Unmodifiable);
     }
-    
+
     public void testDecorateFactory() {
-        OrderedMapIterator it = makeFullOrderedMapIterator();
+        OrderedMapIterator<K, V> it = makeObject();
         assertSame(it, UnmodifiableOrderedMapIterator.decorate(it));
-        
-        it = ((OrderedMap) getMap()).orderedMapIterator() ;
+
+        it = getMap().mapIterator() ;
         assertTrue(it != UnmodifiableOrderedMapIterator.decorate(it));
-        
+
         try {
             UnmodifiableOrderedMapIterator.decorate(null);
             fail();

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/keyvalue/AbstractTestMapEntry.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/keyvalue/AbstractTestMapEntry.java b/src/test/org/apache/commons/collections/keyvalue/AbstractTestMapEntry.java
index e463e6a..5ae427a 100644
--- a/src/test/org/apache/commons/collections/keyvalue/AbstractTestMapEntry.java
+++ b/src/test/org/apache/commons/collections/keyvalue/AbstractTestMapEntry.java
@@ -33,7 +33,7 @@ import junit.framework.TestCase;
  * 
  * @author Neil O'Toole
  */
-public abstract class AbstractTestMapEntry extends TestCase {
+public abstract class AbstractTestMapEntry<K, V> extends TestCase {
     
     protected final String key = "name";
     protected final String value = "duke";
@@ -53,7 +53,7 @@ public abstract class AbstractTestMapEntry extends TestCase {
      * This implementation simply calls {@link #makeMapEntry(Object, Object)}
      * with null for key and value. Subclasses can override this method if desired.
      */
-    public Map.Entry makeMapEntry() {
+    public Map.Entry<K, V> makeMapEntry() {
         return makeMapEntry(null, null);
     }
 
@@ -62,32 +62,33 @@ public abstract class AbstractTestMapEntry extends TestCase {
      * Subclasses should override this method to return a Map.Entry
      * of the type being tested.
      */
-    public abstract Map.Entry makeMapEntry(Object key, Object value);
+    public abstract Map.Entry<K, V> makeMapEntry(K key, V value);
 
     /**
      * Makes a Map.Entry of a type that's known to work correctly.
      */
-    public Map.Entry makeKnownMapEntry() {
+    public Map.Entry<K, V> makeKnownMapEntry() {
         return makeKnownMapEntry(null, null);
     }
 
     /**
      * Makes a Map.Entry of a type that's known to work correctly.
      */
-    public Map.Entry makeKnownMapEntry(Object key, Object value) {
-        Map map = new HashMap(1);
+    public Map.Entry<K, V> makeKnownMapEntry(K key, V value) {
+        Map<K, V> map = new HashMap<K, V>(1);
         map.put(key, value);
-        Map.Entry entry = (Map.Entry) map.entrySet().iterator().next();
+        Map.Entry<K, V> entry = map.entrySet().iterator().next();
         return entry;
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testAccessorsAndMutators() {
-        Map.Entry entry = makeMapEntry(key, value);
+        Map.Entry<K, V> entry = makeMapEntry((K) key, (V) value);
 
         assertTrue(entry.getKey() == key);
 
-        entry.setValue(value);
+        entry.setValue((V) value);
         assertTrue(entry.getValue() == value);
 
         // check that null doesn't do anything funny
@@ -105,15 +106,16 @@ public abstract class AbstractTestMapEntry extends TestCase {
      *
      */
 
+    @SuppressWarnings("unchecked")
     public void testSelfReferenceHandling() {
         // test that #setValue does not permit
         //  the MapEntry to contain itself (and thus cause infinite recursion
         //  in #hashCode and #toString)
 
-        Map.Entry entry = makeMapEntry();
+        Map.Entry<K, V> entry = makeMapEntry();
 
         try {
-            entry.setValue(entry);
+            entry.setValue((V) entry);
             fail("Should throw an IllegalArgumentException");
         } catch (IllegalArgumentException iae) {
             // expected to happen...
@@ -129,10 +131,11 @@ public abstract class AbstractTestMapEntry extends TestCase {
      */
     public abstract void testConstructors();
 
+    @SuppressWarnings("unchecked")
     public void testEqualsAndHashCode() {
         // 1. test with object data
-        Map.Entry e1 = makeMapEntry(key, value);
-        Map.Entry e2 = makeKnownMapEntry(key, value);
+        Map.Entry<K, V> e1 = makeMapEntry((K) key, (V) value);
+        Map.Entry<K, V> e2 = makeKnownMapEntry((K) key, (V) value);
 
         assertTrue(e1.equals(e1));
         assertTrue(e2.equals(e1));
@@ -149,8 +152,9 @@ public abstract class AbstractTestMapEntry extends TestCase {
         assertTrue(e1.hashCode() == e2.hashCode());
     }
 
+    @SuppressWarnings("unchecked")
     public void testToString() {
-        Map.Entry entry = makeMapEntry(key, value);
+        Map.Entry<K, V> entry = makeMapEntry((K) key, (V) value);
         assertTrue(entry.toString().equals(entry.getKey() + "=" + entry.getValue()));
 
         // test with nulls

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/keyvalue/TestDefaultKeyValue.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/keyvalue/TestDefaultKeyValue.java b/src/test/org/apache/commons/collections/keyvalue/TestDefaultKeyValue.java
index 4ae8892..b820959 100644
--- a/src/test/org/apache/commons/collections/keyvalue/TestDefaultKeyValue.java
+++ b/src/test/org/apache/commons/collections/keyvalue/TestDefaultKeyValue.java
@@ -31,7 +31,7 @@ import junit.framework.TestSuite;
  * 
  * @author Neil O'Toole
  */
-public class TestDefaultKeyValue extends TestCase {
+public class TestDefaultKeyValue<K, V> extends TestCase {
     
     private final String key = "name";
     private final String value = "duke";
@@ -60,8 +60,8 @@ public class TestDefaultKeyValue extends TestCase {
      * Subclasses should override this method to return a DefaultKeyValue
      * of the type being tested.
      */
-    protected DefaultKeyValue makeDefaultKeyValue() {
-        return new DefaultKeyValue(null, null);
+    protected DefaultKeyValue<K, V> makeDefaultKeyValue() {
+        return new DefaultKeyValue<K, V>(null, null);
     }
 
     /**
@@ -69,18 +69,19 @@ public class TestDefaultKeyValue extends TestCase {
      * Subclasses should override this method to return a DefaultKeyValue
      * of the type being tested.
      */
-    protected DefaultKeyValue makeDefaultKeyValue(Object key, Object value) {
-        return new DefaultKeyValue(key, value);
+    protected DefaultKeyValue<K, V> makeDefaultKeyValue(K key, V value) {
+        return new DefaultKeyValue<K, V>(key, value);
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testAccessorsAndMutators() {
-        DefaultKeyValue kv = makeDefaultKeyValue();
+        DefaultKeyValue<K, V> kv = makeDefaultKeyValue();
 
-        kv.setKey(key);
+        kv.setKey((K) key);
         assertTrue(kv.getKey() == key);
 
-        kv.setValue(value);
+        kv.setValue((V) value);
         assertTrue(kv.getValue() == value);
 
         // check that null doesn't do anything funny
@@ -92,15 +93,16 @@ public class TestDefaultKeyValue extends TestCase {
 
     }
 
+    @SuppressWarnings("unchecked")
     public void testSelfReferenceHandling() {
         // test that #setKey and #setValue do not permit
         //  the KVP to contain itself (and thus cause infinite recursion
         //  in #hashCode and #toString)
 
-        DefaultKeyValue kv = makeDefaultKeyValue();
+        DefaultKeyValue<K, V> kv = makeDefaultKeyValue();
 
         try {
-            kv.setKey(kv);
+            kv.setKey((K) kv);
             fail("Should throw an IllegalArgumentException");
         } catch (IllegalArgumentException iae) {
             // expected to happen...
@@ -110,7 +112,7 @@ public class TestDefaultKeyValue extends TestCase {
         }
 
         try {
-            kv.setValue(kv);
+            kv.setValue((V) kv);
             fail("Should throw an IllegalArgumentException");
         } catch (IllegalArgumentException iae) {
             // expected to happen...
@@ -123,17 +125,18 @@ public class TestDefaultKeyValue extends TestCase {
     /**
      * Subclasses should override this method to test their own constructors.
      */
+    @SuppressWarnings("unchecked")
     public void testConstructors() {
         // 1. test default constructor
-        DefaultKeyValue kv = new DefaultKeyValue();
+        DefaultKeyValue<K, V> kv = new DefaultKeyValue<K, V>();
         assertTrue(kv.getKey() == null && kv.getValue() == null);
 
         // 2. test key-value constructor
-        kv = new DefaultKeyValue(key, value);
+        kv = new DefaultKeyValue<K, V>((K) key, (V) value);
         assertTrue(kv.getKey() == key && kv.getValue() == value);
 
         // 3. test copy constructor
-        DefaultKeyValue kv2 = new DefaultKeyValue(kv);
+        DefaultKeyValue<K, V> kv2 = new DefaultKeyValue<K, V>(kv);
         assertTrue(kv2.getKey() == key && kv2.getValue() == value);
 
         // test that the KVPs are independent
@@ -143,11 +146,11 @@ public class TestDefaultKeyValue extends TestCase {
         assertTrue(kv2.getKey() == key && kv2.getValue() == value);
 
         // 4. test Map.Entry constructor
-        Map map = new HashMap();
-        map.put(key, value);
-        Map.Entry entry = (Map.Entry) map.entrySet().iterator().next();
+        Map<K, V> map = new HashMap<K, V>();
+        map.put((K) key, (V) value);
+        Map.Entry<K, V> entry = map.entrySet().iterator().next();
 
-        kv = new DefaultKeyValue(entry);
+        kv = new DefaultKeyValue<K, V>(entry);
         assertTrue(kv.getKey() == key && kv.getValue() == value);
 
         // test that the KVP is independent of the Map.Entry
@@ -156,10 +159,11 @@ public class TestDefaultKeyValue extends TestCase {
 
     }
 
+    @SuppressWarnings("unchecked")
     public void testEqualsAndHashCode() {
         // 1. test with object data
-        DefaultKeyValue kv = makeDefaultKeyValue(key, value);
-        DefaultKeyValue kv2 = makeDefaultKeyValue(key, value);
+        DefaultKeyValue<K, V> kv = makeDefaultKeyValue((K) key, (V) value);
+        DefaultKeyValue<K, V> kv2 = makeDefaultKeyValue((K) key, (V) value);
 
         assertTrue(kv.equals(kv));
         assertTrue(kv.equals(kv2));
@@ -174,8 +178,9 @@ public class TestDefaultKeyValue extends TestCase {
         assertTrue(kv.hashCode() == kv2.hashCode());
     }
 
+    @SuppressWarnings("unchecked")
     public void testToString() {
-        DefaultKeyValue kv = makeDefaultKeyValue(key, value);
+        DefaultKeyValue<K, V> kv = makeDefaultKeyValue((K) key, (V) value);
         assertTrue(kv.toString().equals(kv.getKey() + "=" + kv.getValue()));
 
         // test with nulls
@@ -183,12 +188,13 @@ public class TestDefaultKeyValue extends TestCase {
         assertTrue(kv.toString().equals(kv.getKey() + "=" + kv.getValue()));
     }
 
+    @SuppressWarnings("unchecked")
     public void testToMapEntry() {
-        DefaultKeyValue kv = makeDefaultKeyValue(key, value);
+        DefaultKeyValue<K, V> kv = makeDefaultKeyValue((K) key, (V) value);
 
-        Map map = new HashMap();
+        Map<K, V> map = new HashMap<K, V>();
         map.put(kv.getKey(), kv.getValue());
-        Map.Entry entry = (Map.Entry) map.entrySet().iterator().next();
+        Map.Entry<K, V> entry = map.entrySet().iterator().next();
 
         assertTrue(entry.equals(kv.toMapEntry()));
         assertTrue(entry.hashCode() == kv.hashCode());

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/keyvalue/TestDefaultMapEntry.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/keyvalue/TestDefaultMapEntry.java b/src/test/org/apache/commons/collections/keyvalue/TestDefaultMapEntry.java
index 60e3e5c..cba3503 100644
--- a/src/test/org/apache/commons/collections/keyvalue/TestDefaultMapEntry.java
+++ b/src/test/org/apache/commons/collections/keyvalue/TestDefaultMapEntry.java
@@ -31,11 +31,10 @@ import org.apache.commons.collections.KeyValue;
  * 
  * @author Neil O'Toole
  */
-public class TestDefaultMapEntry extends AbstractTestMapEntry {
+public class TestDefaultMapEntry<K, V> extends AbstractTestMapEntry<K, V> {
 
     public TestDefaultMapEntry(String testName) {
         super(testName);
-
     }
 
     public static void main(String[] args) {
@@ -52,8 +51,8 @@ public class TestDefaultMapEntry extends AbstractTestMapEntry {
      * Subclasses should override this method to return a Map.Entry
      * of the type being tested.
      */
-    public Map.Entry makeMapEntry() {
-        return new DefaultMapEntry(null, null);
+    public Map.Entry<K, V> makeMapEntry() {
+        return new DefaultMapEntry<K, V>(null, null);
     }
 
     /**
@@ -61,8 +60,8 @@ public class TestDefaultMapEntry extends AbstractTestMapEntry {
      * Subclasses should override this method to return a Map.Entry
      * of the type being tested.
      */
-    public Map.Entry makeMapEntry(Object key, Object value) {
-        return new DefaultMapEntry(key, value);
+    public Map.Entry<K, V> makeMapEntry(K key, V value) {
+        return new DefaultMapEntry<K, V>(key, value);
     }
 
     //-----------------------------------------------------------------------
@@ -70,19 +69,20 @@ public class TestDefaultMapEntry extends AbstractTestMapEntry {
      * Subclasses should override this method.
      *
      */
+    @SuppressWarnings("unchecked")
     public void testConstructors() {
         // 1. test key-value constructor
-        Map.Entry entry = new DefaultMapEntry(key, value);
+        Map.Entry<K, V> entry = new DefaultMapEntry<K, V>((K) key, (V) value);
         assertSame(key, entry.getKey());
         assertSame(value, entry.getValue());
 
         // 2. test pair constructor
-        KeyValue pair = new DefaultKeyValue(key, value);
+        KeyValue<K, V> pair = new DefaultKeyValue<K, V>((K) key, (V) value);
         assertSame(key, pair.getKey());
         assertSame(value, pair.getValue());
 
         // 3. test copy constructor
-        Map.Entry entry2 = new DefaultMapEntry(entry);
+        Map.Entry<K, V> entry2 = new DefaultMapEntry<K, V>(entry);
         assertSame(key, entry2.getKey());
         assertSame(value, entry2.getValue());
 
@@ -91,11 +91,12 @@ public class TestDefaultMapEntry extends AbstractTestMapEntry {
         assertSame(value, entry2.getValue());
     }
 
+    @SuppressWarnings("unchecked")
     public void testSelfReferenceHandling() {
-        Map.Entry entry = makeMapEntry();
+        Map.Entry<K, V> entry = makeMapEntry();
 
         try {
-            entry.setValue(entry);
+            entry.setValue((V) entry);
             assertSame(entry, entry.getValue());
 
         } catch (Exception e) {


Mime
View raw message