You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ch...@apache.org on 2017/07/11 17:54:46 UTC

[01/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Repository: commons-collections
Updated Branches:
  refs/heads/collections_jdk5_branch [created] 76d7c4078


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestListOrderedSet.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/TestListOrderedSet.java b/src/test/org/apache/commons/collections/set/TestListOrderedSet.java
index 1f89bd1..19fe97d 100644
--- a/src/test/org/apache/commons/collections/set/TestListOrderedSet.java
+++ b/src/test/org/apache/commons/collections/set/TestListOrderedSet.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.
@@ -31,11 +31,16 @@ import junit.framework.TestSuite;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Henning P. Schmiedehausen
  * @author Stephen Colebourne
  */
-public class TestListOrderedSet extends AbstractTestSet {
+public class TestListOrderedSet<E> extends AbstractTestSet<E> {
+
+    private static final Integer ZERO = new Integer(0);
+    private static final Integer ONE = new Integer(1);
+    private static final Integer TWO = new Integer(2);
+    private static final Integer THREE = new Integer(3);
 
     public TestListOrderedSet(String testName) {
         super(testName);
@@ -50,22 +55,24 @@ public class TestListOrderedSet extends AbstractTestSet {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Set makeEmptySet() {
-        return ListOrderedSet.decorate(new HashSet());
+    public ListOrderedSet<E> makeObject() {
+        return ListOrderedSet.decorate(new HashSet<E>());
     }
 
-    protected Set setupSet() {
-        Set set = makeEmptySet();
+    @SuppressWarnings("unchecked")
+    protected ListOrderedSet<E> setupSet() {
+        ListOrderedSet<E> set = makeObject();
 
         for (int i = 0; i < 10; i++) {
-            set.add(Integer.toString(i));
+            set.add((E) Integer.toString(i));
         }
         return set;
     }
 
+    @SuppressWarnings("unchecked")
     public void testOrdering() {
-        Set set = setupSet();
-        Iterator it = set.iterator();
+        ListOrderedSet<E> set = setupSet();
+        Iterator<E> it = set.iterator();
 
         for (int i = 0; i < 10; i++) {
             assertEquals("Sequence is wrong", Integer.toString(i), it.next());
@@ -81,7 +88,7 @@ public class TestListOrderedSet extends AbstractTestSet {
         }
 
         for (int i = 0; i < 10; i++) {
-            set.add(Integer.toString(i));
+            set.add((E) Integer.toString(i));
         }
 
         assertEquals("Size of set is wrong!", 10, set.size());
@@ -94,19 +101,15 @@ public class TestListOrderedSet extends AbstractTestSet {
             assertEquals("Sequence is wrong", Integer.toString(i), it.next());
         }
     }
-    
-    private static final Integer ZERO = new Integer(0);
-    private static final Integer ONE = new Integer(1);
-    private static final Integer TWO = new Integer(2);
-    private static final Integer THREE = new Integer(3);
-    
+
+    @SuppressWarnings("unchecked")
     public void testListAddRemove() {
-        ListOrderedSet set = (ListOrderedSet) makeEmptySet();
-        List view = set.asList();
-        set.add(ZERO);
-        set.add(ONE);
-        set.add(TWO);
-        
+        ListOrderedSet<E> set = makeObject();
+        List<E> view = set.asList();
+        set.add((E) ZERO);
+        set.add((E) ONE);
+        set.add((E) TWO);
+
         assertEquals(3, set.size());
         assertSame(ZERO, set.get(0));
         assertSame(ONE, set.get(1));
@@ -115,11 +118,11 @@ public class TestListOrderedSet extends AbstractTestSet {
         assertSame(ZERO, view.get(0));
         assertSame(ONE, view.get(1));
         assertSame(TWO, view.get(2));
-        
+
         assertEquals(0, set.indexOf(ZERO));
         assertEquals(1, set.indexOf(ONE));
         assertEquals(2, set.indexOf(TWO));
-        
+
         set.remove(1);
         assertEquals(2, set.size());
         assertSame(ZERO, set.get(0));
@@ -127,36 +130,37 @@ public class TestListOrderedSet extends AbstractTestSet {
         assertEquals(2, view.size());
         assertSame(ZERO, view.get(0));
         assertSame(TWO, view.get(1));
-    }        
-    
+    }
+
+    @SuppressWarnings("unchecked")
     public void testListAddIndexed() {
-        ListOrderedSet set = (ListOrderedSet) makeEmptySet();
-        set.add(ZERO);
-        set.add(TWO);
-        
-        set.add(1, ONE);
+        ListOrderedSet<E> set = makeObject();
+        set.add((E) ZERO);
+        set.add((E) TWO);
+
+        set.add(1, (E) ONE);
         assertEquals(3, set.size());
         assertSame(ZERO, set.get(0));
         assertSame(ONE, set.get(1));
         assertSame(TWO, set.get(2));
-        
-        set.add(0, ONE);
+
+        set.add(0, (E) ONE);
         assertEquals(3, set.size());
         assertSame(ZERO, set.get(0));
         assertSame(ONE, set.get(1));
         assertSame(TWO, set.get(2));
-        
-        List list = new ArrayList();
-        list.add(ZERO);
-        list.add(TWO);
-        
+
+        List<E> list = new ArrayList<E>();
+        list.add((E) ZERO);
+        list.add((E) TWO);
+
         set.addAll(0, list);
         assertEquals(3, set.size());
         assertSame(ZERO, set.get(0));
         assertSame(ONE, set.get(1));
         assertSame(TWO, set.get(2));
-        
-        list.add(0, THREE); // list = [3,0,2]
+
+        list.add(0, (E) THREE); // list = [3,0,2]
         set.remove(TWO);    //  set = [0,1]
         set.addAll(1, list);
         assertEquals(4, set.size());
@@ -166,13 +170,14 @@ public class TestListOrderedSet extends AbstractTestSet {
         assertSame(ONE, set.get(3));
     }
 
+    @SuppressWarnings("unchecked")
     public void testListAddReplacing() {
-        ListOrderedSet set = (ListOrderedSet) makeEmptySet();
+        ListOrderedSet<E> set = makeObject();
         A a = new A();
         B b = new B();
-        set.add(a);
+        set.add((E) a);
         assertEquals(1, set.size());
-        set.add(b);  // will match but not replace A as equal
+        set.add((E) b);  // will match but not replace A as equal
         assertEquals(1, set.size());
         assertSame(a, set.decorated().iterator().next());
         assertSame(a, set.iterator().next());
@@ -200,11 +205,11 @@ public class TestListOrderedSet extends AbstractTestSet {
 
     public void testDecorator() {
         try {
-            ListOrderedSet.decorate((List) null);
+            ListOrderedSet.decorate((List<E>) null);
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            ListOrderedSet.decorate((Set) null);
+            ListOrderedSet.decorate((Set<E>) null);
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
@@ -212,11 +217,11 @@ public class TestListOrderedSet extends AbstractTestSet {
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            ListOrderedSet.decorate(new HashSet(), null);
+            ListOrderedSet.decorate(new HashSet<E>(), null);
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            ListOrderedSet.decorate(null, new ArrayList());
+            ListOrderedSet.decorate(null, new ArrayList<E>());
             fail();
         } catch (IllegalArgumentException ex) {}
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestListOrderedSet2.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/TestListOrderedSet2.java b/src/test/org/apache/commons/collections/set/TestListOrderedSet2.java
index 7027912..e1e7a3e 100644
--- a/src/test/org/apache/commons/collections/set/TestListOrderedSet2.java
+++ b/src/test/org/apache/commons/collections/set/TestListOrderedSet2.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.
@@ -19,7 +19,6 @@ package org.apache.commons.collections.set;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Set;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -30,11 +29,16 @@ import junit.framework.TestSuite;
  *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Henning P. Schmiedehausen
  * @author Stephen Colebourne
  */
-public class TestListOrderedSet2 extends AbstractTestSet {
+public class TestListOrderedSet2<E> extends AbstractTestSet<E> {
+
+    private static final Integer ZERO = new Integer(0);
+    private static final Integer ONE = new Integer(1);
+    private static final Integer TWO = new Integer(2);
+    private static final Integer THREE = new Integer(3);
 
     public TestListOrderedSet2(String testName) {
         super(testName);
@@ -49,22 +53,24 @@ public class TestListOrderedSet2 extends AbstractTestSet {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Set makeEmptySet() {
-        return new ListOrderedSet();
+    public ListOrderedSet<E> makeObject() {
+        return new ListOrderedSet<E>();
     }
 
-    protected Set setupSet() {
-        Set set = makeEmptySet();
+    @SuppressWarnings("unchecked")
+    protected ListOrderedSet<E> setupSet() {
+        ListOrderedSet<E> set = makeObject();
 
         for (int i = 0; i < 10; i++) {
-            set.add(Integer.toString(i));
+            set.add((E) Integer.toString(i));
         }
         return set;
     }
 
+    @SuppressWarnings("unchecked")
     public void testOrdering() {
-        Set set = setupSet();
-        Iterator it = set.iterator();
+        ListOrderedSet<E> set = setupSet();
+        Iterator<E> it = set.iterator();
 
         for (int i = 0; i < 10; i++) {
             assertEquals("Sequence is wrong", Integer.toString(i), it.next());
@@ -80,7 +86,7 @@ public class TestListOrderedSet2 extends AbstractTestSet {
         }
 
         for (int i = 0; i < 10; i++) {
-            set.add(Integer.toString(i));
+            set.add((E) Integer.toString(i));
         }
 
         assertEquals("Size of set is wrong!", 10, set.size());
@@ -93,19 +99,15 @@ public class TestListOrderedSet2 extends AbstractTestSet {
             assertEquals("Sequence is wrong", Integer.toString(i), it.next());
         }
     }
-    
-    private static final Integer ZERO = new Integer(0);
-    private static final Integer ONE = new Integer(1);
-    private static final Integer TWO = new Integer(2);
-    private static final Integer THREE = new Integer(3);
-    
+
+    @SuppressWarnings("unchecked")
     public void testListAddRemove() {
-        ListOrderedSet set = (ListOrderedSet) makeEmptySet();
-        List view = set.asList();
-        set.add(ZERO);
-        set.add(ONE);
-        set.add(TWO);
-        
+        ListOrderedSet<E> set = makeObject();
+        List<E> view = set.asList();
+        set.add((E) ZERO);
+        set.add((E) ONE);
+        set.add((E) TWO);
+
         assertEquals(3, set.size());
         assertSame(ZERO, set.get(0));
         assertSame(ONE, set.get(1));
@@ -114,11 +116,11 @@ public class TestListOrderedSet2 extends AbstractTestSet {
         assertSame(ZERO, view.get(0));
         assertSame(ONE, view.get(1));
         assertSame(TWO, view.get(2));
-        
+
         assertEquals(0, set.indexOf(ZERO));
         assertEquals(1, set.indexOf(ONE));
         assertEquals(2, set.indexOf(TWO));
-        
+
         set.remove(1);
         assertEquals(2, set.size());
         assertSame(ZERO, set.get(0));
@@ -126,37 +128,37 @@ public class TestListOrderedSet2 extends AbstractTestSet {
         assertEquals(2, view.size());
         assertSame(ZERO, view.get(0));
         assertSame(TWO, view.get(1));
-    }        
-    
+    }
+
+    @SuppressWarnings("unchecked")
     public void testListAddIndexed() {
-        ListOrderedSet set = (ListOrderedSet) makeEmptySet();
-        List view = set.asList();
-        set.add(ZERO);
-        set.add(TWO);
-        
-        set.add(1, ONE);
+        ListOrderedSet<E> set = makeObject();
+        set.add((E) ZERO);
+        set.add((E) TWO);
+
+        set.add(1, (E) ONE);
         assertEquals(3, set.size());
         assertSame(ZERO, set.get(0));
         assertSame(ONE, set.get(1));
         assertSame(TWO, set.get(2));
-        
-        set.add(0, ONE);
+
+        set.add(0, (E) ONE);
         assertEquals(3, set.size());
         assertSame(ZERO, set.get(0));
         assertSame(ONE, set.get(1));
         assertSame(TWO, set.get(2));
-        
-        List list = new ArrayList();
-        list.add(ZERO);
-        list.add(TWO);
-        
+
+        List<E> list = new ArrayList<E>();
+        list.add((E) ZERO);
+        list.add((E) TWO);
+
         set.addAll(0, list);
         assertEquals(3, set.size());
         assertSame(ZERO, set.get(0));
         assertSame(ONE, set.get(1));
         assertSame(TWO, set.get(2));
-        
-        list.add(0, THREE); // list = [3,0,2]
+
+        list.add(0, (E) THREE); // list = [3,0,2]
         set.remove(TWO);    //  set = [0,1]
         set.addAll(1, list);
         assertEquals(4, set.size());
@@ -165,7 +167,7 @@ public class TestListOrderedSet2 extends AbstractTestSet {
         assertSame(TWO, set.get(2));
         assertSame(ONE, set.get(3));
     }
-    
+
     public String getCompatibilityVersion() {
         return "3.1";
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestMapBackedSet.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/TestMapBackedSet.java b/src/test/org/apache/commons/collections/set/TestMapBackedSet.java
index 4cfc1d9..8113f40 100644
--- a/src/test/org/apache/commons/collections/set/TestMapBackedSet.java
+++ b/src/test/org/apache/commons/collections/set/TestMapBackedSet.java
@@ -31,7 +31,7 @@ import org.apache.commons.collections.map.HashedMap;
  * 
  * @author Stephen Colebourne
  */
-public class TestMapBackedSet extends AbstractTestSet {
+public class TestMapBackedSet<E> extends AbstractTestSet<E> {
 
     public TestMapBackedSet(String testName) {
         super(testName);
@@ -46,8 +46,8 @@ public class TestMapBackedSet extends AbstractTestSet {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Set makeEmptySet() {
-        return MapBackedSet.decorate(new HashedMap());
+    public Set<E> makeObject() {
+        return MapBackedSet.decorate(new HashedMap<E, Object>());
     }
 
     public String getCompatibilityVersion() {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestMapBackedSet2.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/TestMapBackedSet2.java b/src/test/org/apache/commons/collections/set/TestMapBackedSet2.java
index 23449a5..b32f338 100644
--- a/src/test/org/apache/commons/collections/set/TestMapBackedSet2.java
+++ b/src/test/org/apache/commons/collections/set/TestMapBackedSet2.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,10 +29,10 @@ import org.apache.commons.collections.map.LinkedMap;
  *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestMapBackedSet2 extends AbstractTestSet {
+public class TestMapBackedSet2<E> extends AbstractTestSet<E> {
 
     public TestMapBackedSet2(String testName) {
         super(testName);
@@ -47,22 +47,24 @@ public class TestMapBackedSet2 extends AbstractTestSet {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Set makeEmptySet() {
-        return MapBackedSet.decorate(new LinkedMap());
+    public Set<E> makeObject() {
+        return MapBackedSet.decorate(new LinkedMap<E, Object>());
     }
 
-    protected Set setupSet() {
-        Set set = makeEmptySet();
+    @SuppressWarnings("unchecked")
+    protected Set<E> setupSet() {
+        Set<E> set = makeObject();
 
         for (int i = 0; i < 10; i++) {
-            set.add(Integer.toString(i));
+            set.add((E) Integer.toString(i));
         }
         return set;
     }
 
+    @SuppressWarnings("unchecked")
     public void testOrdering() {
-        Set set = setupSet();
-        Iterator it = set.iterator();
+        Set<E> set = setupSet();
+        Iterator<E> it = set.iterator();
 
         for (int i = 0; i < 10; i++) {
             assertEquals("Sequence is wrong", Integer.toString(i), it.next());
@@ -78,7 +80,7 @@ public class TestMapBackedSet2 extends AbstractTestSet {
         }
 
         for (int i = 0; i < 10; i++) {
-            set.add(Integer.toString(i));
+            set.add((E) Integer.toString(i));
         }
 
         assertEquals("Size of set is wrong!", 10, set.size());

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestPredicatedSet.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/TestPredicatedSet.java b/src/test/org/apache/commons/collections/set/TestPredicatedSet.java
index cb330bc..e9848dd 100644
--- a/src/test/org/apache/commons/collections/set/TestPredicatedSet.java
+++ b/src/test/org/apache/commons/collections/set/TestPredicatedSet.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,101 +23,103 @@ import junit.framework.Test;
 import junit.framework.TestSuite;
 
 import org.apache.commons.collections.Predicate;
-import org.apache.commons.collections.PredicateUtils;
+import org.apache.commons.collections.functors.TruePredicate;
 
 /**
- * Extension of {@link TestSet} for exercising the 
+ * Extension of {@link TestSet} for exercising the
  * {@link PredicatedSet} implementation.
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  */
-public class TestPredicatedSet extends AbstractTestSet{
-    
+public class TestPredicatedSet<E> extends AbstractTestSet<E> {
+
     public TestPredicatedSet(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return new TestSuite(TestPredicatedSet.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestPredicatedSet.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
-    
+
  //-------------------------------------------------------------------
-    
-    protected Predicate truePredicate = PredicateUtils.truePredicate();
-    
-    protected Set decorateSet(Set set, Predicate predicate) {
-        return PredicatedSet.decorate(set, predicate);
+
+    protected Predicate<E> truePredicate = TruePredicate.<E>truePredicate();
+
+    protected PredicatedSet<E> decorateSet(Set<E> set, Predicate<? super E> predicate) {
+        return (PredicatedSet<E>) PredicatedSet.decorate(set, predicate);
     }
-    
-    public Set makeEmptySet() {
-        return decorateSet(new HashSet(), truePredicate);
+
+    public PredicatedSet<E> makeObject() {
+        return decorateSet(new HashSet<E>(), truePredicate);
     }
-    
-    public Object[] getFullElements() {
-        return new Object[] {"1", "3", "5", "7", "2", "4", "6"};
+
+    @SuppressWarnings("unchecked")
+    public E[] getFullElements() {
+        return (E[]) new Object[] {"1", "3", "5", "7", "2", "4", "6"};
     }
-    
-//--------------------------------------------------------------------   
-    
-    protected Predicate testPredicate =  
-        new Predicate() {
-            public boolean evaluate(Object o) {
+
+//--------------------------------------------------------------------
+
+    protected Predicate<E> testPredicate =
+        new Predicate<E>() {
+            public boolean evaluate(E o) {
                 return o instanceof String;
             }
-        };      
-    
-    protected Set makeTestSet() {
-        return decorateSet(new HashSet(), testPredicate);
+        };
+
+    protected PredicatedSet<E> makeTestSet() {
+        return decorateSet(new HashSet<E>(), testPredicate);
     }
-    
+
     public void testGetSet() {
-         Set set = makeTestSet();
-        assertTrue("returned set should not be null",
-            ((PredicatedSet) set).decorated() != null);
+        PredicatedSet<E> set = makeTestSet();
+        assertTrue("returned set should not be null", set.decorated() != null);
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testIllegalAdd() {
-        Set set = makeTestSet();
+        Set<E> set = makeTestSet();
         Integer i = new Integer(3);
         try {
-            set.add(i);
+            set.add((E) i);
             fail("Integer should fail string predicate.");
         } catch (IllegalArgumentException e) {
             // expected
         }
-        assertTrue("Collection shouldn't contain illegal element", 
-         !set.contains(i));   
+        assertTrue("Collection shouldn't contain illegal element",
+         !set.contains(i));
     }
 
+    @SuppressWarnings("unchecked")
     public void testIllegalAddAll() {
-        Set set = makeTestSet();
-        Set elements = new HashSet();
-        elements.add("one");
-        elements.add("two");
-        elements.add(new Integer(3));
-        elements.add("four");
+        Set<E> set = makeTestSet();
+        Set<E> elements = new HashSet<E>();
+        elements.add((E) "one");
+        elements.add((E) "two");
+        elements.add((E) new Integer(3));
+        elements.add((E) "four");
         try {
             set.addAll(elements);
             fail("Integer should fail string predicate.");
         } catch (IllegalArgumentException e) {
             // expected
         }
-        assertTrue("Set shouldn't contain illegal element", 
-         !set.contains("one"));   
-        assertTrue("Set shouldn't contain illegal element", 
-         !set.contains("two"));   
-        assertTrue("Set shouldn't contain illegal element", 
-         !set.contains(new Integer(3)));   
-        assertTrue("Set shouldn't contain illegal element", 
-         !set.contains("four"));   
+        assertTrue("Set shouldn't contain illegal element",
+         !set.contains("one"));
+        assertTrue("Set shouldn't contain illegal element",
+         !set.contains("two"));
+        assertTrue("Set shouldn't contain illegal element",
+         !set.contains(new Integer(3)));
+        assertTrue("Set shouldn't contain illegal element",
+         !set.contains("four"));
     }
 
     public String getCompatibilityVersion() {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestPredicatedSortedSet.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/TestPredicatedSortedSet.java b/src/test/org/apache/commons/collections/set/TestPredicatedSortedSet.java
index 508abba..b225c29 100644
--- a/src/test/org/apache/commons/collections/set/TestPredicatedSortedSet.java
+++ b/src/test/org/apache/commons/collections/set/TestPredicatedSortedSet.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.
@@ -26,106 +26,101 @@ import junit.framework.Test;
 
 import org.apache.commons.collections.BulkTest;
 import org.apache.commons.collections.Predicate;
-import org.apache.commons.collections.PredicateUtils;
+import org.apache.commons.collections.functors.TruePredicate;
 import org.apache.commons.collections.map.TestPredicatedSortedMap;
 
 /**
- * Extension of {@link AbstractTestSortedSet} for exercising the 
+ * Extension of {@link AbstractTestSortedSet} for exercising the
  * {@link PredicatedSortedSet} implementation.
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  */
-public class TestPredicatedSortedSet extends AbstractTestSortedSet{
-    
+public class TestPredicatedSortedSet<E> extends AbstractTestSortedSet<E> {
+
     public TestPredicatedSortedSet(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return BulkTest.makeSuite(TestPredicatedSortedSet.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestPredicatedSortedMap.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
-    
- //-------------------------------------------------------------------    
-    
-    protected Predicate truePredicate = PredicateUtils.truePredicate();
-    
-    public Set makeEmptySet() {
-        return PredicatedSortedSet.decorate(new TreeSet(), truePredicate);
+
+ //-------------------------------------------------------------------
+
+    protected Predicate<E> truePredicate = TruePredicate.<E>truePredicate();
+
+    public SortedSet<E> makeObject() {
+        return PredicatedSortedSet.decorate(new TreeSet<E>(), truePredicate);
     }
-    
-    public Set makeFullSet() {
-        TreeSet set = new TreeSet();
+
+    public SortedSet<E> makeFullCollection() {
+        TreeSet<E> set = new TreeSet<E>();
         set.addAll(Arrays.asList(getFullElements()));
         return PredicatedSortedSet.decorate(set, truePredicate);
     }
-   
-    
-//--------------------------------------------------------------------   
-    protected Predicate testPredicate =  
-        new Predicate() {
-            public boolean evaluate(Object o) {
+
+//--------------------------------------------------------------------
+    protected Predicate<E> testPredicate =
+        new Predicate<E>() {
+            public boolean evaluate(E o) {
                 return (o instanceof String) && (((String) o).startsWith("A"));
             }
-        };      
-     
-    
-    protected SortedSet makeTestSet() {
-        return PredicatedSortedSet.decorate(new TreeSet(), testPredicate);
+        };
+
+    protected PredicatedSortedSet<E> makeTestSet() {
+        return (PredicatedSortedSet<E>) PredicatedSortedSet.decorate(new TreeSet<E>(), testPredicate);
     }
-    
+
     public void testGetSet() {
-        SortedSet set = makeTestSet();
-        assertTrue("returned set should not be null",
-            ((PredicatedSortedSet) set).decorated() != null);
+        PredicatedSortedSet<E> set = makeTestSet();
+        assertTrue("returned set should not be null", set.decorated() != null);
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testIllegalAdd() {
-        SortedSet set = makeTestSet();
+        SortedSet<E> set = makeTestSet();
         String testString = "B";
         try {
-            set.add(testString);
+            set.add((E) testString);
             fail("Should fail string predicate.");
         } catch (IllegalArgumentException e) {
             // expected
         }
-        assertTrue("Collection shouldn't contain illegal element", 
-         !set.contains(testString));   
+        assertTrue("Collection shouldn't contain illegal element",
+         !set.contains(testString));
     }
 
+    @SuppressWarnings("unchecked")
     public void testIllegalAddAll() {
-        SortedSet set = makeTestSet();
-        Set elements = new TreeSet();
-        elements.add("Aone");
-        elements.add("Atwo");
-        elements.add("Bthree");
-        elements.add("Afour");
+        SortedSet<E> set = makeTestSet();
+        Set<E> elements = new TreeSet<E>();
+        elements.add((E) "Aone");
+        elements.add((E) "Atwo");
+        elements.add((E) "Bthree");
+        elements.add((E) "Afour");
         try {
             set.addAll(elements);
             fail("Should fail string predicate.");
         } catch (IllegalArgumentException e) {
             // expected
         }
-        assertTrue("Set shouldn't contain illegal element", 
-         !set.contains("Aone"));   
-        assertTrue("Set shouldn't contain illegal element", 
-         !set.contains("Atwo"));   
-        assertTrue("Set shouldn't contain illegal element", 
-         !set.contains("Bthree"));   
-        assertTrue("Set shouldn't contain illegal element", 
-         !set.contains("Afour"));   
+        assertTrue("Set shouldn't contain illegal element", !set.contains("Aone"));
+        assertTrue("Set shouldn't contain illegal element", !set.contains("Atwo"));
+        assertTrue("Set shouldn't contain illegal element", !set.contains("Bthree"));
+        assertTrue("Set shouldn't contain illegal element", !set.contains("Afour"));
     }
-    
+
     public void testComparator() {
-        SortedSet set = makeTestSet();
-        Comparator c = set.comparator();
+        SortedSet<E> set = makeTestSet();
+        Comparator<? super E> c = set.comparator();
         assertTrue("natural order, so comparator should be null", c == null);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestSynchronizedSet.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/TestSynchronizedSet.java b/src/test/org/apache/commons/collections/set/TestSynchronizedSet.java
index 43b9fff..98dc26b 100644
--- a/src/test/org/apache/commons/collections/set/TestSynchronizedSet.java
+++ b/src/test/org/apache/commons/collections/set/TestSynchronizedSet.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,32 +24,32 @@ import junit.framework.Test;
 import org.apache.commons.collections.BulkTest;
 
 /**
- * Extension of {@link AbstractTestSet} for exercising the 
+ * Extension of {@link AbstractTestSet} for exercising the
  * {@link SynchronizedSet} implementation.
  *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestSynchronizedSet extends AbstractTestSet{
-    
+public class TestSynchronizedSet<E> extends AbstractTestSet<E> {
+
     public TestSynchronizedSet(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return BulkTest.makeSuite(TestSynchronizedSet.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestSynchronizedSet.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
-    
-   //-------------------------------------------------------------------      
-    public Set makeEmptySet() {
-        return SynchronizedSet.decorate(new HashSet());
+
+   //-------------------------------------------------------------------
+    public Set<E> makeObject() {
+        return SynchronizedSet.decorate(new HashSet<E>());
     }
 
     public String getCompatibilityVersion() {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestSynchronizedSortedSet.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/TestSynchronizedSortedSet.java b/src/test/org/apache/commons/collections/set/TestSynchronizedSortedSet.java
index ace8d9d..282b0dd 100644
--- a/src/test/org/apache/commons/collections/set/TestSynchronizedSortedSet.java
+++ b/src/test/org/apache/commons/collections/set/TestSynchronizedSortedSet.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,7 +16,7 @@
  */
 package org.apache.commons.collections.set;
 
-import java.util.Set;
+import java.util.SortedSet;
 import java.util.TreeSet;
 
 import junit.framework.Test;
@@ -24,32 +24,32 @@ import junit.framework.Test;
 import org.apache.commons.collections.BulkTest;
 
 /**
- * Extension of {@link AbstractTestSet} for exercising the 
+ * Extension of {@link AbstractTestSet} for exercising the
  * {@link SynchronizedSortedSet} implementation.
  *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestSynchronizedSortedSet extends AbstractTestSortedSet{
-    
+public class TestSynchronizedSortedSet<E> extends AbstractTestSortedSet<E> {
+
     public TestSynchronizedSortedSet(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return BulkTest.makeSuite(TestSynchronizedSortedSet.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestSynchronizedSortedSet.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
-    
-   //-------------------------------------------------------------------      
-    public Set makeEmptySet() {
-        return SynchronizedSortedSet.decorate(new TreeSet());
+
+   //-------------------------------------------------------------------
+    public SortedSet<E> makeObject() {
+        return SynchronizedSortedSet.decorate(new TreeSet<E>());
     }
 
     public String getCompatibilityVersion() {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestTransformedSet.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/TestTransformedSet.java b/src/test/org/apache/commons/collections/set/TestTransformedSet.java
index 825c6e5..77855d8 100644
--- a/src/test/org/apache/commons/collections/set/TestTransformedSet.java
+++ b/src/test/org/apache/commons/collections/set/TestTransformedSet.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.
@@ -17,13 +17,13 @@
 package org.apache.commons.collections.set;
 
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
+import org.apache.commons.collections.Transformer;
 import org.apache.commons.collections.collection.TestTransformedCollection;
 
 /**
@@ -32,11 +32,11 @@ import org.apache.commons.collections.collection.TestTransformedCollection;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestTransformedSet extends AbstractTestSet {
-    
+public class TestTransformedSet<E> extends AbstractTestSet<E> {
+
     public TestTransformedSet(String testName) {
         super(testName);
     }
@@ -50,40 +50,46 @@ public class TestTransformedSet extends AbstractTestSet {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Collection makeConfirmedCollection() {
-        return new HashSet();
+    public Set<E> makeConfirmedCollection() {
+        return new HashSet<E>();
     }
 
-    public Collection makeConfirmedFullCollection() {
-        Set set = new HashSet();
+    public Set<E> makeConfirmedFullCollection() {
+        Set<E> set = new HashSet<E>();
         set.addAll(Arrays.asList(getFullElements()));
         return set;
     }
-    
-    public Set makeEmptySet() {
-        return TransformedSet.decorate(new HashSet(), TestTransformedCollection.NOOP_TRANSFORMER);
+
+    @SuppressWarnings("unchecked")
+    public Set<E> makeObject() {
+        return TransformedSet.decorate(new HashSet<E>(),
+                (Transformer<E, E>) TestTransformedCollection.NOOP_TRANSFORMER);
     }
 
-    public Set makeFullSet() {
-        Set list = new HashSet();
+    @SuppressWarnings("unchecked")
+    public Set<E> makeFullCollection() {
+        Set<E> list = new HashSet<E>();
         list.addAll(Arrays.asList(getFullElements()));
-        return TransformedSet.decorate(list, TestTransformedCollection.NOOP_TRANSFORMER);
+        return TransformedSet.decorate(list,
+                (Transformer<E, E>) TestTransformedCollection.NOOP_TRANSFORMER);
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testTransformedSet() {
-        Set set = TransformedSet.decorate(new HashSet(), TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
+        Set<E> set = TransformedSet.decorate(new HashSet<E>(),
+                (Transformer<E, E>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(0, set.size());
-        Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
+        E[] els = (E[]) new Object[] { "1", "3", "5", "7", "2", "4", "6" };
         for (int i = 0; i < els.length; i++) {
             set.add(els[i]);
             assertEquals(i + 1, set.size());
             assertEquals(true, set.contains(new Integer((String) els[i])));
             assertEquals(false, set.contains(els[i]));
         }
-        
+
         assertEquals(false, set.remove(els[0]));
         assertEquals(true, set.remove(new Integer((String) els[0])));
-        
+
     }
 
     public String getCompatibilityVersion() {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java b/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java
index 82e33f9..9bf1e0d 100644
--- a/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java
+++ b/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java
@@ -17,14 +17,13 @@
 package org.apache.commons.collections.set;
 
 import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
 import junit.framework.Test;
 
 import org.apache.commons.collections.BulkTest;
+import org.apache.commons.collections.Transformer;
 import org.apache.commons.collections.collection.TestTransformedCollection;
 
 /**
@@ -33,11 +32,11 @@ import org.apache.commons.collections.collection.TestTransformedCollection;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestTransformedSortedSet extends AbstractTestSortedSet {
-    
+public class TestTransformedSortedSet<E> extends AbstractTestSortedSet<E> {
+
     public TestTransformedSortedSet(String testName) {
         super(testName);
     }
@@ -52,32 +51,35 @@ public class TestTransformedSortedSet extends AbstractTestSortedSet {
     }
 
     //-----------------------------------------------------------------------
-    public Set makeEmptySet() {
-        return TransformedSortedSet.decorate(new TreeSet(), TestTransformedCollection.NOOP_TRANSFORMER);
+    @SuppressWarnings("unchecked")
+    public SortedSet<E> makeObject() {
+        return TransformedSortedSet.decorate(new TreeSet<E>(), (Transformer<E, E>) TestTransformedCollection.NOOP_TRANSFORMER);
     }
 
-    public Set makeFullSet() {
-        SortedSet set = new TreeSet();
+    @SuppressWarnings("unchecked")
+    public SortedSet<E> makeFullCollection() {
+        SortedSet<E> set = new TreeSet<E>();
         set.addAll(Arrays.asList(getFullElements()));
-        return TransformedSortedSet.decorate(set, TestTransformedCollection.NOOP_TRANSFORMER);
+        return TransformedSortedSet.decorate(set, (Transformer<E, E>) TestTransformedCollection.NOOP_TRANSFORMER);
     }
-    
-    //-----------------------------------------------------------------------   
+
+    //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testTransformedSet() {
-        Set set = TransformedSortedSet.decorate(new HashSet(), TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
+        SortedSet<E> set = TransformedSortedSet.decorate(new TreeSet<E>(),
+                (Transformer<E, E>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(0, set.size());
-        Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
+        E[] els = (E[]) new Object[] { "1", "3", "5", "7", "2", "4", "6" };
         for (int i = 0; i < els.length; i++) {
             set.add(els[i]);
             assertEquals(i + 1, set.size());
             assertEquals(true, set.contains(new Integer((String) els[i])));
-            assertEquals(false, set.contains(els[i]));
+            assertNotCollectionContains(set, els[i]);
         }
-        
-        assertEquals(false, set.remove(els[0]));
+
+        assertNotRemoveFromCollection(set, els[0]);
         assertEquals(true, set.remove(new Integer((String) els[0])));
-        
-    } 
+    }
 
     public String getCompatibilityVersion() {
         return "3.1";

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestUnmodifiableSet.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/TestUnmodifiableSet.java b/src/test/org/apache/commons/collections/set/TestUnmodifiableSet.java
index cd800cb..3ab6185 100644
--- a/src/test/org/apache/commons/collections/set/TestUnmodifiableSet.java
+++ b/src/test/org/apache/commons/collections/set/TestUnmodifiableSet.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.
@@ -25,44 +25,44 @@ import junit.framework.Test;
 import org.apache.commons.collections.BulkTest;
 
 /**
- * Extension of {@link AbstractTestSet} for exercising the 
+ * Extension of {@link AbstractTestSet} for exercising the
  * {@link UnmodifiableSet} implementation.
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  */
-public class TestUnmodifiableSet extends AbstractTestSet{
-    
+public class TestUnmodifiableSet<E> extends AbstractTestSet<E> {
+
     public TestUnmodifiableSet(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return BulkTest.makeSuite(TestUnmodifiableSet.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestUnmodifiableSet.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
-    
-    //-------------------------------------------------------------------  
-    public Set makeEmptySet() {
-        return UnmodifiableSet.decorate(new HashSet());
+
+    //-------------------------------------------------------------------
+    public Set<E> makeObject() {
+        return UnmodifiableSet.decorate(new HashSet<E>());
     }
-    
-    public Set makeFullSet() {
-        HashSet set = new HashSet();
+
+    public Set<E> makeFullCollection() {
+        HashSet<E> set = new HashSet<E>();
         set.addAll(Arrays.asList(getFullElements()));
         return UnmodifiableSet.decorate(set);
     }
-    
+
     public boolean isAddSupported() {
         return false;
     }
-    
+
     public boolean isRemoveSupported() {
         return false;
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestUnmodifiableSortedSet.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/TestUnmodifiableSortedSet.java b/src/test/org/apache/commons/collections/set/TestUnmodifiableSortedSet.java
index 8758f58..174d4f3 100644
--- a/src/test/org/apache/commons/collections/set/TestUnmodifiableSortedSet.java
+++ b/src/test/org/apache/commons/collections/set/TestUnmodifiableSortedSet.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.
@@ -20,6 +20,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Comparator;
 import java.util.Set;
+import java.util.SortedSet;
 import java.util.TreeSet;
 
 import junit.framework.Test;
@@ -27,81 +28,83 @@ import junit.framework.Test;
 import org.apache.commons.collections.BulkTest;
 
 /**
- * Extension of {@link AbstractTestSortedSet} for exercising the 
+ * Extension of {@link AbstractTestSortedSet} for exercising the
  * {@link UnmodifiableSortedSet} implementation.
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  */
-public class TestUnmodifiableSortedSet extends AbstractTestSortedSet{
-    
+public class TestUnmodifiableSortedSet<E> extends AbstractTestSortedSet<E> {
+    protected UnmodifiableSortedSet<E> set = null;
+    protected ArrayList<E> array = null;
+
     public TestUnmodifiableSortedSet(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return BulkTest.makeSuite(TestUnmodifiableSortedSet.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestUnmodifiableSortedSet.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
-    
-    //-------------------------------------------------------------------  
-    public Set makeEmptySet() {
-        return UnmodifiableSortedSet.decorate(new TreeSet());
+
+    //-------------------------------------------------------------------
+    public SortedSet<E> makeObject() {
+        return UnmodifiableSortedSet.decorate(new TreeSet<E>());
     }
-    
-    public Set makeFullSet() {
-        TreeSet set = new TreeSet();
+
+    public UnmodifiableSortedSet<E> makeFullCollection() {
+        TreeSet<E> set = new TreeSet<E>();
         set.addAll(Arrays.asList(getFullElements()));
-        return UnmodifiableSortedSet.decorate(set);
+        return (UnmodifiableSortedSet<E>) UnmodifiableSortedSet.decorate(set);
     }
-    
+
     public boolean isAddSupported() {
         return false;
     }
-    
+
     public boolean isRemoveSupported() {
         return false;
     }
-           
+
     //--------------------------------------------------------------------
-    protected UnmodifiableSortedSet set = null;
-    protected ArrayList array = null;
-    
+    @SuppressWarnings("unchecked")
     protected void setupSet() {
-        set = (UnmodifiableSortedSet) makeFullSet();
-        array = new ArrayList();
-        array.add(new Integer(1));
+        set = makeFullCollection();
+        array = new ArrayList<E>();
+        array.add((E) new Integer(1));
     }
-    
-    /** 
+
+    /**
      * Verify that base set and subsets are not modifiable
      */
+    @SuppressWarnings("unchecked")
     public void testUnmodifiable() {
         setupSet();
         verifyUnmodifiable(set);
-        verifyUnmodifiable(set.headSet(new Integer(1)));
-        verifyUnmodifiable(set.tailSet(new Integer(1)));
-        verifyUnmodifiable(set.subSet(new Integer(1), new Integer(3)));    
+        verifyUnmodifiable(set.headSet((E) new Integer(1)));
+        verifyUnmodifiable(set.tailSet((E) new Integer(1)));
+        verifyUnmodifiable(set.subSet((E) new Integer(1), (E) new Integer(3)));
     }
-    
+
     /**
      * Verifies that a set is not modifiable
      */
-    public void verifyUnmodifiable(Set set) {
+    @SuppressWarnings("unchecked")
+    public void verifyUnmodifiable(Set<E> set) {
         try {
-            set.add("value");
+            set.add((E) "value");
             fail("Expecting UnsupportedOperationException.");
         } catch (UnsupportedOperationException e) {
-            // expected  
+            // expected
         }
         try {
-            set.addAll(new TreeSet());
+            set.addAll(new TreeSet<E>());
             fail("Expecting UnsupportedOperationException.");
         } catch (UnsupportedOperationException e) {
             // expected
@@ -131,10 +134,10 @@ public class TestUnmodifiableSortedSet extends AbstractTestSortedSet{
             // expected
         }
     }
-    
+
     public void testComparator() {
         setupSet();
-        Comparator c = set.comparator();
+        Comparator<? super E> c = set.comparator();
         assertTrue("natural order, so comparator should be null", c == null);
     }
 


[20/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/ListOrderedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/ListOrderedMap.java b/src/java/org/apache/commons/collections/map/ListOrderedMap.java
index e27f914..c94f907 100644
--- a/src/java/org/apache/commons/collections/map/ListOrderedMap.java
+++ b/src/java/org/apache/commons/collections/map/ListOrderedMap.java
@@ -32,11 +32,10 @@ import java.util.Map;
 import java.util.NoSuchElementException;
 import java.util.Set;
 
-import org.apache.commons.collections.MapIterator;
 import org.apache.commons.collections.OrderedMap;
 import org.apache.commons.collections.OrderedMapIterator;
 import org.apache.commons.collections.ResettableIterator;
-import org.apache.commons.collections.iterators.AbstractIteratorDecorator;
+import org.apache.commons.collections.iterators.AbstractUntypedIteratorDecorator;
 import org.apache.commons.collections.keyvalue.AbstractMapEntry;
 import org.apache.commons.collections.list.UnmodifiableList;
 
@@ -68,15 +67,15 @@ import org.apache.commons.collections.list.UnmodifiableList;
  * @author Stephen Colebourne
  * @author Matt Benson
  */
-public class ListOrderedMap
-        extends AbstractMapDecorator
-        implements OrderedMap, Serializable {
+public class ListOrderedMap<K, V>
+        extends AbstractMapDecorator<K, V>
+        implements OrderedMap<K, V>, Serializable {
 
     /** Serialization version */
     private static final long serialVersionUID = 2728177751851003750L;
 
     /** Internal list to hold the sequence of objects */
-    protected final List insertOrder = new ArrayList();
+    protected final List<K> insertOrder = new ArrayList<K>();
 
     /**
      * Factory method to create an ordered map.
@@ -86,8 +85,8 @@ public class ListOrderedMap
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if map is null
      */
-    public static OrderedMap decorate(Map map) {
-        return new ListOrderedMap(map);
+    public static <K, V> OrderedMap<K, V> decorate(Map<K, V> map) {
+        return new ListOrderedMap<K, V>(map);
     }
 
     //-----------------------------------------------------------------------
@@ -98,7 +97,7 @@ public class ListOrderedMap
      * @since Commons Collections 3.1
      */
     public ListOrderedMap() {
-        this(new HashMap());
+        this(new HashMap<K, V>());
     }
 
     /**
@@ -107,7 +106,7 @@ public class ListOrderedMap
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if map is null
      */
-    protected ListOrderedMap(Map map) {
+    protected ListOrderedMap(Map<K, V> map) {
         super(map);
         insertOrder.addAll(decorated().keySet());
     }
@@ -133,6 +132,7 @@ public class ListOrderedMap
      * @throws ClassNotFoundException
      * @since Commons Collections 3.1
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
         map = (Map) in.readObject();
@@ -140,12 +140,8 @@ public class ListOrderedMap
 
     // Implement OrderedMap
     //-----------------------------------------------------------------------
-    public MapIterator mapIterator() {
-        return orderedMapIterator();
-    }
-
-    public OrderedMapIterator orderedMapIterator() {
-        return new ListOrderedMapIterator(this);
+    public OrderedMapIterator<K, V> mapIterator() {
+        return new ListOrderedMapIterator<K, V>(this);
     }
 
     /**
@@ -154,7 +150,7 @@ public class ListOrderedMap
      * @return the first key currently in this map
      * @throws NoSuchElementException if this map is empty
      */
-    public Object firstKey() {
+    public K firstKey() {
         if (size() == 0) {
             throw new NoSuchElementException("Map is empty");
         }
@@ -167,7 +163,7 @@ public class ListOrderedMap
      * @return the last key currently in this map
      * @throws NoSuchElementException if this map is empty
      */
-    public Object lastKey() {
+    public K lastKey() {
         if (size() == 0) {
             throw new NoSuchElementException("Map is empty");
         }
@@ -181,7 +177,7 @@ public class ListOrderedMap
      * @param key  the key to find previous for
      * @return the next key, null if no match or at start
      */
-    public Object nextKey(Object key) {
+    public K nextKey(Object key) {
         int index = insertOrder.indexOf(key);
         if (index >= 0 && index < size() - 1) {
             return insertOrder.get(index + 1);
@@ -196,7 +192,7 @@ public class ListOrderedMap
      * @param key  the key to find previous for
      * @return the previous key, null if no match or at start
      */
-    public Object previousKey(Object key) {
+    public K previousKey(Object key) {
         int index = insertOrder.indexOf(key);
         if (index > 0) {
             return insertOrder.get(index - 1);
@@ -205,27 +201,26 @@ public class ListOrderedMap
     }
 
     //-----------------------------------------------------------------------
-    public Object put(Object key, Object value) {
+    public V put(K key, V value) {
         if (decorated().containsKey(key)) {
             // re-adding doesn't change order
             return decorated().put(key, value);
         } else {
             // first add, so add to both map and list
-            Object result = decorated().put(key, value);
+            V result = decorated().put(key, value);
             insertOrder.add(key);
             return result;
         }
     }
 
-    public void putAll(Map map) {
-        for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
-            Map.Entry entry = (Map.Entry) it.next();
+    public void putAll(Map<? extends K, ? extends V> map) {
+        for (Map.Entry<? extends K, ? extends V> entry : map.entrySet()) {
             put(entry.getKey(), entry.getValue());
         }
     }
 
-    public Object remove(Object key) {
-        Object result = decorated().remove(key);
+    public V remove(Object key) {
+        V result = decorated().remove(key);
         insertOrder.remove(key);
         return result;
     }
@@ -244,8 +239,8 @@ public class ListOrderedMap
      * @see #keyList()
      * @return the fully modifiable collection view over the keys
      */
-    public Set keySet() {
-        return new KeySetView(this);
+    public Set<K> keySet() {
+        return new KeySetView<K>(this);
     }
 
     /**
@@ -258,7 +253,7 @@ public class ListOrderedMap
      * @return the unmodifiable list view over the keys
      * @since Commons Collections 3.2
      */
-    public List keyList() {
+    public List<K> keyList() {
         return UnmodifiableList.decorate(insertOrder);
     }
 
@@ -273,8 +268,8 @@ public class ListOrderedMap
      * @see #valueList()
      * @return the fully modifiable collection view over the values
      */
-    public Collection values() {
-        return new ValuesView(this);
+    public Collection<V> values() {
+        return new ValuesView<V>(this);
     }
 
     /**
@@ -287,8 +282,8 @@ public class ListOrderedMap
      * @return the partially modifiable list view over the values
      * @since Commons Collections 3.2
      */
-    public List valueList() {
-        return new ValuesView(this);
+    public List<V> valueList() {
+        return new ValuesView<V>(this);
     }
 
     /**
@@ -298,8 +293,8 @@ public class ListOrderedMap
      *
      * @return the fully modifiable set view over the entries
      */
-    public Set entrySet() {
-        return new EntrySetView(this, this.insertOrder);
+    public Set<Map.Entry<K, V>> entrySet() {
+        return new EntrySetView<K, V>(this, this.insertOrder);
     }
 
     //-----------------------------------------------------------------------
@@ -315,11 +310,9 @@ public class ListOrderedMap
         StringBuffer buf = new StringBuffer();
         buf.append('{');
         boolean first = true;
-        Iterator it = entrySet().iterator();
-        while (it.hasNext()) {
-            Map.Entry entry = (Map.Entry) it.next();
-            Object key = entry.getKey();
-            Object value = entry.getValue();
+        for (Map.Entry<K, V> entry : entrySet()) {
+            K key = entry.getKey();
+            V value = entry.getValue();
             if (first) {
                 first = false;
             } else {
@@ -341,7 +334,7 @@ public class ListOrderedMap
      * @return the key at the specified index
      * @throws IndexOutOfBoundsException if the index is invalid
      */
-    public Object get(int index) {
+    public K get(int index) {
         return insertOrder.get(index);
     }
     
@@ -352,7 +345,7 @@ public class ListOrderedMap
      * @return the key at the specified index
      * @throws IndexOutOfBoundsException if the index is invalid
      */
-    public Object getValue(int index) {
+    public V getValue(int index) {
         return get(insertOrder.get(index));
     }
     
@@ -374,8 +367,8 @@ public class ListOrderedMap
      * @throws IndexOutOfBoundsException if the index is invalid
      * @since Commons Collections 3.2
      */
-    public Object setValue(int index, Object value) {
-        Object key = insertOrder.get(index);
+    public V setValue(int index, V value) {
+        K key = insertOrder.get(index);
         return put(key, value);
     }
 
@@ -398,10 +391,10 @@ public class ListOrderedMap
      * @throws IndexOutOfBoundsException if the index is out of range
      * @since Commons Collections 3.2
      */
-    public Object put(int index, Object key, Object value) {
-        Map m = decorated();
+    public V put(int index, K key, V value) {
+        Map<K, V> m = decorated();
         if (m.containsKey(key)) {
-            Object result = m.remove(key);
+            V result = m.remove(key);
             int pos = insertOrder.indexOf(key);
             insertOrder.remove(pos);
             if (pos < index) {
@@ -424,7 +417,7 @@ public class ListOrderedMap
      * @return the removed value, or <code>null</code> if none existed
      * @throws IndexOutOfBoundsException if the index is invalid
      */
-    public Object remove(int index) {
+    public V remove(int index) {
         return remove(get(index));
     }
 
@@ -445,17 +438,18 @@ public class ListOrderedMap
      * @see #keySet()
      * @return The ordered list of keys.  
      */
-    public List asList() {
+    public List<K> asList() {
         return keyList();
     }
 
     //-----------------------------------------------------------------------
-    static class ValuesView extends AbstractList {
-        private final ListOrderedMap parent;
+    static class ValuesView<V> extends AbstractList<V> {
+        private final ListOrderedMap<Object, V> parent;
 
-        ValuesView(ListOrderedMap parent) {
+        @SuppressWarnings("unchecked")
+        ValuesView(ListOrderedMap<?, V> parent) {
             super();
-            this.parent = parent;
+            this.parent = (ListOrderedMap<Object, V>) parent;
         }
 
         public int size() {
@@ -470,34 +464,35 @@ public class ListOrderedMap
             this.parent.clear();
         }
 
-        public Iterator iterator() {
-            return new AbstractIteratorDecorator(parent.entrySet().iterator()) {
-                public Object next() {
-                    return ((Map.Entry) iterator.next()).getValue();
+        public Iterator<V> iterator() {
+            return new AbstractUntypedIteratorDecorator<Map.Entry<Object, V>, V>(parent.entrySet().iterator()) {
+                public V next() {
+                    return getIterator().next().getValue();
                 }
             };
         }
 
-        public Object get(int index) {
+        public V get(int index) {
             return this.parent.getValue(index);
         }
 
-        public Object set(int index, Object value) {
+        public V set(int index, V value) {
             return this.parent.setValue(index, value);
         }
 
-        public Object remove(int index) {
+        public V remove(int index) {
             return this.parent.remove(index);
         }
     }
 
     //-----------------------------------------------------------------------
-    static class KeySetView extends AbstractSet {
-        private final ListOrderedMap parent;
+    static class KeySetView<K> extends AbstractSet<K> {
+        private final ListOrderedMap<K, Object> parent;
 
-        KeySetView(ListOrderedMap parent) {
+        @SuppressWarnings("unchecked")
+        KeySetView(ListOrderedMap<K, ?> parent) {
             super();
-            this.parent = parent;
+            this.parent = (ListOrderedMap<K, Object>) parent;
         }
 
         public int size() {
@@ -512,28 +507,28 @@ public class ListOrderedMap
             this.parent.clear();
         }
 
-        public Iterator iterator() {
-            return new AbstractIteratorDecorator(parent.entrySet().iterator()) {
-                public Object next() {
-                    return ((Map.Entry) super.next()).getKey();
+        public Iterator<K> iterator() {
+            return new AbstractUntypedIteratorDecorator<Map.Entry<K, Object>, K>(parent.entrySet().iterator()) {
+                public K next() {
+                    return getIterator().next().getKey();
                 }
             };
         }
     }
 
     //-----------------------------------------------------------------------    
-    static class EntrySetView extends AbstractSet {
-        private final ListOrderedMap parent;
-        private final List insertOrder;
-        private Set entrySet;
+    static class EntrySetView<K, V> extends AbstractSet<Map.Entry<K, V>> {
+        private final ListOrderedMap<K, V> parent;
+        private final List<K> insertOrder;
+        private Set<Map.Entry<K, V>> entrySet;
 
-        public EntrySetView(ListOrderedMap parent, List insertOrder) {
+        public EntrySetView(ListOrderedMap<K, V> parent, List<K> insertOrder) {
             super();
             this.parent = parent;
             this.insertOrder = insertOrder;
         }
 
-        private Set getEntrySet() {
+        private Set<Map.Entry<K, V>> getEntrySet() {
             if (entrySet == null) {
                 entrySet = parent.decorated().entrySet();
             }
@@ -551,16 +546,17 @@ public class ListOrderedMap
             return getEntrySet().contains(obj);
         }
 
-        public boolean containsAll(Collection coll) {
+        public boolean containsAll(Collection<?> coll) {
             return getEntrySet().containsAll(coll);
         }
 
+        @SuppressWarnings("unchecked")
         public boolean remove(Object obj) {
             if (obj instanceof Map.Entry == false) {
                 return false;
             }
             if (getEntrySet().contains(obj)) {
-                Object key = ((Map.Entry) obj).getKey();
+                Object key = ((Map.Entry<K, V>) obj).getKey();
                 parent.remove(key);
                 return true;
             }
@@ -570,14 +566,14 @@ public class ListOrderedMap
         public void clear() {
             this.parent.clear();
         }
-        
+
         public boolean equals(Object obj) {
             if (obj == this) {
                 return true;
             }
             return getEntrySet().equals(obj);
         }
-        
+
         public int hashCode() {
             return getEntrySet().hashCode();
         }
@@ -585,25 +581,25 @@ public class ListOrderedMap
         public String toString() {
             return getEntrySet().toString();
         }
-        
-        public Iterator iterator() {
-            return new ListOrderedIterator(parent, insertOrder);
+
+        public Iterator<Map.Entry<K, V>> iterator() {
+            return new ListOrderedIterator<K, V>(parent, insertOrder);
         }
     }
-    
+
     //-----------------------------------------------------------------------
-    static class ListOrderedIterator extends AbstractIteratorDecorator {
-        private final ListOrderedMap parent;
-        private Object last = null;
+    static class ListOrderedIterator<K, V> extends AbstractUntypedIteratorDecorator<K, Map.Entry<K, V>> {
+        private final ListOrderedMap<K, V> parent;
+        private K last = null;
         
-        ListOrderedIterator(ListOrderedMap parent, List insertOrder) {
+        ListOrderedIterator(ListOrderedMap<K, V> parent, List<K> insertOrder) {
             super(insertOrder.iterator());
             this.parent = parent;
         }
-        
-        public Object next() {
-            last = super.next();
-            return new ListOrderedMapEntry(parent, last);
+
+        public Map.Entry<K, V> next() {
+            last = getIterator().next();
+            return new ListOrderedMapEntry<K, V>(parent, last);
         }
 
         public void remove() {
@@ -611,43 +607,43 @@ public class ListOrderedMap
             parent.decorated().remove(last);
         }
     }
-    
+
     //-----------------------------------------------------------------------
-    static class ListOrderedMapEntry extends AbstractMapEntry {
-        private final ListOrderedMap parent;
-        
-        ListOrderedMapEntry(ListOrderedMap parent, Object key) {
+    static class ListOrderedMapEntry<K, V> extends AbstractMapEntry<K, V> {
+        private final ListOrderedMap<K, V> parent;
+
+        ListOrderedMapEntry(ListOrderedMap<K, V> parent, K key) {
             super(key, null);
             this.parent = parent;
         }
-        
-        public Object getValue() {
+
+        public V getValue() {
             return parent.get(key);
         }
 
-        public Object setValue(Object value) {
+        public V setValue(V value) {
             return parent.decorated().put(key, value);
         }
     }
 
     //-----------------------------------------------------------------------
-    static class ListOrderedMapIterator implements OrderedMapIterator, ResettableIterator {
-        private final ListOrderedMap parent;
-        private ListIterator iterator;
-        private Object last = null;
+    static class ListOrderedMapIterator<K, V> implements OrderedMapIterator<K, V>, ResettableIterator<K> {
+        private final ListOrderedMap<K, V> parent;
+        private ListIterator<K> iterator;
+        private K last = null;
         private boolean readable = false;
-        
-        ListOrderedMapIterator(ListOrderedMap parent) {
+
+        ListOrderedMapIterator(ListOrderedMap<K, V> parent) {
             super();
             this.parent = parent;
             this.iterator = parent.insertOrder.listIterator();
         }
-        
+
         public boolean hasNext() {
             return iterator.hasNext();
         }
-        
-        public Object next() {
+
+        public K next() {
             last = iterator.next();
             readable = true;
             return last;
@@ -656,13 +652,13 @@ public class ListOrderedMap
         public boolean hasPrevious() {
             return iterator.hasPrevious();
         }
-        
-        public Object previous() {
+
+        public K previous() {
             last = iterator.previous();
             readable = true;
             return last;
         }
-        
+
         public void remove() {
             if (readable == false) {
                 throw new IllegalStateException(AbstractHashedMap.REMOVE_INVALID);
@@ -671,41 +667,40 @@ public class ListOrderedMap
             parent.map.remove(last);
             readable = false;
         }
-        
-        public Object getKey() {
+
+        public K getKey() {
             if (readable == false) {
                 throw new IllegalStateException(AbstractHashedMap.GETKEY_INVALID);
             }
             return last;
         }
 
-        public Object getValue() {
+        public V getValue() {
             if (readable == false) {
                 throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID);
             }
             return parent.get(last);
         }
-        
-        public Object setValue(Object value) {
+
+        public V setValue(V value) {
             if (readable == false) {
                 throw new IllegalStateException(AbstractHashedMap.SETVALUE_INVALID);
             }
             return parent.map.put(last, value);
         }
-        
+
         public void reset() {
             iterator = parent.insertOrder.listIterator();
             last = null;
             readable = false;
         }
-        
+
         public String toString() {
             if (readable == true) {
                 return "Iterator[" + getKey() + "=" + getValue() + "]";
-            } else {
-                return "Iterator[]";
             }
+            return "Iterator[]";
         }
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/MultiKeyMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/MultiKeyMap.java b/src/java/org/apache/commons/collections/map/MultiKeyMap.java
index b8af692..563e7bd 100644
--- a/src/java/org/apache/commons/collections/map/MultiKeyMap.java
+++ b/src/java/org/apache/commons/collections/map/MultiKeyMap.java
@@ -17,10 +17,7 @@
 package org.apache.commons.collections.map;
 
 import java.io.Serializable;
-import java.util.Collection;
-import java.util.Iterator;
 import java.util.Map;
-import java.util.Set;
 
 import org.apache.commons.collections.IterableMap;
 import org.apache.commons.collections.MapIterator;
@@ -77,14 +74,15 @@ import org.apache.commons.collections.keyvalue.MultiKey;
  *
  * @author Stephen Colebourne
  */
-public class MultiKeyMap
-        implements IterableMap, Serializable {
+public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K>, V>
+        implements IterableMap<MultiKey<? extends K>, V>, Serializable {
 
     /** Serialisation version */
     private static final long serialVersionUID = -1788199231038721040L;
 
     /** The decorated map */
-    protected final AbstractHashedMap map;
+    //keep this member around for serialization BC with older Collections releases assuming we want to do that
+    protected AbstractHashedMap<MultiKey<? extends K>, V> map;
 
     //-----------------------------------------------------------------------
     /**
@@ -94,14 +92,14 @@ public class MultiKeyMap
      * @param map  the map to decorate, not null
      * @throws IllegalArgumentException if the map is null or not empty
      */
-    public static MultiKeyMap decorate(AbstractHashedMap map) {
+    public static <K, V> MultiKeyMap<K, V> decorate(AbstractHashedMap<MultiKey<? extends K>, V> map) {
         if (map == null) {
             throw new IllegalArgumentException("Map must not be null");
         }
         if (map.size() > 0) {
             throw new IllegalArgumentException("Map must be empty");
         }
-        return new MultiKeyMap(map);
+        return new MultiKeyMap<K, V>(map);
     }
 
     //-----------------------------------------------------------------------    
@@ -109,8 +107,7 @@ public class MultiKeyMap
      * Constructs a new MultiKeyMap that decorates a <code>HashedMap</code>.
      */
     public MultiKeyMap() {
-        super();
-        map = new HashedMap();
+        this(new HashedMap<MultiKey<? extends K>, V>());
     }
 
     /**
@@ -121,8 +118,8 @@ public class MultiKeyMap
      *
      * @param map  the map to decorate
      */
-    protected MultiKeyMap(AbstractHashedMap map) {
-        super();
+    protected MultiKeyMap(AbstractHashedMap<MultiKey<? extends K>, V> map) {
+        super(map);
         this.map = map;
     }
 
@@ -134,9 +131,9 @@ public class MultiKeyMap
      * @param key2  the second key
      * @return the mapped value, null if no match
      */
-    public Object get(Object key1, Object key2) {
+    public V get(Object key1, Object key2) {
         int hashCode = hash(key1, key2);
-        AbstractHashedMap.HashEntry entry = map.data[map.hashIndex(hashCode, map.data.length)];
+        AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> entry = decorated().data[decorated().hashIndex(hashCode, decorated().data.length)];
         while (entry != null) {
             if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2)) {
                 return entry.getValue();
@@ -155,7 +152,7 @@ public class MultiKeyMap
      */
     public boolean containsKey(Object key1, Object key2) {
         int hashCode = hash(key1, key2);
-        AbstractHashedMap.HashEntry entry = map.data[map.hashIndex(hashCode, map.data.length)];
+        AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> entry = decorated().data[decorated().hashIndex(hashCode, decorated().data.length)];
         while (entry != null) {
             if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2)) {
                 return true;
@@ -173,20 +170,19 @@ public class MultiKeyMap
      * @param value  the value to store
      * @return the value previously mapped to this combined key, null if none
      */
-    public Object put(Object key1, Object key2, Object value) {
+    public V put(K key1, K key2, V value) {
         int hashCode = hash(key1, key2);
-        int index = map.hashIndex(hashCode, map.data.length);
-        AbstractHashedMap.HashEntry entry = map.data[index];
+        int index = decorated().hashIndex(hashCode, decorated().data.length);
+        AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> entry = decorated().data[index];
         while (entry != null) {
             if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2)) {
-                Object oldValue = entry.getValue();
-                map.updateEntry(entry, value);
+                V oldValue = entry.getValue();
+                decorated().updateEntry(entry, value);
                 return oldValue;
             }
             entry = entry.next;
         }
-        
-        map.addMapping(index, hashCode, new MultiKey(key1, key2), value);
+        decorated().addMapping(index, hashCode, new MultiKey<K>(key1, key2), value);
         return null;
     }
 
@@ -197,15 +193,15 @@ public class MultiKeyMap
      * @param key2  the second key
      * @return the value mapped to the removed key, null if key not in map
      */
-    public Object remove(Object key1, Object key2) {
+    public V remove(Object key1, Object key2) {
         int hashCode = hash(key1, key2);
-        int index = map.hashIndex(hashCode, map.data.length);
-        AbstractHashedMap.HashEntry entry = map.data[index];
-        AbstractHashedMap.HashEntry previous = null;
+        int index = decorated().hashIndex(hashCode, decorated().data.length);
+        AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> entry = decorated().data[index];
+        AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> previous = null;
         while (entry != null) {
             if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2)) {
-                Object oldValue = entry.getValue();
-                map.removeMapping(entry, index, previous);
+                V oldValue = entry.getValue();
+                decorated().removeMapping(entry, index, previous);
                 return oldValue;
             }
             previous = entry;
@@ -244,12 +240,13 @@ public class MultiKeyMap
      * @param key2  the second key
      * @return true if the key matches
      */
-    protected boolean isEqualKey(AbstractHashedMap.HashEntry entry, Object key1, Object key2) {
-        MultiKey multi = (MultiKey) entry.getKey();
+    protected boolean isEqualKey(AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> entry,
+            Object key1, Object key2) {
+        MultiKey<? extends K> multi = entry.getKey();
         return
             multi.size() == 2 &&
-            (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))) &&
-            (key2 == null ? multi.getKey(1) == null : key2.equals(multi.getKey(1)));
+            (key1 == multi.getKey(0) || key1 != null && key1.equals(multi.getKey(0))) &&
+            (key2 == multi.getKey(1) || key1 != null && key2.equals(multi.getKey(1)));
     }
 
     //-----------------------------------------------------------------------
@@ -261,9 +258,9 @@ public class MultiKeyMap
      * @param key3  the third key
      * @return the mapped value, null if no match
      */
-    public Object get(Object key1, Object key2, Object key3) {
+    public V get(Object key1, Object key2, Object key3) {
         int hashCode = hash(key1, key2, key3);
-        AbstractHashedMap.HashEntry entry = map.data[map.hashIndex(hashCode, map.data.length)];
+        AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> entry = decorated().data[decorated().hashIndex(hashCode, decorated().data.length)];
         while (entry != null) {
             if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3)) {
                 return entry.getValue();
@@ -283,7 +280,7 @@ public class MultiKeyMap
      */
     public boolean containsKey(Object key1, Object key2, Object key3) {
         int hashCode = hash(key1, key2, key3);
-        AbstractHashedMap.HashEntry entry = map.data[map.hashIndex(hashCode, map.data.length)];
+        AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> entry = decorated().data[decorated().hashIndex(hashCode, decorated().data.length)];
         while (entry != null) {
             if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3)) {
                 return true;
@@ -302,20 +299,19 @@ public class MultiKeyMap
      * @param value  the value to store
      * @return the value previously mapped to this combined key, null if none
      */
-    public Object put(Object key1, Object key2, Object key3, Object value) {
+    public V put(K key1, K key2, K key3, V value) {
         int hashCode = hash(key1, key2, key3);
-        int index = map.hashIndex(hashCode, map.data.length);
-        AbstractHashedMap.HashEntry entry = map.data[index];
+        int index = decorated().hashIndex(hashCode, decorated().data.length);
+        AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> entry = decorated().data[index];
         while (entry != null) {
             if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3)) {
-                Object oldValue = entry.getValue();
-                map.updateEntry(entry, value);
+                V oldValue = entry.getValue();
+                decorated().updateEntry(entry, value);
                 return oldValue;
             }
             entry = entry.next;
         }
-        
-        map.addMapping(index, hashCode, new MultiKey(key1, key2, key3), value);
+        decorated().addMapping(index, hashCode, new MultiKey<K>(key1, key2, key3), value);
         return null;
     }
 
@@ -327,15 +323,15 @@ public class MultiKeyMap
      * @param key3  the third key
      * @return the value mapped to the removed key, null if key not in map
      */
-    public Object remove(Object key1, Object key2, Object key3) {
+    public V remove(Object key1, Object key2, Object key3) {
         int hashCode = hash(key1, key2, key3);
-        int index = map.hashIndex(hashCode, map.data.length);
-        AbstractHashedMap.HashEntry entry = map.data[index];
-        AbstractHashedMap.HashEntry previous = null;
+        int index = decorated().hashIndex(hashCode, decorated().data.length);
+        AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> entry = decorated().data[index];
+        AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> previous = null;
         while (entry != null) {
             if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3)) {
-                Object oldValue = entry.getValue();
-                map.removeMapping(entry, index, previous);
+                V oldValue = entry.getValue();
+                decorated().removeMapping(entry, index, previous);
                 return oldValue;
             }
             previous = entry;
@@ -379,13 +375,13 @@ public class MultiKeyMap
      * @param key3  the third key
      * @return true if the key matches
      */
-    protected boolean isEqualKey(AbstractHashedMap.HashEntry entry, Object key1, Object key2, Object key3) {
-        MultiKey multi = (MultiKey) entry.getKey();
+    protected boolean isEqualKey(AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> entry, Object key1, Object key2, Object key3) {
+        MultiKey<? extends K> multi = entry.getKey();
         return
             multi.size() == 3 &&
-            (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))) &&
-            (key2 == null ? multi.getKey(1) == null : key2.equals(multi.getKey(1))) &&
-            (key3 == null ? multi.getKey(2) == null : key3.equals(multi.getKey(2)));
+            (key1 == multi.getKey(0) || key1 != null && key1.equals(multi.getKey(0))) &&
+            (key2 == multi.getKey(1) || key2 != null && key2.equals(multi.getKey(1))) &&
+            (key3 == multi.getKey(2) || key3 != null && key3.equals(multi.getKey(2)));
     }
 
     //-----------------------------------------------------------------------
@@ -398,9 +394,9 @@ public class MultiKeyMap
      * @param key4  the fourth key
      * @return the mapped value, null if no match
      */
-    public Object get(Object key1, Object key2, Object key3, Object key4) {
+    public V get(Object key1, Object key2, Object key3, Object key4) {
         int hashCode = hash(key1, key2, key3, key4);
-        AbstractHashedMap.HashEntry entry = map.data[map.hashIndex(hashCode, map.data.length)];
+        AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> entry = decorated().data[decorated().hashIndex(hashCode, decorated().data.length)];
         while (entry != null) {
             if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3, key4)) {
                 return entry.getValue();
@@ -421,7 +417,7 @@ public class MultiKeyMap
      */
     public boolean containsKey(Object key1, Object key2, Object key3, Object key4) {
         int hashCode = hash(key1, key2, key3, key4);
-        AbstractHashedMap.HashEntry entry = map.data[map.hashIndex(hashCode, map.data.length)];
+        AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> entry = decorated().data[decorated().hashIndex(hashCode, decorated().data.length)];
         while (entry != null) {
             if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3, key4)) {
                 return true;
@@ -441,20 +437,19 @@ public class MultiKeyMap
      * @param value  the value to store
      * @return the value previously mapped to this combined key, null if none
      */
-    public Object put(Object key1, Object key2, Object key3, Object key4, Object value) {
+    public V put(K key1, K key2, K key3, K key4, V value) {
         int hashCode = hash(key1, key2, key3, key4);
-        int index = map.hashIndex(hashCode, map.data.length);
-        AbstractHashedMap.HashEntry entry = map.data[index];
+        int index = decorated().hashIndex(hashCode, decorated().data.length);
+        AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> entry = decorated().data[index];
         while (entry != null) {
             if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3, key4)) {
-                Object oldValue = entry.getValue();
-                map.updateEntry(entry, value);
+                V oldValue = entry.getValue();
+                decorated().updateEntry(entry, value);
                 return oldValue;
             }
             entry = entry.next;
         }
-        
-        map.addMapping(index, hashCode, new MultiKey(key1, key2, key3, key4), value);
+        decorated().addMapping(index, hashCode, new MultiKey<K>(key1, key2, key3, key4), value);
         return null;
     }
 
@@ -467,15 +462,15 @@ public class MultiKeyMap
      * @param key4  the fourth key
      * @return the value mapped to the removed key, null if key not in map
      */
-    public Object remove(Object key1, Object key2, Object key3, Object key4) {
+    public V remove(Object key1, Object key2, Object key3, Object key4) {
         int hashCode = hash(key1, key2, key3, key4);
-        int index = map.hashIndex(hashCode, map.data.length);
-        AbstractHashedMap.HashEntry entry = map.data[index];
-        AbstractHashedMap.HashEntry previous = null;
+        int index = decorated().hashIndex(hashCode, decorated().data.length);
+        AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> entry = decorated().data[index];
+        AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> previous = null;
         while (entry != null) {
             if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3, key4)) {
-                Object oldValue = entry.getValue();
-                map.removeMapping(entry, index, previous);
+                V oldValue = entry.getValue();
+                decorated().removeMapping(entry, index, previous);
                 return oldValue;
             }
             previous = entry;
@@ -524,14 +519,14 @@ public class MultiKeyMap
      * @param key4  the fourth key
      * @return true if the key matches
      */
-    protected boolean isEqualKey(AbstractHashedMap.HashEntry entry, Object key1, Object key2, Object key3, Object key4) {
-        MultiKey multi = (MultiKey) entry.getKey();
+    protected boolean isEqualKey(AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> entry, Object key1, Object key2, Object key3, Object key4) {
+        MultiKey<? extends K> multi = entry.getKey();
         return
             multi.size() == 4 &&
-            (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))) &&
-            (key2 == null ? multi.getKey(1) == null : key2.equals(multi.getKey(1))) &&
-            (key3 == null ? multi.getKey(2) == null : key3.equals(multi.getKey(2))) &&
-            (key4 == null ? multi.getKey(3) == null : key4.equals(multi.getKey(3)));
+            (key1 == multi.getKey(0) || key1 != null && key1.equals(multi.getKey(0))) &&
+            (key2 == multi.getKey(1) || key2 != null && key2.equals(multi.getKey(1))) &&
+            (key3 == multi.getKey(2) || key3 != null && key3.equals(multi.getKey(2))) &&
+            (key4 == multi.getKey(3) || key4 != null && key4.equals(multi.getKey(3)));
     }
 
     //-----------------------------------------------------------------------
@@ -545,9 +540,9 @@ public class MultiKeyMap
      * @param key5  the fifth key
      * @return the mapped value, null if no match
      */
-    public Object get(Object key1, Object key2, Object key3, Object key4, Object key5) {
+    public V get(Object key1, Object key2, Object key3, Object key4, Object key5) {
         int hashCode = hash(key1, key2, key3, key4, key5);
-        AbstractHashedMap.HashEntry entry = map.data[map.hashIndex(hashCode, map.data.length)];
+        AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> entry = decorated().data[decorated().hashIndex(hashCode, decorated().data.length)];
         while (entry != null) {
             if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3, key4, key5)) {
                 return entry.getValue();
@@ -569,7 +564,7 @@ public class MultiKeyMap
      */
     public boolean containsKey(Object key1, Object key2, Object key3, Object key4, Object key5) {
         int hashCode = hash(key1, key2, key3, key4, key5);
-        AbstractHashedMap.HashEntry entry = map.data[map.hashIndex(hashCode, map.data.length)];
+        AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> entry = decorated().data[decorated().hashIndex(hashCode, decorated().data.length)];
         while (entry != null) {
             if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3, key4, key5)) {
                 return true;
@@ -590,20 +585,19 @@ public class MultiKeyMap
      * @param value  the value to store
      * @return the value previously mapped to this combined key, null if none
      */
-    public Object put(Object key1, Object key2, Object key3, Object key4, Object key5, Object value) {
+    public V put(K key1, K key2, K key3, K key4, K key5, V value) {
         int hashCode = hash(key1, key2, key3, key4, key5);
-        int index = map.hashIndex(hashCode, map.data.length);
-        AbstractHashedMap.HashEntry entry = map.data[index];
+        int index = decorated().hashIndex(hashCode, decorated().data.length);
+        AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> entry = decorated().data[index];
         while (entry != null) {
             if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3, key4, key5)) {
-                Object oldValue = entry.getValue();
-                map.updateEntry(entry, value);
+                V oldValue = entry.getValue();
+                decorated().updateEntry(entry, value);
                 return oldValue;
             }
             entry = entry.next;
         }
-        
-        map.addMapping(index, hashCode, new MultiKey(key1, key2, key3, key4, key5), value);
+        decorated().addMapping(index, hashCode, new MultiKey<K>(key1, key2, key3, key4, key5), value);
         return null;
     }
 
@@ -617,15 +611,15 @@ public class MultiKeyMap
      * @param key5  the fifth key
      * @return the value mapped to the removed key, null if key not in map
      */
-    public Object remove(Object key1, Object key2, Object key3, Object key4, Object key5) {
+    public V remove(Object key1, Object key2, Object key3, Object key4, Object key5) {
         int hashCode = hash(key1, key2, key3, key4, key5);
-        int index = map.hashIndex(hashCode, map.data.length);
-        AbstractHashedMap.HashEntry entry = map.data[index];
-        AbstractHashedMap.HashEntry previous = null;
+        int index = decorated().hashIndex(hashCode, decorated().data.length);
+        AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> entry = decorated().data[index];
+        AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> previous = null;
         while (entry != null) {
             if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3, key4, key5)) {
-                Object oldValue = entry.getValue();
-                map.removeMapping(entry, index, previous);
+                V oldValue = entry.getValue();
+                decorated().removeMapping(entry, index, previous);
                 return oldValue;
             }
             previous = entry;
@@ -679,15 +673,16 @@ public class MultiKeyMap
      * @param key5  the fifth key
      * @return true if the key matches
      */
-    protected boolean isEqualKey(AbstractHashedMap.HashEntry entry, Object key1, Object key2, Object key3, Object key4, Object key5) {
-        MultiKey multi = (MultiKey) entry.getKey();
+    protected boolean isEqualKey(AbstractHashedMap.HashEntry<MultiKey<? extends K>, V> entry,
+            Object key1, Object key2, Object key3, Object key4, Object key5) {
+        MultiKey<? extends K> multi = entry.getKey();
         return
             multi.size() == 5 &&
-            (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))) &&
-            (key2 == null ? multi.getKey(1) == null : key2.equals(multi.getKey(1))) &&
-            (key3 == null ? multi.getKey(2) == null : key3.equals(multi.getKey(2))) &&
-            (key4 == null ? multi.getKey(3) == null : key4.equals(multi.getKey(3))) &&
-            (key5 == null ? multi.getKey(4) == null : key5.equals(multi.getKey(4)));
+            (key1 == multi.getKey(0) || key1 != null && key1.equals(multi.getKey(0))) &&
+            (key2 == multi.getKey(1) || key2 != null && key2.equals(multi.getKey(1))) &&
+            (key3 == multi.getKey(2) || key3 != null && key3.equals(multi.getKey(2))) &&
+            (key4 == multi.getKey(3) || key4 != null && key4.equals(multi.getKey(3))) &&
+            (key5 == multi.getKey(4) || key5 != null && key5.equals(multi.getKey(4)));
     }
 
     //-----------------------------------------------------------------------
@@ -702,9 +697,9 @@ public class MultiKeyMap
      */
     public boolean removeAll(Object key1) {
         boolean modified = false;
-        MapIterator it = mapIterator();
+        MapIterator<MultiKey<? extends K>, V> it = mapIterator();
         while (it.hasNext()) {
-            MultiKey multi = (MultiKey) it.next();
+            MultiKey<? extends K> multi = it.next();
             if (multi.size() >= 1 &&
                 (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0)))) {
                 it.remove();
@@ -726,9 +721,9 @@ public class MultiKeyMap
      */
     public boolean removeAll(Object key1, Object key2) {
         boolean modified = false;
-        MapIterator it = mapIterator();
+        MapIterator<MultiKey<? extends K>, V> it = mapIterator();
         while (it.hasNext()) {
-            MultiKey multi = (MultiKey) it.next();
+            MultiKey<? extends K> multi = it.next();
             if (multi.size() >= 2 &&
                 (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))) &&
                 (key2 == null ? multi.getKey(1) == null : key2.equals(multi.getKey(1)))) {
@@ -752,9 +747,9 @@ public class MultiKeyMap
      */
     public boolean removeAll(Object key1, Object key2, Object key3) {
         boolean modified = false;
-        MapIterator it = mapIterator();
+        MapIterator<MultiKey<? extends K>, V> it = mapIterator();
         while (it.hasNext()) {
-            MultiKey multi = (MultiKey) it.next();
+            MultiKey<? extends K> multi = it.next();
             if (multi.size() >= 3 &&
                 (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))) &&
                 (key2 == null ? multi.getKey(1) == null : key2.equals(multi.getKey(1))) &&
@@ -780,9 +775,9 @@ public class MultiKeyMap
      */
     public boolean removeAll(Object key1, Object key2, Object key3, Object key4) {
         boolean modified = false;
-        MapIterator it = mapIterator();
+        MapIterator<MultiKey<? extends K>, V> it = mapIterator();
         while (it.hasNext()) {
-            MultiKey multi = (MultiKey) it.next();
+            MultiKey<? extends K> multi = it.next();
             if (multi.size() >= 4 &&
                 (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))) &&
                 (key2 == null ? multi.getKey(1) == null : key2.equals(multi.getKey(1))) &&
@@ -801,13 +796,10 @@ public class MultiKeyMap
      * 
      * @param key  the key to check
      */
-    protected void checkKey(Object key) {
+    protected void checkKey(MultiKey<?> key) {
         if (key == null) {
             throw new NullPointerException("Key must not be null");
         }
-        if (key instanceof MultiKey == false) {
-            throw new ClassCastException("Key must be a MultiKey");
-        }
     }
 
     /**
@@ -815,8 +807,8 @@ public class MultiKeyMap
      *
      * @return a shallow clone
      */
-    public Object clone() {
-        return new MultiKeyMap((AbstractHashedMap) map.clone());
+    public MultiKeyMap<K, V> clone() {
+        return new MultiKeyMap<K, V>(decorated().clone());
     }
 
     /**
@@ -829,9 +821,9 @@ public class MultiKeyMap
      * @throws NullPointerException if the key is null
      * @throws ClassCastException if the key is not a MultiKey
      */
-    public Object put(Object key, Object value) {
+    public V put(MultiKey<? extends K> key, V value) {
         checkKey(key);
-        return map.put(key, value);
+        return super.put(key, value);
     }
 
     /**
@@ -842,72 +834,24 @@ public class MultiKeyMap
      * @throws NullPointerException if the mapToCopy or any key within is null
      * @throws ClassCastException if any key in mapToCopy is not a MultiKey
      */
-    public void putAll(Map mapToCopy) {
-        for (Iterator it = mapToCopy.keySet().iterator(); it.hasNext();) {
-            Object key = it.next();
+    @Override
+    public void putAll(Map<? extends MultiKey<? extends K>, ? extends V> mapToCopy) {
+        for (MultiKey<? extends K> key : mapToCopy.keySet()) {
             checkKey(key);
         }
-        map.putAll(mapToCopy);
+        super.putAll(mapToCopy);
     }
 
     //-----------------------------------------------------------------------
-    public MapIterator mapIterator() {
-        return map.mapIterator();
-    }
-
-    public int size() {
-        return map.size();
-    }
-
-    public boolean isEmpty() {
-        return map.isEmpty();
-    }
-
-    public boolean containsKey(Object key) {
-        return map.containsKey(key);
-    }
-
-    public boolean containsValue(Object value) {
-        return map.containsValue(value);
-    }
-
-    public Object get(Object key) {
-        return map.get(key);
-    }
-
-    public Object remove(Object key) {
-        return map.remove(key);
-    }
-
-    public void clear() {
-        map.clear();
+    public MapIterator<MultiKey<? extends K>, V> mapIterator() {
+        return decorated().mapIterator();
     }
 
-    public Set keySet() {
-        return map.keySet();
-    }
-
-    public Collection values() {
-        return map.values();
-    }
-
-    public Set entrySet() {
-        return map.entrySet();
-    }
-
-    public boolean equals(Object obj) {
-        if (obj == this) {
-            return true;
-        }
-        return map.equals(obj);
-    }
-
-    public int hashCode() {
-        return map.hashCode();
-    }
-
-    public String toString() {
-        return map.toString();
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected AbstractHashedMap<MultiKey<? extends K>, V> decorated() {
+        return map;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/MultiValueMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/MultiValueMap.java b/src/java/org/apache/commons/collections/map/MultiValueMap.java
index 04f6522..b7b7059 100644
--- a/src/java/org/apache/commons/collections/map/MultiValueMap.java
+++ b/src/java/org/apache/commons/collections/map/MultiValueMap.java
@@ -24,6 +24,7 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.Factory;
 import org.apache.commons.collections.FunctorException;
 import org.apache.commons.collections.MultiMap;
@@ -61,12 +62,12 @@ import org.apache.commons.collections.iterators.IteratorChain;
  * @version $Revision$ $Date$
  * @since Commons Collections 3.2
  */
-public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
+public class MultiValueMap<K, V> extends AbstractMapDecorator<K, Object> implements MultiMap<K, V> {
 
     /** The factory for creating value collections. */
-    private final Factory collectionFactory;
+    private final Factory<? extends Collection<V>> collectionFactory;
     /** The cached values. */
-    private transient Collection values;
+    private transient Collection<V> values;
 
     /**
      * Creates a map which wraps the given map and
@@ -74,8 +75,9 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
      *
      * @param map  the map to wrap
      */
-    public static MultiValueMap decorate(Map map) {
-        return new MultiValueMap(map, new ReflectionFactory(ArrayList.class));
+    @SuppressWarnings("unchecked")
+    public static <K, V> MultiValueMap<K, V> decorate(Map<K, ? super Collection<V>> map) {
+        return MultiValueMap.<K, V, ArrayList>decorate((Map<K, ? super Collection>) map, ArrayList.class);
     }
 
     /**
@@ -85,8 +87,8 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
      * @param map  the map to wrap
      * @param collectionClass  the type of the collection class
      */
-    public static MultiValueMap decorate(Map map, Class collectionClass) {
-        return new MultiValueMap(map, new ReflectionFactory(collectionClass));
+    public static <K, V, C extends Collection<V>> MultiValueMap<K, V> decorate(Map<K, ? super C> map, Class<C> collectionClass) {
+        return new MultiValueMap<K, V>(map, new ReflectionFactory<C>(collectionClass));
     }
 
     /**
@@ -96,8 +98,8 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
      * @param map  the map to decorate
      * @param collectionFactory  the collection factory (must return a Collection object).
      */
-    public static MultiValueMap decorate(Map map, Factory collectionFactory) {
-        return new MultiValueMap(map, collectionFactory);
+    public static <K, V, C extends Collection<V>> MultiValueMap<K, V> decorate(Map<K, ? super C> map, Factory<C> collectionFactory) {
+        return new MultiValueMap<K, V>(map, collectionFactory);
     }
 
     //-----------------------------------------------------------------------
@@ -105,6 +107,7 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
      * Creates a MultiValueMap based on a <code>HashMap</code> and
      * storing the multiple values in an <code>ArrayList</code>.
      */
+    @SuppressWarnings("unchecked")
     public MultiValueMap() {
         this(new HashMap(), new ReflectionFactory(ArrayList.class));
     }
@@ -116,8 +119,9 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
      * @param map  the map to decorate
      * @param collectionFactory  the collection factory which must return a Collection instance
      */
-    protected MultiValueMap(Map map, Factory collectionFactory) {
-        super(map);
+    @SuppressWarnings("unchecked")
+    protected <C extends Collection<V>> MultiValueMap(Map<K, ? super C> map, Factory<C> collectionFactory) {
+        super((Map<K, Object>) map);
         if (collectionFactory == null) {
             throw new IllegalArgumentException("The factory must not be null");
         }
@@ -153,8 +157,9 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
      * @param value the value to remove
      * @return the value removed (which was passed in), null if nothing removed
      */
-    public Object remove(Object key, Object value) {
-        Collection valuesForKey = getCollection(key);
+    @SuppressWarnings("unchecked")
+    public V remove(Object key, Object value) {
+        Collection<V> valuesForKey = getCollection(key);
         if (valuesForKey == null) {
             return null;
         }
@@ -165,7 +170,7 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
         if (valuesForKey.isEmpty()) {
             remove(key);
         }
-        return value;
+        return (V) value;
     }
 
     /**
@@ -176,17 +181,14 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
      * @param value  the value to search for
      * @return true if the map contains the value
      */
+    @SuppressWarnings("unchecked")
     public boolean containsValue(Object value) {
-        Set pairs = decorated().entrySet();
-        if (pairs == null) {
-            return false;
-        }
-        Iterator pairsIterator = pairs.iterator();
-        while (pairsIterator.hasNext()) {
-            Map.Entry keyValuePair = (Map.Entry) pairsIterator.next();
-            Collection coll = (Collection) keyValuePair.getValue();
-            if (coll.contains(value)) {
-                return true;
+        Set<Map.Entry<K, Object>> pairs = decorated().entrySet();
+        if (pairs != null) {
+            for (Map.Entry<K, Object> entry : pairs) {
+                if (((Collection<V>) entry.getValue()).contains(value)) {
+                    return true;
+                }
             }
         }
         return false;
@@ -202,19 +204,20 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
      * @param value  the value to add to the collection at the key
      * @return the value added if the map changed and null if the map did not change
      */
-    public Object put(Object key, Object value) {
+    @SuppressWarnings("unchecked")
+    public Object put(K key, Object value) {
         boolean result = false;
-        Collection coll = getCollection(key);
+        Collection<V> coll = getCollection(key);
         if (coll == null) {
             coll = createCollection(1);  // might produce a non-empty collection
-            coll.add(value);
+            coll.add((V) value);
             if (coll.size() > 0) {
                 // only add if non-zero size to maintain class state
                 decorated().put(key, coll);
                 result = true;  // map definitely changed
             }
         } else {
-            result = coll.add(value);
+            result = coll.add((V) value);
         }
         return (result ? value : null);
     }
@@ -230,17 +233,15 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
      *
      * @param map  the map to copy (either a normal or multi map)
      */
-    public void putAll(Map map) {
+    @SuppressWarnings("unchecked")
+    public void putAll(Map<? extends K, ?> map) {
         if (map instanceof MultiMap) {
-            for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
-                Map.Entry entry = (Map.Entry) it.next();
-                Collection coll = (Collection) entry.getValue();
-                putAll(entry.getKey(), coll);
+            for (Map.Entry<? extends K, Object> entry : ((MultiMap<? extends K, V>) map).entrySet()) {
+                putAll(entry.getKey(), (Collection<V>) entry.getValue());
             }
         } else {
-            for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
-                Map.Entry entry = (Map.Entry) it.next();
-                put(entry.getKey(), entry.getValue());
+            for (Map.Entry<? extends K, ?> entry : map.entrySet()) {
+                put(entry.getKey(), (V) entry.getValue());
             }
         }
     }
@@ -252,9 +253,10 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
      *
      * @return a collection view of the values contained in this map
      */
-    public Collection values() {
-        Collection vs = values;
-        return (vs != null ? vs : (values = new Values()));
+    @SuppressWarnings("unchecked")
+    public Collection<Object> values() {
+        Collection<V> vs = values;
+        return (Collection<Object>) (vs != null ? vs : (values = new Values()));
     }
 
     /**
@@ -264,7 +266,7 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
      * @return true if the map contains the value
      */
     public boolean containsValue(Object key, Object value) {
-        Collection coll = getCollection(key);
+        Collection<V> coll = getCollection(key);
         if (coll == null) {
             return false;
         }
@@ -278,8 +280,9 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
      * @param key  the key to retrieve
      * @return the collection mapped to the key, null if no mapping
      */
-    public Collection getCollection(Object key) {
-        return (Collection) decorated().get(key);
+    @SuppressWarnings("unchecked")
+    public Collection<V> getCollection(Object key) {
+        return (Collection<V>) decorated().get(key);
     }
 
     /**
@@ -289,7 +292,7 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
      * @return the size of the collection at the key, zero if key not in map
      */
     public int size(Object key) {
-        Collection coll = getCollection(key);
+        Collection<V> coll = getCollection(key);
         if (coll == null) {
             return 0;
         }
@@ -304,12 +307,12 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
      * @param values  the values to add to the collection at the key, null ignored
      * @return true if this map changed
      */
-    public boolean putAll(Object key, Collection values) {
+    public boolean putAll(K key, Collection<V> values) {
         if (values == null || values.size() == 0) {
             return false;
         }
         boolean result = false;
-        Collection coll = getCollection(key);
+        Collection<V> coll = getCollection(key);
         if (coll == null) {
             coll = createCollection(values.size());  // might produce a non-empty collection
             coll.addAll(values);
@@ -330,12 +333,11 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
      * @param key  the key to get an iterator for
      * @return the iterator of the collection at the key, empty iterator if key not in map
      */
-    public Iterator iterator(Object key) {
+    public Iterator<V> iterator(Object key) {
         if (!containsKey(key)) {
-            return EmptyIterator.INSTANCE;
-        } else {
-            return new ValuesIterator(key);
+            return EmptyIterator.<V>getInstance();
         }
+        return new ValuesIterator(key);
     }
 
     /**
@@ -345,10 +347,8 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
      */
     public int totalSize() {
         int total = 0;
-        Collection values = decorated().values();
-        for (Iterator it = values.iterator(); it.hasNext();) {
-            Collection coll = (Collection) it.next();
-            total += coll.size();
+        for (Object v : decorated().values()) {
+            total += CollectionUtils.size(v);
         }
         return total;
     }
@@ -363,18 +363,18 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
      * @param size  the collection size that is about to be added
      * @return the new collection
      */
-    protected Collection createCollection(int size) {
-        return (Collection) collectionFactory.create();
+    protected Collection<V> createCollection(int size) {
+        return collectionFactory.create();
     }
 
     //-----------------------------------------------------------------------
     /**
      * Inner class that provides the values view.
      */
-    private class Values extends AbstractCollection {
-        public Iterator iterator() {
-            final IteratorChain chain = new IteratorChain();
-            for (Iterator it = keySet().iterator(); it.hasNext();) {
+    private class Values extends AbstractCollection<V> {
+        public Iterator<V> iterator() {
+            final IteratorChain<V> chain = new IteratorChain<V>();
+            for (Iterator<K> it = keySet().iterator(); it.hasNext();) {
                 chain.addIterator(new ValuesIterator(it.next()));
             }
             return chain;
@@ -392,10 +392,10 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
     /**
      * Inner class that provides the values iterator.
      */
-    private class ValuesIterator implements Iterator {
+    private class ValuesIterator implements Iterator<V> {
         private final Object key;
-        private final Collection values;
-        private final Iterator iterator;
+        private final Collection<V> values;
+        private final Iterator<V> iterator;
 
         public ValuesIterator(Object key) {
             this.key = key;
@@ -414,7 +414,7 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
             return iterator.hasNext();
         }
 
-        public Object next() {
+        public V next() {
             return iterator.next();
         }
     }
@@ -422,14 +422,14 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
     /**
      * Inner class that provides a simple reflection factory.
      */
-    private static class ReflectionFactory implements Factory {
-        private final Class clazz;
+    private static class ReflectionFactory<T extends Collection<?>> implements Factory<T> {
+        private final Class<T> clazz;
 
-        public ReflectionFactory(Class clazz) {
+        public ReflectionFactory(Class<T> clazz) {
             this.clazz = clazz;
         }
 
-        public Object create() {
+        public T create() {
             try {
                 return clazz.newInstance();
             } catch (Exception ex) {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/PredicatedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/PredicatedMap.java b/src/java/org/apache/commons/collections/map/PredicatedMap.java
index b334157..537fe35 100644
--- a/src/java/org/apache/commons/collections/map/PredicatedMap.java
+++ b/src/java/org/apache/commons/collections/map/PredicatedMap.java
@@ -50,17 +50,18 @@ import org.apache.commons.collections.Predicate;
  * @author Stephen Colebourne
  * @author Paul Jack
  */
-public class PredicatedMap
-        extends AbstractInputCheckedMapDecorator
+public class PredicatedMap<K, V>
+        extends AbstractInputCheckedMapDecorator<K, V>
         implements Serializable {
 
     /** Serialization version */
     private static final long serialVersionUID = 7412622456128415156L;
 
     /** The key predicate to use */
-    protected final Predicate keyPredicate;
+    protected final Predicate<? super K> keyPredicate;
+
     /** The value predicate to use */
-    protected final Predicate valuePredicate;
+    protected final Predicate<? super V> valuePredicate;
 
     /**
      * Factory method to create a predicated (validating) map.
@@ -73,8 +74,8 @@ public class PredicatedMap
      * @param valuePredicate  the predicate to validate to values, null means no check
      * @throws IllegalArgumentException if the map is null
      */
-    public static Map decorate(Map map, Predicate keyPredicate, Predicate valuePredicate) {
-        return new PredicatedMap(map, keyPredicate, valuePredicate);
+    public static <K, V> Map<K, V> decorate(Map<K, V> map, Predicate<? super K> keyPredicate, Predicate<? super V> valuePredicate) {
+        return new PredicatedMap<K, V>(map, keyPredicate, valuePredicate);
     }
 
     //-----------------------------------------------------------------------
@@ -86,17 +87,15 @@ public class PredicatedMap
      * @param valuePredicate  the predicate to validate to values, null means no check
      * @throws IllegalArgumentException if the map is null
      */
-    protected PredicatedMap(Map map, Predicate keyPredicate, Predicate valuePredicate) {
+    protected PredicatedMap(Map<K, V> map, Predicate<? super K> keyPredicate, Predicate<? super V> valuePredicate) {
         super(map);
         this.keyPredicate = keyPredicate;
         this.valuePredicate = valuePredicate;
         
-        Iterator it = map.entrySet().iterator();
+        Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
         while (it.hasNext()) {
-            Map.Entry entry = (Map.Entry) it.next();
-            Object key = entry.getKey();
-            Object value = entry.getValue();
-            validate(key, value);
+            Map.Entry<K, V> entry = it.next();
+            validate(entry.getKey(), entry.getValue());
         }
     }
 
@@ -121,6 +120,7 @@ public class PredicatedMap
      * @throws ClassNotFoundException
      * @since Commons Collections 3.1
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
         map = (Map) in.readObject();
@@ -134,7 +134,7 @@ public class PredicatedMap
      * @param value  the value to validate
      * @throws IllegalArgumentException if invalid
      */
-    protected void validate(Object key, Object value) {
+    protected void validate(K key, V value) {
         if (keyPredicate != null && keyPredicate.evaluate(key) == false) {
             throw new IllegalArgumentException("Cannot add key - Predicate rejected it");
         }
@@ -150,7 +150,7 @@ public class PredicatedMap
      * @throws IllegalArgumentException if invalid
      * @since Commons Collections 3.1
      */
-    protected Object checkSetValue(Object value) {
+    protected V checkSetValue(V value) {
         if (valuePredicate.evaluate(value) == false) {
             throw new IllegalArgumentException("Cannot set value - Predicate rejected it");
         }
@@ -168,20 +168,16 @@ public class PredicatedMap
     }
 
     //-----------------------------------------------------------------------
-    public Object put(Object key, Object value) {
+    public V put(K key, V value) {
         validate(key, value);
         return map.put(key, value);
     }
 
-    public void putAll(Map mapToCopy) {
-        Iterator it = mapToCopy.entrySet().iterator();
-        while (it.hasNext()) {
-            Map.Entry entry = (Map.Entry) it.next();
-            Object key = entry.getKey();
-            Object value = entry.getValue();
-            validate(key, value);
+    public void putAll(Map<? extends K, ? extends V> mapToCopy) {
+        for (Map.Entry<? extends K, ? extends V> entry : mapToCopy.entrySet()) {
+            validate(entry.getKey(), entry.getValue());
         }
-        map.putAll(mapToCopy);
+        super.putAll(mapToCopy);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/PredicatedSortedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/PredicatedSortedMap.java b/src/java/org/apache/commons/collections/map/PredicatedSortedMap.java
index d1b39e3..63f75a3 100644
--- a/src/java/org/apache/commons/collections/map/PredicatedSortedMap.java
+++ b/src/java/org/apache/commons/collections/map/PredicatedSortedMap.java
@@ -46,9 +46,7 @@ import org.apache.commons.collections.Predicate;
  * @author Stephen Colebourne
  * @author Paul Jack
  */
-public class PredicatedSortedMap
-        extends PredicatedMap
-        implements SortedMap {
+public class PredicatedSortedMap<K, V> extends PredicatedMap<K, V> implements SortedMap<K, V> {
 
     /** Serialization version */
     private static final long serialVersionUID = 3359846175935304332L;
@@ -64,8 +62,9 @@ public class PredicatedSortedMap
      * @param valuePredicate  the predicate to validate to values, null means no check
      * @throws IllegalArgumentException if the map is null
      */
-    public static SortedMap decorate(SortedMap map, Predicate keyPredicate, Predicate valuePredicate) {
-        return new PredicatedSortedMap(map, keyPredicate, valuePredicate);
+    public static <K, V> SortedMap<K, V> decorate(SortedMap<K, V> map,
+            Predicate<? super K> keyPredicate, Predicate<? super V> valuePredicate) {
+        return new PredicatedSortedMap<K, V>(map, keyPredicate, valuePredicate);
     }
 
     //-----------------------------------------------------------------------
@@ -77,7 +76,8 @@ public class PredicatedSortedMap
      * @param valuePredicate  the predicate to validate to values, null means no check
      * @throws IllegalArgumentException if the map is null
      */
-    protected PredicatedSortedMap(SortedMap map, Predicate keyPredicate, Predicate valuePredicate) {
+    protected PredicatedSortedMap(SortedMap<K, V> map, Predicate<? super K> keyPredicate,
+            Predicate<? super V> valuePredicate) {
         super(map, keyPredicate, valuePredicate);
     }
 
@@ -87,36 +87,36 @@ public class PredicatedSortedMap
      * 
      * @return the decorated map
      */
-    protected SortedMap getSortedMap() {
-        return (SortedMap) map;
+    protected SortedMap<K, V> getSortedMap() {
+        return (SortedMap<K, V>) map;
     }
 
     //-----------------------------------------------------------------------
-    public Object firstKey() {
+    public K firstKey() {
         return getSortedMap().firstKey();
     }
 
-    public Object lastKey() {
+    public K lastKey() {
         return getSortedMap().lastKey();
     }
 
-    public Comparator comparator() {
+    public Comparator<? super K> comparator() {
         return getSortedMap().comparator();
     }
 
-    public SortedMap subMap(Object fromKey, Object toKey) {
-        SortedMap map = getSortedMap().subMap(fromKey, toKey);
-        return new PredicatedSortedMap(map, keyPredicate, valuePredicate);
+    public SortedMap<K, V> subMap(K fromKey, K toKey) {
+        SortedMap<K, V> map = getSortedMap().subMap(fromKey, toKey);
+        return new PredicatedSortedMap<K, V>(map, keyPredicate, valuePredicate);
     }
 
-    public SortedMap headMap(Object toKey) {
-        SortedMap map = getSortedMap().headMap(toKey);
-        return new PredicatedSortedMap(map, keyPredicate, valuePredicate);
+    public SortedMap<K, V> headMap(K toKey) {
+        SortedMap<K, V> map = getSortedMap().headMap(toKey);
+        return new PredicatedSortedMap<K, V>(map, keyPredicate, valuePredicate);
     }
 
-    public SortedMap tailMap(Object fromKey) {
-        SortedMap map = getSortedMap().tailMap(fromKey);
-        return new PredicatedSortedMap(map, keyPredicate, valuePredicate);
+    public SortedMap<K, V> tailMap(K fromKey) {
+        SortedMap<K, V> map = getSortedMap().tailMap(fromKey);
+        return new PredicatedSortedMap<K, V>(map, keyPredicate, valuePredicate);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/ReferenceIdentityMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/ReferenceIdentityMap.java b/src/java/org/apache/commons/collections/map/ReferenceIdentityMap.java
index 39fba2b..7a6ac47 100644
--- a/src/java/org/apache/commons/collections/map/ReferenceIdentityMap.java
+++ b/src/java/org/apache/commons/collections/map/ReferenceIdentityMap.java
@@ -70,7 +70,7 @@ import java.lang.ref.Reference;
  * 
  * @author Stephen Colebourne
  */
-public class ReferenceIdentityMap extends AbstractReferenceMap implements Serializable {
+public class ReferenceIdentityMap<K, V> extends AbstractReferenceMap<K, V> implements Serializable {
 
     /** Serialization version */
     private static final long serialVersionUID = -1266190134568365852L;
@@ -80,7 +80,8 @@ public class ReferenceIdentityMap extends AbstractReferenceMap implements Serial
      * use hard references to keys and soft references to values.
      */
     public ReferenceIdentityMap() {
-        super(HARD, SOFT, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, false);
+        super(ReferenceStrength.HARD, ReferenceStrength.SOFT, DEFAULT_CAPACITY,
+                DEFAULT_LOAD_FACTOR, false);
     }
 
     /**
@@ -92,7 +93,7 @@ public class ReferenceIdentityMap extends AbstractReferenceMap implements Serial
      * @param valueType  the type of reference to use for values;
      *   must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
      */
-    public ReferenceIdentityMap(int keyType, int valueType) {
+    public ReferenceIdentityMap(ReferenceStrength keyType, ReferenceStrength valueType) {
         super(keyType, valueType, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, false);
     }
 
@@ -107,7 +108,8 @@ public class ReferenceIdentityMap extends AbstractReferenceMap implements Serial
      * @param purgeValues should the value be automatically purged when the 
      *   key is garbage collected 
      */
-    public ReferenceIdentityMap(int keyType, int valueType, boolean purgeValues) {
+    public ReferenceIdentityMap(ReferenceStrength keyType, ReferenceStrength valueType,
+            boolean purgeValues) {
         super(keyType, valueType, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, purgeValues);
     }
 
@@ -122,7 +124,8 @@ public class ReferenceIdentityMap extends AbstractReferenceMap implements Serial
      * @param capacity  the initial capacity for the map
      * @param loadFactor  the load factor for the map
      */
-    public ReferenceIdentityMap(int keyType, int valueType, int capacity, float loadFactor) {
+    public ReferenceIdentityMap(ReferenceStrength keyType, ReferenceStrength valueType,
+            int capacity, float loadFactor) {
         super(keyType, valueType, capacity, loadFactor, false);
     }
 
@@ -139,8 +142,8 @@ public class ReferenceIdentityMap extends AbstractReferenceMap implements Serial
      * @param purgeValues  should the value be automatically purged when the 
      *   key is garbage collected 
      */
-    public ReferenceIdentityMap(int keyType, int valueType, int capacity,
-                        float loadFactor, boolean purgeValues) {
+    public ReferenceIdentityMap(ReferenceStrength keyType, ReferenceStrength valueType,
+            int capacity, float loadFactor, boolean purgeValues) {
         super(keyType, valueType, capacity, loadFactor, purgeValues);
     }
 
@@ -182,8 +185,8 @@ public class ReferenceIdentityMap extends AbstractReferenceMap implements Serial
      * @return true if equal by identity
      */
     protected boolean isEqualKey(Object key1, Object key2) {
-        key2 = (keyType > HARD ? ((Reference) key2).get() : key2);
-        return (key1 == key2);
+        key2 = keyType == ReferenceStrength.HARD ? key2 : ((Reference<?>) key2).get();
+        return key1 == key2;
     }
 
     /**
@@ -196,7 +199,7 @@ public class ReferenceIdentityMap extends AbstractReferenceMap implements Serial
      * @return true if equal by identity
      */
     protected boolean isEqualValue(Object value1, Object value2) {
-        return (value1 == value2);
+        return value1 == value2;
     }
 
     //-----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/ReferenceMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/ReferenceMap.java b/src/java/org/apache/commons/collections/map/ReferenceMap.java
index 5685711..861db7f 100644
--- a/src/java/org/apache/commons/collections/map/ReferenceMap.java
+++ b/src/java/org/apache/commons/collections/map/ReferenceMap.java
@@ -73,7 +73,7 @@ import java.io.Serializable;
  * @author Paul Jack
  * @author Stephen Colebourne
  */
-public class ReferenceMap extends AbstractReferenceMap implements Serializable {
+public class ReferenceMap<K, V> extends AbstractReferenceMap<K, V> implements Serializable {
 
     /** Serialization version */
     private static final long serialVersionUID = 1555089888138299607L;
@@ -83,7 +83,8 @@ public class ReferenceMap extends AbstractReferenceMap implements Serializable {
      * use hard references to keys and soft references to values.
      */
     public ReferenceMap() {
-        super(HARD, SOFT, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, false);
+        super(ReferenceStrength.HARD, ReferenceStrength.SOFT, DEFAULT_CAPACITY,
+                DEFAULT_LOAD_FACTOR, false);
     }
 
     /**
@@ -95,7 +96,7 @@ public class ReferenceMap extends AbstractReferenceMap implements Serializable {
      * @param valueType  the type of reference to use for values;
      *   must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
      */
-    public ReferenceMap(int keyType, int valueType) {
+    public ReferenceMap(ReferenceStrength keyType, ReferenceStrength valueType) {
         super(keyType, valueType, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, false);
     }
 
@@ -110,7 +111,7 @@ public class ReferenceMap extends AbstractReferenceMap implements Serializable {
      * @param purgeValues should the value be automatically purged when the 
      *   key is garbage collected 
      */
-    public ReferenceMap(int keyType, int valueType, boolean purgeValues) {
+    public ReferenceMap(ReferenceStrength keyType, ReferenceStrength valueType, boolean purgeValues) {
         super(keyType, valueType, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, purgeValues);
     }
 
@@ -126,7 +127,8 @@ public class ReferenceMap extends AbstractReferenceMap implements Serializable {
      * @param capacity  the initial capacity for the map
      * @param loadFactor  the load factor for the map
      */
-    public ReferenceMap(int keyType, int valueType, int capacity, float loadFactor) {
+    public ReferenceMap(ReferenceStrength keyType, ReferenceStrength valueType, int capacity,
+            float loadFactor) {
         super(keyType, valueType, capacity, loadFactor, false);
     }
 
@@ -144,8 +146,8 @@ public class ReferenceMap extends AbstractReferenceMap implements Serializable {
      * @param purgeValues  should the value be automatically purged when the 
      *   key is garbage collected 
      */
-    public ReferenceMap(int keyType, int valueType, int capacity,
-                        float loadFactor, boolean purgeValues) {
+    public ReferenceMap(ReferenceStrength keyType, ReferenceStrength valueType, int capacity,
+            float loadFactor, boolean purgeValues) {
         super(keyType, valueType, capacity, loadFactor, purgeValues);
     }
 


[10/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
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();


[66/77] [abbrv] commons-collections git commit: Some minor Javadoc fixes

Posted by ch...@apache.org.
Some minor Javadoc fixes

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@814050 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/06cccbce
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/06cccbce
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/06cccbce

Branch: refs/heads/collections_jdk5_branch
Commit: 06cccbce5fd72dbea8f69cd1d49b2d55652bbccf
Parents: 8c2bb85
Author: Sebastian Bazley <se...@apache.org>
Authored: Fri Sep 11 22:01:25 2009 +0000
Committer: Sebastian Bazley <se...@apache.org>
Committed: Fri Sep 11 22:01:25 2009 +0000

----------------------------------------------------------------------
 src/java/org/apache/commons/collections/CollectionUtils.java    | 2 --
 src/java/org/apache/commons/collections/IndexedCollection.java  | 5 ++---
 src/java/org/apache/commons/collections/PredicateUtils.java     | 2 +-
 .../org/apache/commons/collections/buffer/BlockingBuffer.java   | 2 +-
 .../collections/splitmap/AbstractIterableGetMapDecorator.java   | 3 ---
 .../org/apache/commons/collections/keyvalue/TestMultiKey.java   | 2 +-
 6 files changed, 5 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/06cccbce/src/java/org/apache/commons/collections/CollectionUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/CollectionUtils.java b/src/java/org/apache/commons/collections/CollectionUtils.java
index 3da722b..4d26462 100644
--- a/src/java/org/apache/commons/collections/CollectionUtils.java
+++ b/src/java/org/apache/commons/collections/CollectionUtils.java
@@ -284,8 +284,6 @@ public class CollectionUtils {
      * @param coll
      *            the collection to get the cardinality map for, must not be
      *            null
-     * @param <I>
-     *            the type of object in the input {@link Collection}
      * @param <O>
      *            the type of object in the returned {@link Map}. This is a
      *            super type of <I>.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/06cccbce/src/java/org/apache/commons/collections/IndexedCollection.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/IndexedCollection.java b/src/java/org/apache/commons/collections/IndexedCollection.java
index 0b8b2f7..ba55aa9 100644
--- a/src/java/org/apache/commons/collections/IndexedCollection.java
+++ b/src/java/org/apache/commons/collections/IndexedCollection.java
@@ -17,8 +17,8 @@ import org.apache.commons.collections.collection.AbstractCollectionDecorator;
  * call to {@link #reindex()} will update the index to the current contents of
  * the {@link Collection}.
  *
- * @param K the type of object in the index.
- * @param C the type of object in the collection.
+ * @param <K> the type of object in the index.
+ * @param <C> the type of object in the collection.
  * @author Stephen Kestle
  */
 // TODO support MultiMap/non-unique index behavior
@@ -57,7 +57,6 @@ public class IndexedCollection<K, C> extends AbstractCollectionDecorator<C> {
      *
      * @param coll the decorated {@link Collection}.
      * @param keyTransformer the {@link Transformer} for generating index keys.
-     * @return the created {@link IndexedCollection}.
      */
     public IndexedCollection(Collection<C> coll, Transformer<C, K> keyTransformer, HashMap<K, C> map) {
         super(coll);

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/06cccbce/src/java/org/apache/commons/collections/PredicateUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/PredicateUtils.java b/src/java/org/apache/commons/collections/PredicateUtils.java
index d5185f9..8ec4a6f 100644
--- a/src/java/org/apache/commons/collections/PredicateUtils.java
+++ b/src/java/org/apache/commons/collections/PredicateUtils.java
@@ -280,7 +280,7 @@ public class PredicateUtils {
      * @return the <code>all</code> predicate
      * @throws IllegalArgumentException if the predicates array is null
      * @throws IllegalArgumentException if any predicate in the array is null
-     * @deprecated use {@link AllPredicate#allPredicate(Predicate...)))} instead.
+     * @deprecated use {@link AllPredicate#allPredicate(Predicate...)} instead.
      */
     @Deprecated
     public static <T> Predicate<T> allPredicate(Predicate<? super T>[] predicates) {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/06cccbce/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java b/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java
index 798c821..362ef6a 100644
--- a/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java
+++ b/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java
@@ -59,7 +59,7 @@ public class BlockingBuffer<E> extends SynchronizedBuffer<E> {
     /**
      * Factory method to create a blocking buffer.
      *
-     * @param <t> the type of the elements in the buffer
+     * @param <T> the type of the elements in the buffer
      * @param buffer the buffer to decorate, must not be null
      * @return a new blocking Buffer
      * @throws IllegalArgumentException if buffer is null

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/06cccbce/src/java/org/apache/commons/collections/splitmap/AbstractIterableGetMapDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/splitmap/AbstractIterableGetMapDecorator.java b/src/java/org/apache/commons/collections/splitmap/AbstractIterableGetMapDecorator.java
index d11e4c7..2b06bfd 100644
--- a/src/java/org/apache/commons/collections/splitmap/AbstractIterableGetMapDecorator.java
+++ b/src/java/org/apache/commons/collections/splitmap/AbstractIterableGetMapDecorator.java
@@ -56,9 +56,6 @@ public class AbstractIterableGetMapDecorator<K, V> implements IterableGet<K, V>
         return map;
     }
 
-    /**
-     * {@inheritDoc}
-     */
     public void clear() {
         decorated().clear();
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/06cccbce/src/test/org/apache/commons/collections/keyvalue/TestMultiKey.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/keyvalue/TestMultiKey.java b/src/test/org/apache/commons/collections/keyvalue/TestMultiKey.java
index 6202632..8b3ffb8 100644
--- a/src/test/org/apache/commons/collections/keyvalue/TestMultiKey.java
+++ b/src/test/org/apache/commons/collections/keyvalue/TestMultiKey.java
@@ -24,7 +24,7 @@ import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
 /**
- * Unit tests for {@link org.apache.commons.collections.MultiKey}.
+ * Unit tests for {@link org.apache.commons.collections.keyvalue.MultiKey}.
  *
  * @version $Revision$ $Date$
  *


[12/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/collection/AbstractTestCollection.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/collection/AbstractTestCollection.java b/src/test/org/apache/commons/collections/collection/AbstractTestCollection.java
index 7a80598..5bc83c9 100644
--- a/src/test/org/apache/commons/collections/collection/AbstractTestCollection.java
+++ b/src/test/org/apache/commons/collections/collection/AbstractTestCollection.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.
@@ -40,8 +40,8 @@ import org.apache.commons.collections.AbstractTestObject;
  * Abstract test class for {@link java.util.Collection} methods and contracts.
  * <p>
  * You should create a concrete subclass of this class to test any custom
- * {@link Collection} implementation.  At minimum, you'll have to 
- * implement the {@link #makeCollection()} method.  You might want to 
+ * {@link Collection} implementation.  At minimum, you'll have to
+ * implement the {@link #makeCollection()} method.  You might want to
  * override some of the additional public methods as well:
  * <p>
  * <b>Element Population Methods</b>
@@ -81,7 +81,7 @@ import org.apache.commons.collections.AbstractTestObject;
  * <p>
  * The {@link #collection} field holds an instance of your collection
  * implementation; the {@link #confirmed} field holds an instance of the
- * confirmed collection implementation.  The {@link #resetEmpty()} and 
+ * confirmed collection implementation.  The {@link #resetEmpty()} and
  * {@link #resetFull()} methods set these fields to empty or full collections,
  * so that tests can proceed from a known state.
  * <p>
@@ -92,14 +92,14 @@ import org.apache.commons.collections.AbstractTestObject;
  * views of a map, {@link AbstractTestMap} would override {@link #verify()} to make
  * sure the map is changed after the collection view is changed.
  * <p>
- * If you're extending this class directly, you will have to provide 
+ * If you're extending this class directly, you will have to provide
  * implementations for the following:
  * <ul>
  * <li>{@link #makeConfirmedCollection()}
  * <li>{@link #makeConfirmedFullCollection()}
  * </ul>
  * <p>
- * Those methods should provide a confirmed collection implementation 
+ * Those methods should provide a confirmed collection implementation
  * that's compatible with your collection implementation.
  * <p>
  * If you're extending {@link AbstractTestList}, {@link AbstractTestSet},
@@ -114,17 +114,17 @@ import org.apache.commons.collections.AbstractTestObject;
  * test case (method) your {@link Collection} fails.
  *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Rodney Waldhoff
  * @author Paul Jack
  * @author Michael A. Smith
  * @author Neil O'Toole
  * @author Stephen Colebourne
  */
-public abstract class AbstractTestCollection<T> extends AbstractTestObject {
+public abstract class AbstractTestCollection<E> extends AbstractTestObject {
 
     //
-    // NOTE: 
+    // NOTE:
     //
     // Collection doesn't define any semantics for equals, and recommends you
     // use reference-based default behavior of Object.equals.  (And a test for
@@ -133,28 +133,27 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
     // tests on Collection.equals nor any for Collection.hashCode.
     //
 
-
     // These fields are used by reset() and verify(), and any test
     // method that tests a modification.
 
-    /** 
+    /**
      *  A collection instance that will be used for testing.
      */
-    public Collection<T> collection;
+    private Collection<E> collection;
 
-    /** 
+    /**
      *  Confirmed collection.  This is an instance of a collection that is
      *  confirmed to conform exactly to the java.util.Collection contract.
-     *  Modification operations are tested by performing a mod on your 
+     *  Modification operations are tested by performing a mod on your
      *  collection, performing the exact same mod on an equivalent confirmed
      *  collection, and then calling verify() to make sure your collection
      *  still matches the confirmed collection.
      */
-    public Collection<T> confirmed;
+    private Collection<E> confirmed;
 
     /**
      * JUnit constructor.
-     * 
+     *
      * @param testName  the test class name
      */
     public AbstractTestCollection(String testName) {
@@ -167,7 +166,7 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
      *  distinguishable with information not readily available.  That is, if a
      *  particular value is to be removed from the collection, then there is
      *  one and only one value that can be removed, even if there are other
-     *  elements which are equal to it.  
+     *  elements which are equal to it.
      *
      *  <P>In most collection cases, elements are not distinguishable (equal is
      *  equal), thus this method defaults to return false.  In some cases,
@@ -189,7 +188,7 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
     }
 
     /**
-     *  Returns true if the collections produced by 
+     *  Returns true if the collections produced by
      *  {@link #makeCollection()} and {@link #makeFullCollection()}
      *  support the <code>add</code> and <code>addAll</code>
      *  operations.<P>
@@ -201,7 +200,7 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
     }
 
     /**
-     *  Returns true if the collections produced by 
+     *  Returns true if the collections produced by
      *  {@link #makeCollection()} and {@link #makeFullCollection()}
      *  support the <code>remove</code>, <code>removeAll</code>,
      *  <code>retainAll</code>, <code>clear</code> and
@@ -239,16 +238,15 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
 
     //-----------------------------------------------------------------------
     /**
-     *  Verifies that {@link #collection} and {@link #confirmed} have 
+     *  Verifies that {@link #collection} and {@link #confirmed} have
      *  identical state.
      */
     public void verify() {
-        int confirmedSize = confirmed.size();
-        assertEquals("Collection size should match confirmed collection's",
-                     confirmedSize, collection.size());
-        assertEquals("Collection isEmpty() result should match confirmed " +
-                     " collection's", 
-                     confirmed.isEmpty(), collection.isEmpty());
+        int confirmedSize = getConfirmed().size();
+        assertEquals("Collection size should match confirmed collection's", confirmedSize,
+                getCollection().size());
+        assertEquals("Collection isEmpty() result should match confirmed collection's",
+                getConfirmed().isEmpty(), getCollection().isEmpty());
 
         // verify the collections are the same by attempting to match each
         // object in the collection and confirmed collection.  To account for
@@ -262,31 +260,30 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
         // copy each collection value into an array
         Object[] confirmedValues = new Object[confirmedSize];
 
-        Iterator<T> iter;
+        Iterator<E> iter;
 
-        iter = confirmed.iterator(); 
+        iter = getConfirmed().iterator();
         int pos = 0;
-        while(iter.hasNext()) {
+        while (iter.hasNext()) {
             confirmedValues[pos++] = iter.next();
         }
 
         // allocate an array of boolean flags for tracking values that have
         // been matched once and only once.
         boolean[] matched = new boolean[confirmedSize];
-        
+
         // now iterate through the values of the collection and try to match
         // the value with one in the confirmed array.
-        iter = collection.iterator();
-        while(iter.hasNext()) {
+        iter = getCollection().iterator();
+        while (iter.hasNext()) {
             Object o = iter.next();
             boolean match = false;
-            for(int i = 0; i < confirmedSize; i++) {
-                if(matched[i]) {
+            for (int i = 0; i < confirmedSize; i++) {
+                if (matched[i]) {
                     // skip values already matched
                     continue;
                 }
-                if(o == confirmedValues[i] ||
-                   (o != null && o.equals(confirmedValues[i]))) {
+                if (o == confirmedValues[i] || (o != null && o.equals(confirmedValues[i]))) {
                     // values matched
                     matched[i] = true;
                     match = true;
@@ -294,23 +291,23 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
                 }
             }
             // no match found!
-            if(!match) {
-                fail("Collection should not contain a value that the " +
-                     "confirmed collection does not have: " + o +
-                     "\nTest: " + collection + "\nReal: " + confirmed);
+            if (!match) {
+                fail("Collection should not contain a value that the "
+                        + "confirmed collection does not have: " + o + "\nTest: " + getCollection()
+                        + "\nReal: " + getConfirmed());
             }
         }
-        
+
         // make sure there aren't any unmatched values
-        for(int i = 0; i < confirmedSize; i++) {
-            if(!matched[i]) {
+        for (int i = 0; i < confirmedSize; i++) {
+            if (!matched[i]) {
                 // the collection didn't match all the confirmed values
-                fail("Collection should contain all values that are in the confirmed collection" +
-                     "\nTest: " + collection + "\nReal: " + confirmed);
+                fail("Collection should contain all values that are in the confirmed collection"
+                        + "\nTest: " + getCollection() + "\nReal: " + getConfirmed());
             }
         }
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      *  Resets the {@link #collection} and {@link #confirmed} fields to empty
@@ -318,8 +315,8 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
      *  test.
      */
     public void resetEmpty() {
-        this.collection = makeCollection();
-        this.confirmed = makeConfirmedCollection();
+        this.setCollection(makeObject());
+        this.setConfirmed(makeConfirmedCollection());
     }
 
     /**
@@ -328,8 +325,8 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
      *  test.
      */
     public void resetFull() {
-        this.collection = makeFullCollection();
-        this.confirmed = makeConfirmedFullCollection();
+        this.setCollection(makeFullCollection());
+        this.setConfirmed(makeConfirmedFullCollection());
     }
 
     //-----------------------------------------------------------------------
@@ -340,7 +337,7 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
      *
      *  @return a confirmed empty collection
      */
-    public abstract Collection<T> makeConfirmedCollection();
+    public abstract Collection<E> makeConfirmedCollection();
 
     /**
      *  Returns a confirmed full collection.
@@ -350,12 +347,12 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
      *
      *  @return a confirmed full collection
      */
-    public abstract Collection<T> makeConfirmedFullCollection();
+    public abstract Collection<E> makeConfirmedFullCollection();
 
     /**
      * Return a new, empty {@link Collection} to be used for testing.
      */
-    public abstract Collection<T> makeCollection();
+    public abstract Collection<E> makeObject();
 
     /**
      *  Returns a full collection to be used for testing.  The collection
@@ -365,24 +362,17 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
      *  the results of {@link #getFullElements()}.  Override this default
      *  if your collection doesn't support addAll.
      */
-    public Collection<T> makeFullCollection() {
-        Collection<T> c = makeCollection();
+    public Collection<E> makeFullCollection() {
+        Collection<E> c = makeObject();
         c.addAll(Arrays.asList(getFullElements()));
         return c;
     }
 
     /**
-     *  Returns an empty collection for Object tests.
-     */
-    public Object makeObject() {
-        return makeCollection();
-    }
-
-    /**
      * Creates a new Map Entry that is independent of the first and the map.
      */
-    public Map.Entry<T, T> cloneMapEntry(Map.Entry<T, T> entry) {
-        HashMap<T, T> map = new HashMap<T, T>();
+    public Map.Entry<E, E> cloneMapEntry(Map.Entry<E, E> entry) {
+        HashMap<E, E> map = new HashMap<E, E>();
         map.put(entry.getKey(), entry.getValue());
         return map.entrySet().iterator().next();
     }
@@ -392,47 +382,48 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
      *  Returns an array of objects that are contained in a collection
      *  produced by {@link #makeFullCollection()}.  Every element in the
      *  returned array <I>must</I> be an element in a full collection.<P>
-     *  The default implementation returns a heterogenous array of 
+     *  The default implementation returns a heterogenous array of
      *  objects with some duplicates. null is added if allowed.
      *  Override if you require specific testing elements.  Note that if you
      *  override {@link #makeFullCollection()}, you <I>must</I> override
      *  this method to reflect the contents of a full collection.
      */
-    public T[] getFullElements() {
+    @SuppressWarnings("unchecked")
+    public E[] getFullElements() {
         if (isNullSupported()) {
-            ArrayList<T> list = new ArrayList<T>();
+            ArrayList<E> list = new ArrayList<E>();
             list.addAll(Arrays.asList(getFullNonNullElements()));
             list.add(4, null);
-            return (T[]) list.toArray();
-        } else {
-            return getFullNonNullElements().clone();
+            return (E[]) list.toArray();
         }
+        return getFullNonNullElements().clone();
     }
 
     /**
      *  Returns an array of elements that are <I>not</I> contained in a
-     *  full collection.  Every element in the returned array must 
+     *  full collection.  Every element in the returned array must
      *  not exist in a collection returned by {@link #makeFullCollection()}.
      *  The default implementation returns a heterogenous array of elements
      *  without null.  Note that some of the tests add these elements
      *  to an empty or full collection, so if your collection restricts
      *  certain kinds of elements, you should override this method.
      */
-    public T[] getOtherElements() {
+    public E[] getOtherElements() {
         return getOtherNonNullElements();
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      *  Returns a list of elements suitable for return by
      *  {@link #getFullElements()}.  The array returned by this method
-     *  does not include null, but does include a variety of objects 
+     *  does not include null, but does include a variety of objects
      *  of different types.  Override getFullElements to return
      *  the results of this method if your collection does not support
      *  the null element.
      */
-    public T[] getFullNonNullElements() {
-        return (T[]) new Object[] {
+    @SuppressWarnings("unchecked")
+    public E[] getFullNonNullElements() {
+        return (E[]) new Object[] {
             new String(""),
             new String("One"),
             new Integer(2),
@@ -455,12 +446,13 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
     }
 
     /**
-     *  Returns the default list of objects returned by 
+     *  Returns the default list of objects returned by
      *  {@link #getOtherElements()}.  Includes many objects
      *  of different types.
      */
-    public T[] getOtherNonNullElements() {
-        return (T[]) new Object[] {
+    @SuppressWarnings("unchecked")
+    public E[] getOtherNonNullElements() {
+        return (E[]) new Object[] {
             new Integer(0),
             new Float(0),
             new Double(0),
@@ -481,8 +473,8 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
      */
     public Object[] getFullNonNullStringElements() {
         return new Object[] {
-            "If","the","dull","substance","of","my","flesh","were","thought",
-            "Injurious","distance","could","not","stop","my","way",
+            "If", "the", "dull", "substance", "of", "my", "flesh", "were",
+                "thought", "Injurious", "distance", "could", "not", "stop", "my", "way",
         };
     }
 
@@ -494,44 +486,41 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
      */
     public Object[] getOtherNonNullStringElements() {
         return new Object[] {
-            "For","then","despite",/* of */"space","I","would","be","brought",
-            "From","limits","far","remote","where","thou","dost","stay"
+            "For", "then", "despite",/* of */"space", "I", "would", "be",
+                "brought", "From", "limits", "far", "remote", "where", "thou", "dost", "stay"
         };
     }
 
-    // Tests    
+    // Tests
     //-----------------------------------------------------------------------
     /**
      *  Tests {@link Collection#add(Object)}.
      */
     public void testCollectionAdd() {
         if (!isAddSupported()) return;
-        
-        T[] elements = getFullElements();
+
+        E[] elements = getFullElements();
         for (int i = 0; i < elements.length; i++) {
             resetEmpty();
-            boolean r = collection.add(elements[i]);
-            confirmed.add(elements[i]);
+            boolean r = getCollection().add(elements[i]);
+            getConfirmed().add(elements[i]);
             verify();
             assertTrue("Empty collection changed after add", r);
-            assertEquals("Collection size is 1 after first add", 1, collection.size());
+            assertEquals("Collection size is 1 after first add", 1, getCollection().size());
         }
-        
+
         resetEmpty();
         int size = 0;
         for (int i = 0; i < elements.length; i++) {
-            boolean r = collection.add(elements[i]);
-            confirmed.add(elements[i]);
+            boolean r = getCollection().add(elements[i]);
+            getConfirmed().add(elements[i]);
             verify();
             if (r) size++;
-            assertEquals("Collection size should grow after add", 
-                         size, collection.size());
-            assertTrue("Collection should contain added element",
-                       collection.contains(elements[i]));
+            assertEquals("Collection size should grow after add", size, getCollection().size());
+            assertTrue("Collection should contain added element", getCollection().contains(elements[i]));
         }
     }
-    
-    
+
     /**
      *  Tests {@link Collection#addAll(Collection)}.
      */
@@ -539,56 +528,51 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
         if (!isAddSupported()) return;
 
         resetEmpty();
-        T[] elements = getFullElements();
-        boolean r = collection.addAll(Arrays.asList(elements));
-        confirmed.addAll(Arrays.asList(elements));
+        E[] elements = getFullElements();
+        boolean r = getCollection().addAll(Arrays.asList(elements));
+        getConfirmed().addAll(Arrays.asList(elements));
         verify();
         assertTrue("Empty collection should change after addAll", r);
         for (int i = 0; i < elements.length; i++) {
-            assertTrue("Collection should contain added element",
-                       collection.contains(elements[i]));
+            assertTrue("Collection should contain added element", getCollection().contains(elements[i]));
         }
 
         resetFull();
-        int size = collection.size();
+        int size = getCollection().size();
         elements = getOtherElements();
-        r = collection.addAll(Arrays.asList(elements));
-        confirmed.addAll(Arrays.asList(elements));
+        r = getCollection().addAll(Arrays.asList(elements));
+        getConfirmed().addAll(Arrays.asList(elements));
         verify();
         assertTrue("Full collection should change after addAll", r);
         for (int i = 0; i < elements.length; i++) {
             assertTrue("Full collection should contain added element",
-                       collection.contains(elements[i]));
+                    getCollection().contains(elements[i]));
         }
-        assertEquals("Size should increase after addAll", 
-                     size + elements.length, collection.size());
-        
+        assertEquals("Size should increase after addAll", size + elements.length, getCollection().size());
+
         resetFull();
-        size = collection.size();
-        r = collection.addAll(Arrays.asList(getFullElements()));
-        confirmed.addAll(Arrays.asList(getFullElements()));
+        size = getCollection().size();
+        r = getCollection().addAll(Arrays.asList(getFullElements()));
+        getConfirmed().addAll(Arrays.asList(getFullElements()));
         verify();
         if (r) {
-            assertTrue("Size should increase if addAll returns true", 
-                       size < collection.size());
+            assertTrue("Size should increase if addAll returns true", size < getCollection().size());
         } else {
-            assertEquals("Size should not change if addAll returns false",
-                         size, collection.size());
-        } 
+            assertEquals("Size should not change if addAll returns false", size, getCollection().size());
+        }
     }
 
-
     /**
      *  If {@link #isAddSupported()} returns false, tests that add operations
      *  raise <code>UnsupportedOperationException.
      */
     public void testUnsupportedAdd() {
         if (isAddSupported()) return;
-        
+
         resetEmpty();
         try {
-            collection.add(getFullNonNullElements()[0]);
-            fail("Emtpy collection should not support add.");
+            getCollection().add(getFullNonNullElements()[0]);
+            fail("Empty collection should not support add.");
         } catch (UnsupportedOperationException e) {
             // expected
         }
@@ -597,8 +581,8 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
         verify();
 
         try {
-            collection.addAll(Arrays.asList(getFullElements()));
-            fail("Emtpy collection should not support addAll.");
+            getCollection().addAll(Arrays.asList(getFullElements()));
+            fail("Empty collection should not support addAll.");
         } catch (UnsupportedOperationException e) {
             // expected
         }
@@ -608,7 +592,7 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
 
         resetFull();
         try {
-            collection.add(getFullNonNullElements()[0]);
+            getCollection().add(getFullNonNullElements()[0]);
             fail("Full collection should not support add.");
         } catch (UnsupportedOperationException e) {
             // expected
@@ -616,9 +600,9 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
         // make sure things didn't change even if the expected exception was
         // thrown.
         verify();
-        
+
         try {
-            collection.addAll(Arrays.asList(getOtherElements()));
+            getCollection().addAll(Arrays.asList(getOtherElements()));
             fail("Full collection should not support addAll.");
         } catch (UnsupportedOperationException e) {
             // expected
@@ -628,7 +612,6 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
         verify();
     }
 
-
     /**
      *  Test {@link Collection#clear()}.
      */
@@ -636,16 +619,15 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
         if (!isRemoveSupported()) return;
 
         resetEmpty();
-        collection.clear(); // just to make sure it doesn't raise anything
+        getCollection().clear(); // just to make sure it doesn't raise anything
         verify();
 
         resetFull();
-        collection.clear();
-        confirmed.clear();
+        getCollection().clear();
+        getConfirmed().clear();
         verify();
-    }    
+    }
 
-    
     /**
      *  Tests {@link Collection#contains(Object)}.
      */
@@ -654,80 +636,78 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
 
         resetEmpty();
         elements = getFullElements();
-        for(int i = 0; i < elements.length; i++) {
+        for (int i = 0; i < elements.length; i++) {
             assertTrue("Empty collection shouldn't contain element[" + i + "]",
-                       !collection.contains(elements[i]));
+                    !getCollection().contains(elements[i]));
         }
         // make sure calls to "contains" don't change anything
         verify();
 
         elements = getOtherElements();
-        for(int i = 0; i < elements.length; i++) {
+        for (int i = 0; i < elements.length; i++) {
             assertTrue("Empty collection shouldn't contain element[" + i + "]",
-                       !collection.contains(elements[i]));
+                    !getCollection().contains(elements[i]));
         }
         // make sure calls to "contains" don't change anything
         verify();
 
         resetFull();
         elements = getFullElements();
-        for(int i = 0; i < elements.length; i++) {
-            assertTrue("Full collection should contain element[" + i + "]", 
-                       collection.contains(elements[i]));
+        for (int i = 0; i < elements.length; i++) {
+            assertTrue("Full collection should contain element[" + i + "]",
+                    getCollection().contains(elements[i]));
         }
         // make sure calls to "contains" don't change anything
         verify();
 
         resetFull();
         elements = getOtherElements();
-        for(int i = 0; i < elements.length; i++) {
-            assertTrue("Full collection shouldn't contain element", 
-                       !collection.contains(elements[i]));
+        for (int i = 0; i < elements.length; i++) {
+            assertTrue("Full collection shouldn't contain element",
+                    !getCollection().contains(elements[i]));
         }
     }
 
-
     /**
      *  Tests {@link Collection#containsAll(Collection)}.
      */
     public void testCollectionContainsAll() {
         resetEmpty();
-        Collection<T> col = new HashSet<T>();
+        Collection<E> col = new HashSet<E>();
         assertTrue("Every Collection should contain all elements of an " +
-                   "empty Collection.", collection.containsAll(col));
+                "empty Collection.", getCollection().containsAll(col));
         col.addAll(Arrays.asList(getOtherElements()));
         assertTrue("Empty Collection shouldn't contain all elements of " +
-                   "a non-empty Collection.", !collection.containsAll(col));
+                "a non-empty Collection.", !getCollection().containsAll(col));
         // make sure calls to "containsAll" don't change anything
         verify();
 
         resetFull();
-        assertTrue("Full collection shouldn't contain other elements", 
-                   !collection.containsAll(col));
-        
+        assertTrue("Full collection shouldn't contain other elements",
+                !getCollection().containsAll(col));
+
         col.clear();
         col.addAll(Arrays.asList(getFullElements()));
         assertTrue("Full collection should containAll full elements",
-                   collection.containsAll(col));
+                getCollection().containsAll(col));
         // make sure calls to "containsAll" don't change anything
         verify();
 
         int min = (getFullElements().length < 2 ? 0 : 2);
-        int max = (getFullElements().length == 1 ? 1 : 
-                    (getFullElements().length <= 5 ? getFullElements().length - 1 : 5));
+        int max = (getFullElements().length == 1 ? 1 :
+                (getFullElements().length <= 5 ? getFullElements().length - 1 : 5));
         col = Arrays.asList(getFullElements()).subList(min, max);
-        assertTrue("Full collection should containAll partial full " +
-                   "elements", collection.containsAll(col));
-        assertTrue("Full collection should containAll itself", 
-                   collection.containsAll(collection));
+        assertTrue("Full collection should containAll partial full elements",
+                getCollection().containsAll(col));
+        assertTrue("Full collection should containAll itself", getCollection().containsAll(getCollection()));
         // make sure calls to "containsAll" don't change anything
         verify();
-        
-        col = new ArrayList<T>();
+
+        col = new ArrayList<E>();
         col.addAll(Arrays.asList(getFullElements()));
         col.addAll(Arrays.asList(getFullElements()));
-        assertTrue("Full collection should containAll duplicate full " +
-                   "elements", collection.containsAll(col));
+        assertTrue("Full collection should containAll duplicate full elements",
+                getCollection().containsAll(col));
 
         // make sure calls to "containsAll" don't change anything
         verify();
@@ -738,58 +718,52 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
      */
     public void testCollectionIsEmpty() {
         resetEmpty();
-        assertEquals("New Collection should be empty.", 
-                     true, collection.isEmpty());
+        assertEquals("New Collection should be empty.", true, getCollection().isEmpty());
         // make sure calls to "isEmpty() don't change anything
         verify();
 
         resetFull();
-        assertEquals("Full collection shouldn't be empty", 
-                     false, collection.isEmpty());
+        assertEquals("Full collection shouldn't be empty", false, getCollection().isEmpty());
         // make sure calls to "isEmpty() don't change anything
         verify();
     }
 
-
     /**
      *  Tests the read-only functionality of {@link Collection#iterator()}.
      */
     public void testCollectionIterator() {
         resetEmpty();
-        Iterator<T> it1 = collection.iterator();
-        assertEquals("Iterator for empty Collection shouldn't have next.",
-                     false, it1.hasNext());
+        Iterator<E> it1 = getCollection().iterator();
+        assertEquals("Iterator for empty Collection shouldn't have next.", false, it1.hasNext());
         try {
             it1.next();
-            fail("Iterator at end of Collection should throw " +
-                 "NoSuchElementException when next is called.");
-        } catch(NoSuchElementException e) {
+            fail("Iterator at end of Collection should throw "
+                    + "NoSuchElementException when next is called.");
+        } catch (NoSuchElementException e) {
             // expected
-        } 
+        }
         // make sure nothing has changed after non-modification
         verify();
 
         resetFull();
-        it1 = collection.iterator();
-        for (int i = 0; i < collection.size(); i++) {
-            assertTrue("Iterator for full collection should haveNext", 
-                       it1.hasNext());
+        it1 = getCollection().iterator();
+        for (int i = 0; i < getCollection().size(); i++) {
+            assertTrue("Iterator for full collection should haveNext", it1.hasNext());
             it1.next();
         }
         assertTrue("Iterator should be finished", !it1.hasNext());
-        
-        ArrayList<T> list = new ArrayList<T>();
-        it1 = collection.iterator();
-        for (int i = 0; i < collection.size(); i++) {
-            T next = it1.next();
-            assertTrue("Collection should contain element returned by " +
-                       "its iterator", collection.contains(next));
+
+        ArrayList<E> list = new ArrayList<E>();
+        it1 = getCollection().iterator();
+        for (int i = 0; i < getCollection().size(); i++) {
+            E next = it1.next();
+            assertTrue("Collection should contain element returned by its iterator",
+                    getCollection().contains(next));
             list.add(next);
         }
         try {
             it1.next();
-            fail("iterator.next() should raise NoSuchElementException " +
-                 "after it finishes");
+            fail("iterator.next() should raise NoSuchElementException after it finishes");
         } catch (NoSuchElementException e) {
             // expected
         }
@@ -797,16 +771,16 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
         verify();
     }
 
-
     /**
      *  Tests removals from {@link Collection#iterator()}.
      */
+    @SuppressWarnings("unchecked")
     public void testCollectionIteratorRemove() {
         if (!isRemoveSupported()) return;
 
         resetEmpty();
         try {
-            collection.iterator().remove();
+            getCollection().iterator().remove();
             fail("New iterator.remove should raise IllegalState");
         } catch (IllegalStateException e) {
             // expected
@@ -814,25 +788,24 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
         verify();
 
         try {
-            Iterator<T> iter = collection.iterator();
+            Iterator<E> iter = getCollection().iterator();
             iter.hasNext();
             iter.remove();
-            fail("New iterator.remove should raise IllegalState " +
-                 "even after hasNext");
+            fail("New iterator.remove should raise IllegalState even after hasNext");
         } catch (IllegalStateException e) {
             // expected
         }
         verify();
 
         resetFull();
-        int size = collection.size();
-        Iterator<T> iter = collection.iterator();
+        int size = getCollection().size();
+        Iterator<E> iter = getCollection().iterator();
         while (iter.hasNext()) {
             Object o = iter.next();
             // TreeMap reuses the Map Entry, so the verify below fails
             // Clone it here if necessary
             if (o instanceof Map.Entry) {
-                o = cloneMapEntry((Map.Entry) o);
+                o = cloneMapEntry((Map.Entry<E, E>) o);
             }
             iter.remove();
 
@@ -841,23 +814,22 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
             // contents are still the same.  Otherwise, we don't have the
             // ability to distinguish the elements and determine which to
             // remove from the confirmed collection (in which case, we don't
-            // verify because we don't know how). 
+            // verify because we don't know how).
             //
             // see areEqualElementsDistinguishable()
-            if(!areEqualElementsDistinguishable()) {
-                confirmed.remove(o);
+            if (!areEqualElementsDistinguishable()) {
+                getConfirmed().remove(o);
                 verify();
             }
 
             size--;
-            assertEquals("Collection should shrink by one after " +
-                         "iterator.remove", size, collection.size());
+            assertEquals("Collection should shrink by one after iterator.remove", size,
+                    getCollection().size());
         }
-        assertTrue("Collection should be empty after iterator purge",
-                   collection.isEmpty());
-        
+        assertTrue("Collection should be empty after iterator purge", getCollection().isEmpty());
+
         resetFull();
-        iter = collection.iterator();
+        iter = getCollection().iterator();
         iter.next();
         iter.remove();
         try {
@@ -868,7 +840,6 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
         }
     }
 
-
     /**
      *  Tests {@link Collection#remove(Object)}.
      */
@@ -876,46 +847,42 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
         if (!isRemoveSupported()) return;
 
         resetEmpty();
-        Object[] elements = getFullElements();
+        E[] elements = getFullElements();
         for (int i = 0; i < elements.length; i++) {
-            assertTrue("Shouldn't remove nonexistent element", 
-                       !collection.remove(elements[i]));
+            assertTrue("Shouldn't remove nonexistent element", !getCollection().remove(elements[i]));
             verify();
         }
-        
-        Object[] other = getOtherElements();
-        
+
+        E[] other = getOtherElements();
+
         resetFull();
         for (int i = 0; i < other.length; i++) {
-            assertTrue("Shouldn't remove nonexistent other element", 
-                       !collection.remove(other[i]));
+            assertTrue("Shouldn't remove nonexistent other element", !getCollection().remove(other[i]));
             verify();
         }
-        
-        int size = collection.size();
+
+        int size = getCollection().size();
         for (int i = 0; i < elements.length; i++) {
             resetFull();
             assertTrue("Collection should remove extant element: " + elements[i],
-                       collection.remove(elements[i]));
+                    getCollection().remove(elements[i]));
 
             // if the elements aren't distinguishable, we can just remove a
             // matching element from the confirmed collection and verify
             // contents are still the same.  Otherwise, we don't have the
             // ability to distinguish the elements and determine which to
             // remove from the confirmed collection (in which case, we don't
-            // verify because we don't know how). 
+            // verify because we don't know how).
             //
             // see areEqualElementsDistinguishable()
-            if(!areEqualElementsDistinguishable()) {
-                confirmed.remove(elements[i]);
+            if (!areEqualElementsDistinguishable()) {
+                getConfirmed().remove(elements[i]);
                 verify();
             }
 
-            assertEquals("Collection should shrink after remove", 
-                         size - 1, collection.size());
+            assertEquals("Collection should shrink after remove", size - 1, getCollection().size());
         }
     }
-    
 
     /**
      *  Tests {@link Collection#removeAll(Collection)}.
@@ -924,52 +891,46 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
         if (!isRemoveSupported()) return;
 
         resetEmpty();
-        assertTrue("Emtpy collection removeAll should return false for " +
-                   "empty input", 
-                   !collection.removeAll(Collections.EMPTY_SET));
+        assertTrue("Empty collection removeAll should return false for empty input",
+                !getCollection().removeAll(Collections.EMPTY_SET));
         verify();
-        
-        assertTrue("Emtpy collection removeAll should return false for " +
-                   "nonempty input", 
-                   !collection.removeAll(new ArrayList<T>(collection)));
+
+        assertTrue("Empty collection removeAll should return false for nonempty input",
+                   !getCollection().removeAll(new ArrayList<E>(getCollection())));
         verify();
-        
+
         resetFull();
-        assertTrue("Full collection removeAll should return false for " + 
-                   "empty input", 
-                   !collection.removeAll(Collections.EMPTY_SET));
+        assertTrue("Full collection removeAll should return false for empty input",
+                   !getCollection().removeAll(Collections.EMPTY_SET));
         verify();
-        
-        assertTrue("Full collection removeAll should return false for other elements", 
-                   !collection.removeAll(Arrays.asList(getOtherElements())));
+
+        assertTrue("Full collection removeAll should return false for other elements",
+                   !getCollection().removeAll(Arrays.asList(getOtherElements())));
         verify();
-        
-        assertTrue("Full collection removeAll should return true for full elements", 
-                    collection.removeAll(new HashSet<T>(collection)));
-        confirmed.removeAll(new HashSet<T>(confirmed));
+
+        assertTrue("Full collection removeAll should return true for full elements",
+                getCollection().removeAll(new HashSet<E>(getCollection())));
+        getConfirmed().removeAll(new HashSet<E>(getConfirmed()));
         verify();
-        
+
         resetFull();
-        int size = collection.size();
+        int size = getCollection().size();
         int min = (getFullElements().length < 2 ? 0 : 2);
-        int max = (getFullElements().length == 1 ? 1 : 
-                    (getFullElements().length <= 5 ? getFullElements().length - 1 : 5));
-        Collection<T> all = Arrays.asList(getFullElements()).subList(min, max);
-        assertTrue("Full collection removeAll should work", 
-                   collection.removeAll(all));
-        confirmed.removeAll(all);
+        int max = (getFullElements().length == 1 ? 1 :
+                (getFullElements().length <= 5 ? getFullElements().length - 1 : 5));
+        Collection<E> all = Arrays.asList(getFullElements()).subList(min, max);
+        assertTrue("Full collection removeAll should work", getCollection().removeAll(all));
+        getConfirmed().removeAll(all);
         verify();
-        
-        assertTrue("Collection should shrink after removeAll", 
-                   collection.size() < size);
-        Iterator<T> iter = all.iterator();
+
+        assertTrue("Collection should shrink after removeAll", getCollection().size() < size);
+        Iterator<E> iter = all.iterator();
         while (iter.hasNext()) {
             assertTrue("Collection shouldn't contain removed element",
-                       !collection.contains(iter.next()));
+                    !getCollection().contains(iter.next()));
         }
     }
 
-
     /**
      *  Tests {@link Collection#retainAll(Collection)}.
      */
@@ -977,138 +938,131 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
         if (!isRemoveSupported()) return;
 
         resetEmpty();
-        List<T> elements = Arrays.asList(getFullElements());
-        List<T> other = Arrays.asList(getOtherElements());
+        List<E> elements = Arrays.asList(getFullElements());
+        List<E> other = Arrays.asList(getOtherElements());
 
-        assertTrue("Empty retainAll() should return false", 
-                   !collection.retainAll(Collections.EMPTY_SET));
+        assertTrue("Empty retainAll() should return false",
+                !getCollection().retainAll(Collections.EMPTY_SET));
         verify();
-        
-        assertTrue("Empty retainAll() should return false", 
-                   !collection.retainAll(elements));
+
+        assertTrue("Empty retainAll() should return false", !getCollection().retainAll(elements));
         verify();
-        
+
         resetFull();
-        assertTrue("Collection should change from retainAll empty", 
-                   collection.retainAll(Collections.EMPTY_SET));
-        confirmed.retainAll(Collections.EMPTY_SET);
+        assertTrue("Collection should change from retainAll empty",
+                getCollection().retainAll(Collections.EMPTY_SET));
+        getConfirmed().retainAll(Collections.EMPTY_SET);
         verify();
-        
+
         resetFull();
-        assertTrue("Collection changed from retainAll other", 
-                   collection.retainAll(other));
-        confirmed.retainAll(other);
+        assertTrue("Collection changed from retainAll other", getCollection().retainAll(other));
+        getConfirmed().retainAll(other);
         verify();
-        
+
         resetFull();
-        int size = collection.size();
+        int size = getCollection().size();
         assertTrue("Collection shouldn't change from retainAll elements",
-                   !collection.retainAll(elements));
+                   !getCollection().retainAll(elements));
         verify();
-        assertEquals("Collection size shouldn't change", size, 
-                     collection.size());
-        
+        assertEquals("Collection size shouldn't change", size, getCollection().size());
+
         if (getFullElements().length > 1) {
             resetFull();
-            size = collection.size();
+            size = getCollection().size();
             int min = (getFullElements().length < 2 ? 0 : 2);
             int max = (getFullElements().length <= 5 ? getFullElements().length - 1 : 5);
             assertTrue("Collection should changed by partial retainAll",
-                       collection.retainAll(elements.subList(min, max)));
-            confirmed.retainAll(elements.subList(min, max));
+                    getCollection().retainAll(elements.subList(min, max)));
+            getConfirmed().retainAll(elements.subList(min, max));
             verify();
-        
-            Iterator<T> iter = collection.iterator();
+
+            Iterator<E> iter = getCollection().iterator();
             while (iter.hasNext()) {
-                assertTrue("Collection only contains retained element", 
-                           elements.subList(min, max).contains(iter.next()));
+                assertTrue("Collection only contains retained element",
+                        elements.subList(min, max).contains(iter.next()));
             }
         }
-        
+
         resetFull();
-        HashSet<T> set = new HashSet<T>(elements);
-        size = collection.size();
+        HashSet<E> set = new HashSet<E>(elements);
+        size = getCollection().size();
         assertTrue("Collection shouldn't change from retainAll without " +
-                   "duplicate elements", !collection.retainAll(set));
+                   "duplicate elements", !getCollection().retainAll(set));
         verify();
         assertEquals("Collection size didn't change from nonduplicate " +
-                     "retainAll", size, collection.size());
+                     "retainAll", size, getCollection().size());
     }
-    
-    
+
     /**
      *  Tests {@link Collection#size()}.
      */
     public void testCollectionSize() {
         resetEmpty();
-        assertEquals("Size of new Collection is 0.", 0, collection.size());
+        assertEquals("Size of new Collection is 0.", 0, getCollection().size());
 
         resetFull();
-        assertTrue("Size of full collection should be greater than zero", 
-                   collection.size() > 0);
+        assertTrue("Size of full collection should be greater than zero", getCollection().size() > 0);
     }
 
-
     /**
      *  Tests {@link Collection#toArray()}.
      */
     public void testCollectionToArray() {
         resetEmpty();
         assertEquals("Empty Collection should return empty array for toArray",
-                     0, collection.toArray().length);
+                     0, getCollection().toArray().length);
 
         resetFull();
-        Object[] array = collection.toArray();
-        assertEquals("Full collection toArray should be same size as " +
-                     "collection", array.length, collection.size());
-        Object[] confirmedArray = confirmed.toArray();
-        assertEquals("length of array from confirmed collection should " +
-                     "match the length of the collection's array", 
-                     confirmedArray.length, array.length);
+        Object[] array = getCollection().toArray();
+        assertEquals("Full collection toArray should be same size as collection",
+                array.length, getCollection().size());
+        Object[] confirmedArray = getConfirmed().toArray();
+        assertEquals("length of array from confirmed collection should "
+                + "match the length of the collection's array", confirmedArray.length, array.length);
         boolean[] matched = new boolean[array.length];
 
         for (int i = 0; i < array.length; i++) {
             assertTrue("Collection should contain element in toArray",
-                       collection.contains(array[i]));
+                    getCollection().contains(array[i]));
 
             boolean match = false;
             // find a match in the confirmed array
-            for(int j = 0; j < array.length; j++) {
+            for (int j = 0; j < array.length; j++) {
                 // skip already matched
-                if(matched[j]) continue;
-                if(array[i] == confirmedArray[j] ||
-                   (array[i] != null && array[i].equals(confirmedArray[j]))) {
+                if (matched[j])
+                    continue;
+                if (array[i] == confirmedArray[j]
+                        || (array[i] != null && array[i].equals(confirmedArray[j]))) {
                     matched[j] = true;
                     match = true;
                     break;
                 }
             }
-            if(!match) {
-                fail("element " + i + " in returned array should be found " +
-                     "in the confirmed collection's array");
+            if (!match) {
+                fail("element " + i + " in returned array should be found "
+                        + "in the confirmed collection's array");
             }
         }
-        for(int i = 0; i < matched.length; i++) {
-            assertEquals("Collection should return all its elements in " +
-                         "toArray", true, matched[i]);
+        for (int i = 0; i < matched.length; i++) {
+            assertEquals("Collection should return all its elements in " + "toArray", true,
+                    matched[i]);
         }
     }
 
-
     /**
      *  Tests {@link Collection#toArray(Object[])}.
      */
     public void testCollectionToArray2() {
         resetEmpty();
         Object[] a = new Object[] { new Object(), null, null };
-        Object[] array = collection.toArray(a);
+        Object[] array = getCollection().toArray(a);
         assertEquals("Given array shouldn't shrink", array, a);
         assertEquals("Last element should be set to null", a[0], null);
         verify();
 
         resetFull();
         try {
-            array = collection.toArray(new Void[0]);
+            array = getCollection().toArray(new Void[0]);
             fail("toArray(new Void[0]) should raise ArrayStore");
         } catch (ArrayStoreException e) {
             // expected
@@ -1116,16 +1070,16 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
         verify();
 
         try {
-            array = collection.toArray(null);
+            array = getCollection().toArray(null);
             fail("toArray(null) should raise NPE");
         } catch (NullPointerException e) {
             // expected
         }
         verify();
-        
-        array = collection.toArray(new Object[0]);
-        a = collection.toArray();
-        assertEquals("toArrays should be equal", 
+
+        array = getCollection().toArray(new Object[0]);
+        a = getCollection().toArray();
+        assertEquals("toArrays should be equal",
                      Arrays.asList(array), Arrays.asList(a));
 
         // Figure out if they're all the same class
@@ -1135,36 +1089,32 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
             classes.add((array[i] == null) ? null : array[i].getClass());
         }
         if (classes.size() > 1) return;
-        
+
         Class<?> cl = classes.iterator().next();
         if (Map.Entry.class.isAssignableFrom(cl)) {  // check needed for protective cases like Predicated/Unmod map entrySet
             cl = Map.Entry.class;
         }
-        a = (Object[])Array.newInstance(cl, 0);
-        array = collection.toArray(a);
+        a = (Object[]) Array.newInstance(cl, 0);
+        array = getCollection().toArray(a);
         assertEquals("toArray(Object[]) should return correct array type",
-                     a.getClass(), array.getClass());
-        assertEquals("type-specific toArrays should be equal", 
-                     Arrays.asList(array), 
-                     Arrays.asList(collection.toArray()));
+                a.getClass(), array.getClass());
+        assertEquals("type-specific toArrays should be equal",
+                Arrays.asList(array),
+                Arrays.asList(getCollection().toArray()));
         verify();
     }
 
-
     /**
      *  Tests <code>toString</code> on a collection.
      */
     public void testCollectionToString() {
         resetEmpty();
-        assertTrue("toString shouldn't return null", 
-                   collection.toString() != null);
+        assertTrue("toString shouldn't return null", getCollection().toString() != null);
 
         resetFull();
-        assertTrue("toString shouldn't return null", 
-                   collection.toString() != null);
+        assertTrue("toString shouldn't return null", getCollection().toString() != null);
     }
 
-
     /**
      *  If isRemoveSupported() returns false, tests to see that remove
      *  operations raise an UnsupportedOperationException.
@@ -1174,7 +1124,7 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
 
         resetEmpty();
         try {
-            collection.clear();
+            getCollection().clear();
             fail("clear should raise UnsupportedOperationException");
         } catch (UnsupportedOperationException e) {
             // expected
@@ -1182,7 +1132,7 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
         verify();
 
         try {
-            collection.remove(null);
+            getCollection().remove(null);
             fail("remove should raise UnsupportedOperationException");
         } catch (UnsupportedOperationException e) {
             // expected
@@ -1190,7 +1140,7 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
         verify();
 
         try {
-            collection.removeAll(null);
+            getCollection().removeAll(null);
             fail("removeAll should raise UnsupportedOperationException");
         } catch (UnsupportedOperationException e) {
             // expected
@@ -1198,7 +1148,7 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
         verify();
 
         try {
-            collection.retainAll(null);
+            getCollection().retainAll(null);
             fail("removeAll should raise UnsupportedOperationException");
         } catch (UnsupportedOperationException e) {
             // expected
@@ -1207,7 +1157,7 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
 
         resetFull();
         try {
-            Iterator<T> iterator = collection.iterator();
+            Iterator<E> iterator = getCollection().iterator();
             iterator.next();
             iterator.remove();
             fail("iterator.remove should raise UnsupportedOperationException");
@@ -1218,32 +1168,31 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
 
     }
 
-
     /**
-     *  Tests that the collection's iterator is fail-fast.  
+     *  Tests that the collection's iterator is fail-fast.
      */
     public void testCollectionIteratorFailFast() {
         if (!isFailFastSupported()) return;
-        
+
         if (isAddSupported()) {
             resetFull();
             try {
-                Iterator<T> iter = collection.iterator();
-                T o = getOtherElements()[0];
-                collection.add(o);
-                confirmed.add(o);
+                Iterator<E> iter = getCollection().iterator();
+                E o = getOtherElements()[0];
+                getCollection().add(o);
+                getConfirmed().add(o);
                 iter.next();
                 fail("next after add should raise ConcurrentModification");
             } catch (ConcurrentModificationException e) {
                 // expected
             }
             verify();
-            
+
             resetFull();
             try {
-                Iterator<T> iter = collection.iterator();
-                collection.addAll(Arrays.asList(getOtherElements()));
-                confirmed.addAll(Arrays.asList(getOtherElements()));
+                Iterator<E> iter = getCollection().iterator();
+                getCollection().addAll(Arrays.asList(getOtherElements()));
+                getConfirmed().addAll(Arrays.asList(getOtherElements()));
                 iter.next();
                 fail("next after addAll should raise ConcurrentModification");
             } catch (ConcurrentModificationException e) {
@@ -1256,8 +1205,8 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
 
         resetFull();
         try {
-            Iterator<T> iter = collection.iterator();
-            collection.clear();
+            Iterator<E> iter = getCollection().iterator();
+            getCollection().clear();
             iter.next();
             fail("next after clear should raise ConcurrentModification");
         } catch (ConcurrentModificationException e) {
@@ -1265,11 +1214,11 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
         } catch (NoSuchElementException e) {
             // (also legal given spec)
         }
-        
+
         resetFull();
         try {
-            Iterator<T> iter = collection.iterator();
-            collection.remove(getFullElements()[0]);
+            Iterator<E> iter = getCollection().iterator();
+            getCollection().remove(getFullElements()[0]);
             iter.next();
             fail("next after remove should raise ConcurrentModification");
         } catch (ConcurrentModificationException e) {
@@ -1278,9 +1227,9 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
 
         resetFull();
         try {
-            Iterator<T> iter = collection.iterator();
-            List<T> sublist = Arrays.asList(getFullElements()).subList(2,5);
-            collection.removeAll(sublist);
+            Iterator<E> iter = getCollection().iterator();
+            List<E> sublist = Arrays.asList(getFullElements()).subList(2,5);
+            getCollection().removeAll(sublist);
             iter.next();
             fail("next after removeAll should raise ConcurrentModification");
         } catch (ConcurrentModificationException e) {
@@ -1289,9 +1238,9 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
 
         resetFull();
         try {
-            Iterator<T> iter = collection.iterator();
-            List<T> sublist = Arrays.asList(getFullElements()).subList(2,5);
-            collection.retainAll(sublist);
+            Iterator<E> iter = getCollection().iterator();
+            List<E> sublist = Arrays.asList(getFullElements()).subList(2,5);
+            getCollection().retainAll(sublist);
             iter.next();
             fail("next after retainAll should raise ConcurrentModification");
         } catch (ConcurrentModificationException e) {
@@ -1300,7 +1249,7 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
     }
 
     public void testSerializeDeserializeThenCompare() throws Exception {
-        Object obj = makeCollection();
+        Object obj = makeObject();
         if (obj instanceof Serializable && isTestSerialization()) {
             ByteArrayOutputStream buffer = new ByteArrayOutputStream();
             ObjectOutputStream out = new ObjectOutputStream(buffer);
@@ -1329,5 +1278,88 @@ public abstract class AbstractTestCollection<T> extends AbstractTestObject {
             }
         }
     }
-    
+
+    public Collection<E> getCollection() {
+        return collection;
+    }
+
+    /**
+     * Set the collection.
+     * @param collection the Collection<E> to set
+     */
+    public void setCollection(Collection<E> collection) {
+        this.collection = collection;
+    }
+
+    public Collection<E> getConfirmed() {
+        return confirmed;
+    }
+
+    /**
+     * Set the confirmed.
+     * @param confirmed the Collection<E> to set
+     */
+    public void setConfirmed(Collection<E> confirmed) {
+        this.confirmed = confirmed;
+    }
+
+    /**
+     * Handle the optional exceptions declared by {@link Collection#contains(Object)}
+     * @param coll
+     * @param element
+     */
+    protected static void assertNotCollectionContains(Collection<?> coll, Object element) {
+        try {
+            assertFalse(coll.contains(element));
+        } catch (ClassCastException e) {
+            //apparently not
+        } catch (NullPointerException e) {
+            //apparently not
+        }
+    }
+
+    /**
+     * Handle the optional exceptions declared by {@link Collection#containsAll(Collection)}
+     * @param coll
+     * @param sub
+     */
+    protected static void assertNotCollectionContainsAll(Collection<?> coll, Collection<?> sub) {
+        try {
+            assertFalse(coll.containsAll(sub));
+        } catch (ClassCastException cce) {
+            //apparently not
+        } catch (NullPointerException e) {
+            //apparently not
+        }
+    }
+
+    /**
+     * Handle optional exceptions of {@link Collection#remove(Object)}
+     * @param coll
+     * @param element
+     */
+    protected static void assertNotRemoveFromCollection(Collection<?> coll, Object element) {
+        try {
+            assertFalse(coll.remove(element));
+        } catch (ClassCastException cce) {
+            //apparently not
+        } catch (NullPointerException e) {
+            //apparently not
+        }
+    }
+
+    /**
+     * Handle optional exceptions of {@link Collection#removeAll(Collection)}
+     * @param coll
+     * @param sub
+     */
+    protected static void assertNotRemoveAllFromCollection(Collection<?> coll, Collection<?> sub) {
+        try {
+            assertFalse(coll.removeAll(sub));
+        } catch (ClassCastException cce) {
+            //apparently not
+        } catch (NullPointerException e) {
+            //apparently not
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/collection/TestCompositeCollection.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/collection/TestCompositeCollection.java b/src/test/org/apache/commons/collections/collection/TestCompositeCollection.java
index 8794134..71fc729 100644
--- a/src/test/org/apache/commons/collections/collection/TestCompositeCollection.java
+++ b/src/test/org/apache/commons/collections/collection/TestCompositeCollection.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.
@@ -27,21 +27,21 @@ import junit.framework.Test;
 import junit.framework.TestSuite;
 
 /**
- * Extension of {@link AbstractTestCollection} for exercising the 
+ * Extension of {@link AbstractTestCollection} for exercising the
  * {@link CompositeCollection} implementation.
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Brian McCallister
  * @author Phil Steitz
  */
-public class TestCompositeCollection extends AbstractTestCollection<String> {
-    
+public class TestCompositeCollection<E> extends AbstractTestCollection<E> {
+
     public TestCompositeCollection(String name) {
         super(name);
     }
-    
+
     public static Test suite() {
         return new TestSuite(TestCompositeCollection.class);
     }
@@ -50,7 +50,7 @@ public class TestCompositeCollection extends AbstractTestCollection<String> {
         String[] testCaseName = { TestCompositeCollection.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
- 
+
  //-----------------------------------------------------------------------------
     /**
      * Run stock collection tests without Mutator, so turn off add, remove
@@ -58,145 +58,150 @@ public class TestCompositeCollection extends AbstractTestCollection<String> {
     public boolean isAddSupported() {
         return false;
     }
-    
+
     public boolean isRemoveSupported() {
         return false;
     }
-    
+
     /**
      * Empty collection is empty composite
      */
-    public Collection<String> makeCollection() {
-        return new CompositeCollection<String>();
+    public Collection<E> makeObject() {
+        return new CompositeCollection<E>();
     }
-    
-    public Collection<String> makeConfirmedCollection() {
-        return new HashSet<String>();
+
+    public Collection<E> makeConfirmedCollection() {
+        return new HashSet<E>();
     }
-    
-    public String[] getFullElements() {
-        return new String[] {"1", "2", "3", "4"};
+
+    @SuppressWarnings("unchecked")
+    public E[] getFullElements() {
+        return (E[]) new Object[] { "1", "2", "3", "4" };
     }
-    
+
     /**
      * Full collection consists of 4 collections, each with one element
      */
-    public Collection<String> makeFullCollection() {
-        CompositeCollection<String> compositeCollection = new CompositeCollection<String>();
-        String[] elements = getFullElements();
+    public Collection<E> makeFullCollection() {
+        CompositeCollection<E> compositeCollection = new CompositeCollection<E>();
+        E[] elements = getFullElements();
         for (int i = 0; i < elements.length; i++) {
-            Collection<String> summand = new HashSet<String>();
+            Collection<E> summand = new HashSet<E>();
             summand.add(elements[i]);
             compositeCollection.addComposited(summand);
         }
         return compositeCollection;
     }
-    
+
     /**
      * Full collection should look like a collection with 4 elements
      */
-    public Collection<String> makeConfirmedFullCollection() {
-        Collection<String> collection = new HashSet<String>();
+    public Collection<E> makeConfirmedFullCollection() {
+        Collection<E> collection = new HashSet<E>();
         collection.addAll(Arrays.asList(getFullElements()));
         return collection;
     }
-    
+
     /**
      * Override testUnsupportedRemove, since the default impl expects removeAll,
      * retainAll and iterator().remove to throw
      */
-    public void testUnsupportedRemove() {    
+    public void testUnsupportedRemove() {
         resetFull();
         try {
-            collection.remove(null);
+            getCollection().remove(null);
             fail("remove should raise UnsupportedOperationException");
         } catch (UnsupportedOperationException e) {
             // expected
         }
         verify();
     }
-    
+
     //--------------------------------------------------------------------------
-    
-    protected CompositeCollection<String> c;
-    protected Collection<String> one;
-    protected Collection<String> two;
-    
+
+    protected CompositeCollection<E> c;
+    protected Collection<E> one;
+    protected Collection<E> two;
+
     protected void setUpTest() {
-        c = new CompositeCollection<String>();
-        one = new HashSet<String>();
-        two = new HashSet<String>();
+        c = new CompositeCollection<E>();
+        one = new HashSet<E>();
+        two = new HashSet<E>();
     }
-    
+
     protected void setUpMutatorTest() {
         setUpTest();
-        c.setMutator(new CompositeCollection.CollectionMutator<String>() {
-            public boolean add(CompositeCollection<String> composite, 
-                    List<Collection<String>> collections, String obj) {
-                for (Collection<String> collection : collections) {
+        c.setMutator(new CompositeCollection.CollectionMutator<E>() {
+            public boolean add(CompositeCollection<E> composite,
+                    List<Collection<E>> collections, E obj) {
+                for (Collection<E> collection : collections) {
                     collection.add(obj);
                 }
                 return true;
             }
-            
-            public boolean addAll(CompositeCollection<String> composite, 
-                    List<Collection<String>> collections, Collection<? extends String> coll) {
-                for (Collection<String> collection : collections) {
+
+            public boolean addAll(CompositeCollection<E> composite,
+                    List<Collection<E>> collections, Collection<? extends E> coll) {
+                for (Collection<E> collection : collections) {
                     collection.addAll(coll);
                 }
                 return true;
             }
-            
-            public boolean remove(CompositeCollection<String> composite, 
-                    List<Collection<String>> collections, Object obj) {
-                for (Collection<String> collection : collections) {
+
+            public boolean remove(CompositeCollection<E> composite,
+                    List<Collection<E>> collections, Object obj) {
+                for (Collection<E> collection : collections) {
                     collection.remove(obj);
                 }
                 return true;
             }
         });
     }
-            
+
+    @SuppressWarnings("unchecked")
     public void testSize() {
         setUpTest();
-        HashSet<String> set = new HashSet<String>();
-        set.add("a");
-        set.add("b");
+        HashSet<E> set = new HashSet<E>();
+        set.add((E) "a");
+        set.add((E) "b");
         c.addComposited(set);
         assertEquals(set.size(), c.size());
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testMultipleCollectionsSize() {
         setUpTest();
-        HashSet<String> set = new HashSet<String>();
-        set.add("a");
-        set.add("b");
+        HashSet<E> set = new HashSet<E>();
+        set.add((E) "a");
+        set.add((E) "b");
         c.addComposited(set);
-        HashSet<String> other = new HashSet<String>();
-        other.add("c");
+        HashSet<E> other = new HashSet<E>();
+        other.add((E) "c");
         c.addComposited(other);
         assertEquals(set.size() + other.size(), c.size());
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testIsEmpty() {
         setUpTest();
         assertTrue(c.isEmpty());
-        HashSet<String> empty = new HashSet<String>();
+        HashSet<E> empty = new HashSet<E>();
         c.addComposited(empty);
         assertTrue(c.isEmpty());
-        empty.add("a");
+        empty.add((E) "a");
         assertTrue(!c.isEmpty());
     }
-    
-    
+
+
+    @SuppressWarnings("unchecked")
     public void testIterator() {
         setUpTest();
-        one.add("1");
-        two.add("2");
+        one.add((E) "1");
+        two.add((E) "2");
         c.addComposited(one);
         c.addComposited(two);
-        Iterator<String> i = c.iterator();
-        String next = i.next();
+        Iterator<E> i = c.iterator();
+        E next = i.next();
         assertTrue(c.contains(next));
         assertTrue(one.contains(next));
         next = i.next();
@@ -204,31 +209,34 @@ public class TestCompositeCollection extends AbstractTestCollection<String> {
         assertTrue(!c.contains(next));
         assertTrue(!two.contains(next));
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testClear() {
         setUpTest();
-        one.add("1");
-        two.add("2");
+        one.add((E) "1");
+        two.add((E) "2");
         c.addComposited(one, two);
         c.clear();
         assertTrue(one.isEmpty());
         assertTrue(two.isEmpty());
         assertTrue(c.isEmpty());
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testContainsAll() {
         setUpTest();
-        one.add("1");
-        two.add("1");
+        one.add((E) "1");
+        two.add((E) "1");
         c.addComposited(one);
         assertTrue(c.containsAll(two));
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testRetainAll() {
         setUpTest();
-        one.add("1");
-        one.add("2");
-        two.add("1");
+        one.add((E) "1");
+        one.add((E) "2");
+        two.add((E) "1");
         c.addComposited(one);
         c.retainAll(two);
         assertTrue(!c.contains("2"));
@@ -236,125 +244,132 @@ public class TestCompositeCollection extends AbstractTestCollection<String> {
         assertTrue(c.contains("1"));
         assertTrue(one.contains("1"));
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testAddAllMutator() {
         setUpTest();
-        c.setMutator(new CompositeCollection.CollectionMutator<String>() {
-            public boolean add(CompositeCollection<String> composite, 
-                    List<Collection<String>> collections, String obj) {
-                for (Collection<String> collection : collections) {
+        c.setMutator(new CompositeCollection.CollectionMutator<E>() {
+            public boolean add(CompositeCollection<E> composite,
+                    List<Collection<E>> collections, E obj) {
+                for (Collection<E> collection : collections) {
                     collection.add(obj);
                 }
                 return true;
             }
-            
-            public boolean addAll(CompositeCollection<String> composite, 
-                    List<Collection<String>> collections, Collection<? extends String> coll) {
-                for (Collection<String> collection : collections) {
+
+            public boolean addAll(CompositeCollection<E> composite,
+                    List<Collection<E>> collections, Collection<? extends E> coll) {
+                for (Collection<E> collection : collections) {
                     collection.addAll(coll);
                 }
                 return true;
             }
-            
-            public boolean remove(CompositeCollection<String> composite, 
-                    List<Collection<String>> collections, Object obj) {
+
+            public boolean remove(CompositeCollection<E> composite,
+                    List<Collection<E>> collections, Object obj) {
                 return false;
             }
         });
-        
+
         c.addComposited(one);
-        two.add("foo");
+        two.add((E) "foo");
         c.addAll(two);
         assertTrue(c.contains("foo"));
         assertTrue(one.contains("foo"));
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testAddMutator() {
         setUpTest();
-        c.setMutator(new CompositeCollection.CollectionMutator<String>() {
-            public boolean add(CompositeCollection<String> composite, 
-                    List<Collection<String>> collections, String obj) {
-                for (Collection<String> collection : collections) {
+        c.setMutator(new CompositeCollection.CollectionMutator<E>() {
+            public boolean add(CompositeCollection<E> composite,
+                    List<Collection<E>> collections, E obj) {
+                for (Collection<E> collection : collections) {
                     collection.add(obj);
                 }
                 return true;
             }
-            
-            public boolean addAll(CompositeCollection<String> composite, 
-                    List<Collection<String>> collections, Collection<? extends String> coll) {
-                for (Collection<String> collection : collections) {
+
+            public boolean addAll(CompositeCollection<E> composite,
+                    List<Collection<E>> collections, Collection<? extends E> coll) {
+                for (Collection<E> collection : collections) {
                     collection.addAll(coll);
                 }
                 return true;
             }
-            
-            public boolean remove(CompositeCollection<String> composite, 
-                    List<Collection<String>> collections, Object obj) {
+
+            public boolean remove(CompositeCollection<E> composite,
+                    List<Collection<E>> collections, Object obj) {
                 return false;
             }
         });
-        
+
         c.addComposited(one);
-        c.add("foo");
+        c.add((E) "foo");
         assertTrue(c.contains("foo"));
         assertTrue(one.contains("foo"));
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testToCollection() {
         setUpTest();
-        one.add("1");
-        two.add("2");
+        one.add((E) "1");
+        two.add((E) "2");
         c.addComposited(one, two);
-        Collection<String> foo = c.toCollection();
+        Collection<E> foo = c.toCollection();
         assertTrue(foo.containsAll(c));
         assertEquals(c.size(), foo.size());
-        one.add("3");
+        one.add((E) "3");
         assertTrue(!foo.containsAll(c));
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testAddAllToCollection() {
         setUpTest();
-        one.add("1");
-        two.add("2");
+        one.add((E) "1");
+        two.add((E) "2");
         c.addComposited(one, two);
-        Collection<String> toCollection = new HashSet<String>();
+        Collection<E> toCollection = new HashSet<E>();
         toCollection.addAll(c);
         assertTrue(toCollection.containsAll(c));
         assertEquals(c.size(), toCollection.size());
-    }   
-    
+    }
+
+    @SuppressWarnings("unchecked")
     public void testRemove() {
         setUpMutatorTest();
-        one.add("1");
-        two.add("2");
-        two.add("1");
+        one.add((E) "1");
+        two.add((E) "2");
+        two.add((E) "1");
         c.addComposited(one, two);
         c.remove("1");
         assertTrue(!c.contains("1"));
         assertTrue(!one.contains("1"));
         assertTrue(!two.contains("1"));
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testRemoveAll() {
         setUpMutatorTest();
-        one.add("1");
-        two.add("2");
-        two.add("1");
+        one.add((E) "1");
+        two.add((E) "2");
+        two.add((E) "1");
         // need separate list to remove, as otherwise one clears itself
-        Collection<String> removing = new ArrayList<String>(one);
+        Collection<E> removing = new ArrayList<E>(one);
         c.addComposited(one, two);
         c.removeAll(removing);
         assertTrue(!c.contains("1"));
         assertTrue(!one.contains("1"));
         assertTrue(!two.contains("1"));
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testRemoveComposited() {
         setUpMutatorTest();
-        one.add("1");
-        two.add("2");
-        two.add("1");
-        c.addComposited(one, two);    
+        one.add((E) "1");
+        two.add((E) "2");
+        two.add((E) "1");
+        c.addComposited(one, two);
         c.removeComposited(one);
         assertTrue(c.contains("1"));
         assertEquals(c.size(), 2);

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/collection/TestPredicatedCollection.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/collection/TestPredicatedCollection.java b/src/test/org/apache/commons/collections/collection/TestPredicatedCollection.java
index 576f7f1..5dce2c8 100644
--- a/src/test/org/apache/commons/collections/collection/TestPredicatedCollection.java
+++ b/src/test/org/apache/commons/collections/collection/TestPredicatedCollection.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.
@@ -25,23 +25,23 @@ import junit.framework.Test;
 import junit.framework.TestSuite;
 
 import org.apache.commons.collections.Predicate;
-import org.apache.commons.collections.PredicateUtils;
+import org.apache.commons.collections.functors.TruePredicate;
 
 /**
- * Extension of {@link TestCollection} for exercising the 
+ * Extension of {@link TestCollection} for exercising the
  * {@link PredicatedCollection} implementation.
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  */
-public class TestPredicatedCollection extends AbstractTestCollection<Object> {
+public class TestPredicatedCollection<E> extends AbstractTestCollection<E> {
 
     public TestPredicatedCollection(String name) {
         super(name);
     }
-    
+
     public static Test suite() {
         return new TestSuite(TestPredicatedCollection.class);
     }
@@ -52,83 +52,82 @@ public class TestPredicatedCollection extends AbstractTestCollection<Object> {
     }
 
    //------------------------------------------------------------------------
-    protected Predicate<Object> truePredicate = PredicateUtils.truePredicate();
+    protected Predicate<E> truePredicate = TruePredicate.<E>truePredicate();
 
-    protected Collection<Object> decorateCollection(
-                Collection<Object> collection, Predicate<Object> predicate) {
+    protected Collection<E> decorateCollection(
+                Collection<E> collection, Predicate<E> predicate) {
         return PredicatedCollection.decorate(collection, predicate);
     }
 
-    public Collection<Object> makeCollection() {
-        return decorateCollection(new ArrayList<Object>(), truePredicate);
+    public Collection<E> makeObject() {
+        return decorateCollection(new ArrayList<E>(), truePredicate);
     }
 
-    public Collection<Object> makeConfirmedCollection() {
-        return new ArrayList<Object>();
+    public Collection<E> makeConfirmedCollection() {
+        return new ArrayList<E>();
     }
 
-    public Object[] getFullElements() {
-        return new Object[] {"1", "3", "5", "7", "2", "4", "6"};
+    @SuppressWarnings("unchecked")
+    public E[] getFullElements() {
+        return (E[]) new Object[] { "1", "3", "5", "7", "2", "4", "6" };
     }
 
-    public Collection<Object> makeFullCollection() {
-        List<Object> list = new ArrayList<Object>();
+    public Collection<E> makeFullCollection() {
+        List<E> list = new ArrayList<E>();
         list.addAll(Arrays.asList(getFullElements()));
         return decorateCollection(list, truePredicate);
     }
 
-    public Collection<Object> makeConfirmedFullCollection() {
-        List<Object> list = new ArrayList<Object>();
+    public Collection<E> makeConfirmedFullCollection() {
+        List<E> list = new ArrayList<E>();
         list.addAll(Arrays.asList(getFullElements()));
         return list;
     }
 
     //-----------------------------------------------------------------------
-    protected Predicate<Object> testPredicate =  
-        new Predicate<Object>() {
-            public boolean evaluate(Object o) {
+    protected Predicate<E> testPredicate =
+        new Predicate<E>() {
+            public boolean evaluate(E o) {
                 return o instanceof String;
             }
         };
 
-    public Collection<Object> makeTestCollection() {
-        return decorateCollection(new ArrayList<Object>(), testPredicate);
+    public Collection<E> makeTestCollection() {
+        return decorateCollection(new ArrayList<E>(), testPredicate);
     }
 
+    @SuppressWarnings("unchecked")
     public void testIllegalAdd() {
-        Collection<Object> c = makeTestCollection();
+        Collection<E> c = makeTestCollection();
         Integer i = new Integer(3);
         try {
-            c.add(i);
+            c.add((E) i);
             fail("Integer should fail string predicate.");
         } catch (IllegalArgumentException e) {
             // expected
         }
-        assertTrue("Collection shouldn't contain illegal element", 
-         !c.contains(i));   
+        assertTrue("Collection shouldn't contain illegal element",
+         !c.contains(i));
     }
 
+    @SuppressWarnings("unchecked")
     public void testIllegalAddAll() {
-        Collection<Object> c = makeTestCollection();
-        List<Object> elements = new ArrayList<Object>();
-        elements.add("one");
-        elements.add("two");
-        elements.add(new Integer(3));
-        elements.add("four");
+        Collection<E> c = makeTestCollection();
+        List<E> elements = new ArrayList<E>();
+        elements.add((E) "one");
+        elements.add((E) "two");
+        elements.add((E) new Integer(3));
+        elements.add((E) "four");
         try {
             c.addAll(elements);
             fail("Integer should fail string predicate.");
         } catch (IllegalArgumentException e) {
             // expected
         }
-        assertTrue("Collection shouldn't contain illegal element", 
-         !c.contains("one"));   
-        assertTrue("Collection shouldn't contain illegal element", 
-         !c.contains("two"));   
-        assertTrue("Collection shouldn't contain illegal element", 
-         !c.contains(new Integer(3)));   
-        assertTrue("Collection shouldn't contain illegal element", 
-         !c.contains("four"));   
+        assertTrue("Collection shouldn't contain illegal element", !c.contains("one"));
+        assertTrue("Collection shouldn't contain illegal element", !c.contains("two"));
+        assertTrue("Collection shouldn't contain illegal element", !c.contains(new Integer(3)));
+        assertTrue("Collection shouldn't contain illegal element", !c.contains("four"));
     }
 
     public String getCompatibilityVersion() {


[07/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/list/TestCursorableLinkedList.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/list/TestCursorableLinkedList.java b/src/test/org/apache/commons/collections/list/TestCursorableLinkedList.java
index cc02ec4..487d859 100644
--- a/src/test/org/apache/commons/collections/list/TestCursorableLinkedList.java
+++ b/src/test/org/apache/commons/collections/list/TestCursorableLinkedList.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,13 +30,13 @@ import org.apache.commons.collections.BulkTest;
 
 /**
  * Test class.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Rodney Waldhoff
  * @author Simon Kitching
  */
-public class TestCursorableLinkedList extends TestAbstractLinkedList {
+public class TestCursorableLinkedList<E> extends TestAbstractLinkedList<E> {
     public TestCursorableLinkedList(String testName) {
         super(testName);
     }
@@ -50,39 +50,40 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    private CursorableLinkedList list = null;
+    private CursorableLinkedList<E> list;
 
     public void setUp() {
-        list = new CursorableLinkedList();
+        list = new CursorableLinkedList<E>();
     }
 
-    public List makeEmptyList() {
-        return new CursorableLinkedList();
+    public CursorableLinkedList<E> makeObject() {
+        return new CursorableLinkedList<E>();
     }
 
+    @SuppressWarnings("unchecked")
     public void testAdd() {
         assertEquals("[]",list.toString());
-        assertTrue(list.add(new Integer(1)));
+        assertTrue(list.add((E) new Integer(1)));
         assertEquals("[1]",list.toString());
-        assertTrue(list.add(new Integer(2)));
+        assertTrue(list.add((E) new Integer(2)));
         assertEquals("[1, 2]",list.toString());
-        assertTrue(list.add(new Integer(3)));
+        assertTrue(list.add((E) new Integer(3)));
         assertEquals("[1, 2, 3]",list.toString());
-        assertTrue(list.addFirst(new Integer(0)));
+        assertTrue(list.addFirst((E) new Integer(0)));
         assertEquals("[0, 1, 2, 3]",list.toString());
-        assertTrue(list.addLast(new Integer(4)));
+        assertTrue(list.addLast((E) new Integer(4)));
         assertEquals("[0, 1, 2, 3, 4]",list.toString());
-        list.add(0,new Integer(-2));
+        list.add(0,(E) new Integer(-2));
         assertEquals("[-2, 0, 1, 2, 3, 4]",list.toString());
-        list.add(1,new Integer(-1));
+        list.add(1,(E) new Integer(-1));
         assertEquals("[-2, -1, 0, 1, 2, 3, 4]",list.toString());
-        list.add(7,new Integer(5));
+        list.add(7,(E) new Integer(5));
         assertEquals("[-2, -1, 0, 1, 2, 3, 4, 5]",list.toString());
 
-        java.util.List list2 = new java.util.LinkedList();
-        list2.add("A");
-        list2.add("B");
-        list2.add("C");
+        java.util.List<E> list2 = new java.util.LinkedList<E>();
+        list2.add((E) "A");
+        list2.add((E) "B");
+        list2.add((E) "C");
 
         assertTrue(list.addAll(list2));
         assertEquals("[-2, -1, 0, 1, 2, 3, 4, 5, A, B, C]",list.toString());
@@ -90,6 +91,7 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         assertEquals("[-2, -1, 0, A, B, C, 1, 2, 3, 4, 5, A, B, C]",list.toString());
     }
 
+    @SuppressWarnings("unchecked")
     public void testClear() {
         assertEquals(0,list.size());
         assertTrue(list.isEmpty());
@@ -97,7 +99,7 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         assertEquals(0,list.size());
         assertTrue(list.isEmpty());
 
-        list.add("element");
+        list.add((E) "element");
         assertEquals(1,list.size());
         assertTrue(!list.isEmpty());
 
@@ -105,8 +107,8 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         assertEquals(0,list.size());
         assertTrue(list.isEmpty());
 
-        list.add("element1");
-        list.add("element2");
+        list.add((E) "element1");
+        list.add((E) "element2");
         assertEquals(2,list.size());
         assertTrue(!list.isEmpty());
 
@@ -114,10 +116,10 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         assertEquals(0,list.size());
         assertTrue(list.isEmpty());
 
-        for(int i=0;i<1000;i++) {
-            list.add(new Integer(i));
+        for (int i = 0; i < 1000; i++) {
+            list.add((E) new Integer(i));
         }
-        assertEquals(1000,list.size());
+        assertEquals(1000, list.size());
         assertTrue(!list.isEmpty());
 
         list.clear();
@@ -125,13 +127,14 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         assertTrue(list.isEmpty());
     }
 
+    @SuppressWarnings("unchecked")
     public void testContains() {
         assertTrue(!list.contains("A"));
-        assertTrue(list.add("A"));
+        assertTrue(list.add((E) "A"));
         assertTrue(list.contains("A"));
-        assertTrue(list.add("B"));
+        assertTrue(list.add((E) "B"));
         assertTrue(list.contains("A"));
-        assertTrue(list.addFirst("a"));
+        assertTrue(list.addFirst((E) "a"));
         assertTrue(list.contains("A"));
         assertTrue(list.remove("a"));
         assertTrue(list.contains("A"));
@@ -139,239 +142,248 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         assertTrue(!list.contains("A"));
     }
 
+    @SuppressWarnings("unchecked")
     public void testContainsAll() {
         assertTrue(list.containsAll(list));
-        java.util.List list2 = new java.util.LinkedList();
+        java.util.List<E> list2 = new java.util.LinkedList<E>();
         assertTrue(list.containsAll(list2));
-        list2.add("A");
+        list2.add((E) "A");
         assertTrue(!list.containsAll(list2));
-        list.add("B");
-        list.add("A");
+        list.add((E) "B");
+        list.add((E) "A");
         assertTrue(list.containsAll(list2));
-        list2.add("B");
+        list2.add((E) "B");
         assertTrue(list.containsAll(list2));
-        list2.add("C");
+        list2.add((E) "C");
         assertTrue(!list.containsAll(list2));
-        list.add("C");
+        list.add((E) "C");
         assertTrue(list.containsAll(list2));
-        list2.add("C");
+        list2.add((E) "C");
         assertTrue(list.containsAll(list2));
         assertTrue(list.containsAll(list));
     }
 
+    @SuppressWarnings("unchecked")
     public void testCursorNavigation() {
-        list.add("1");
-        list.add("2");
-        list.add("3");
-        list.add("4");
-        list.add("5");
-        CursorableLinkedList.Cursor it = list.cursor();
+        list.add((E) "1");
+        list.add((E) "2");
+        list.add((E) "3");
+        list.add((E) "4");
+        list.add((E) "5");
+        CursorableLinkedList.Cursor<E> it = list.cursor();
         assertTrue(it.hasNext());
         assertTrue(!it.hasPrevious());
-        assertEquals("1",it.next());
+        assertEquals("1", it.next());
         assertTrue(it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals("1",it.previous());
+        assertEquals("1", it.previous());
         assertTrue(it.hasNext());
         assertTrue(!it.hasPrevious());
-        assertEquals("1",it.next());
+        assertEquals("1", it.next());
         assertTrue(it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals("2",it.next());
+        assertEquals("2", it.next());
         assertTrue(it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals("2",it.previous());
+        assertEquals("2", it.previous());
         assertTrue(it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals("2",it.next());
+        assertEquals("2", it.next());
         assertTrue(it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals("3",it.next());
+        assertEquals("3", it.next());
         assertTrue(it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals("4",it.next());
+        assertEquals("4", it.next());
         assertTrue(it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals("5",it.next());
+        assertEquals("5", it.next());
         assertTrue(!it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals("5",it.previous());
+        assertEquals("5", it.previous());
         assertTrue(it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals("4",it.previous());
+        assertEquals("4", it.previous());
         assertTrue(it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals("3",it.previous());
+        assertEquals("3", it.previous());
         assertTrue(it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals("2",it.previous());
+        assertEquals("2", it.previous());
         assertTrue(it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals("1",it.previous());
+        assertEquals("1", it.previous());
         assertTrue(it.hasNext());
         assertTrue(!it.hasPrevious());
         it.close();
     }
 
+    @SuppressWarnings("unchecked")
     public void testCursorSet() {
-        list.add("1");
-        list.add("2");
-        list.add("3");
-        list.add("4");
-        list.add("5");
-
-        CursorableLinkedList.Cursor it = list.cursor();
-        assertEquals("1",it.next());
-        it.set("a");
-        assertEquals("a",it.previous());
-        it.set("A");
-        assertEquals("A",it.next());
-        assertEquals("2",it.next());
-        it.set("B");
-        assertEquals("3",it.next());
-        assertEquals("4",it.next());
-        it.set("D");
-        assertEquals("5",it.next());
-        it.set("E");
-        assertEquals("[A, B, 3, D, E]",list.toString());
+        list.add((E) "1");
+        list.add((E) "2");
+        list.add((E) "3");
+        list.add((E) "4");
+        list.add((E) "5");
+
+        CursorableLinkedList.Cursor<E> it = list.cursor();
+        assertEquals("1", it.next());
+        it.set((E) "a");
+        assertEquals("a", it.previous());
+        it.set((E) "A");
+        assertEquals("A", it.next());
+        assertEquals("2", it.next());
+        it.set((E) "B");
+        assertEquals("3", it.next());
+        assertEquals("4", it.next());
+        it.set((E) "D");
+        assertEquals("5", it.next());
+        it.set((E) "E");
+        assertEquals("[A, B, 3, D, E]", list.toString());
         it.close();
     }
 
+    @SuppressWarnings("unchecked")
     public void testCursorRemove() {
-        list.add("1");
-        list.add("2");
-        list.add("3");
-        list.add("4");
-        list.add("5");
+        list.add((E) "1");
+        list.add((E) "2");
+        list.add((E) "3");
+        list.add((E) "4");
+        list.add((E) "5");
 
-        CursorableLinkedList.Cursor it = list.cursor();
+        CursorableLinkedList.Cursor<E> it = list.cursor();
         try {
             it.remove();
             fail();
-        } catch(IllegalStateException e) {
+        } catch (IllegalStateException e) {
             // expected
         }
-        assertEquals("1",it.next());
-        assertEquals("2",it.next());
-        assertEquals("[1, 2, 3, 4, 5]",list.toString());
+        assertEquals("1", it.next());
+        assertEquals("2", it.next());
+        assertEquals("[1, 2, 3, 4, 5]", list.toString());
         it.remove();
-        assertEquals("[1, 3, 4, 5]",list.toString());
-        assertEquals("3",it.next());
-        assertEquals("3",it.previous());
-        assertEquals("1",it.previous());
+        assertEquals("[1, 3, 4, 5]", list.toString());
+        assertEquals("3", it.next());
+        assertEquals("3", it.previous());
+        assertEquals("1", it.previous());
         it.remove();
-        assertEquals("[3, 4, 5]",list.toString());
+        assertEquals("[3, 4, 5]", list.toString());
         assertTrue(!it.hasPrevious());
-        assertEquals("3",it.next());
+        assertEquals("3", it.next());
         it.remove();
-        assertEquals("[4, 5]",list.toString());
+        assertEquals("[4, 5]", list.toString());
         try {
             it.remove();
-        } catch(IllegalStateException e) {
+        } catch (IllegalStateException e) {
             // expected
         }
-        assertEquals("4",it.next());
-        assertEquals("5",it.next());
+        assertEquals("4", it.next());
+        assertEquals("5", it.next());
         it.remove();
-        assertEquals("[4]",list.toString());
-        assertEquals("4",it.previous());
+        assertEquals("[4]", list.toString());
+        assertEquals("4", it.previous());
         it.remove();
-        assertEquals("[]",list.toString());
+        assertEquals("[]", list.toString());
         it.close();
     }
 
+    @SuppressWarnings("unchecked")
     public void testCursorAdd() {
-        CursorableLinkedList.Cursor it = list.cursor();
-        it.add("1");
-        assertEquals("[1]",list.toString());
-        it.add("3");
-        assertEquals("[1, 3]",list.toString());
-        it.add("5");
-        assertEquals("[1, 3, 5]",list.toString());
-        assertEquals("5",it.previous());
-        it.add("4");
-        assertEquals("[1, 3, 4, 5]",list.toString());
-        assertEquals("4",it.previous());
-        assertEquals("3",it.previous());
-        it.add("2");
-        assertEquals("[1, 2, 3, 4, 5]",list.toString());
+        CursorableLinkedList.Cursor<E> it = list.cursor();
+        it.add((E) "1");
+        assertEquals("[1]", list.toString());
+        it.add((E) "3");
+        assertEquals("[1, 3]", list.toString());
+        it.add((E) "5");
+        assertEquals("[1, 3, 5]", list.toString());
+        assertEquals("5", it.previous());
+        it.add((E) "4");
+        assertEquals("[1, 3, 4, 5]", list.toString());
+        assertEquals("4", it.previous());
+        assertEquals("3", it.previous());
+        it.add((E) "2");
+        assertEquals("[1, 2, 3, 4, 5]", list.toString());
         it.close();
     }
 
+    @SuppressWarnings("unchecked")
     public void testCursorConcurrentModification() {
         // this test verifies that cursors remain valid when the list
         // is modified via other means.
-        list.add("1");
-        list.add("2");
-        list.add("3");
-        list.add("5");
-        list.add("7");
-        list.add("9");
-
-        CursorableLinkedList.Cursor c1 = list.cursor();
-        CursorableLinkedList.Cursor c2 = list.cursor();
-        Iterator li = list.iterator();
-        
+        list.add((E) "1");
+        list.add((E) "2");
+        list.add((E) "3");
+        list.add((E) "5");
+        list.add((E) "7");
+        list.add((E) "9");
+
+        CursorableLinkedList.Cursor<E> c1 = list.cursor();
+        CursorableLinkedList.Cursor<E> c2 = list.cursor();
+        Iterator<E> li = list.iterator();
+
         // test cursors remain valid when list modified by std Iterator
         // test cursors skip elements removed via ListIterator
-        assertEquals("1",li.next());
-        assertEquals("2",li.next());
+        assertEquals("1", li.next());
+        assertEquals("2", li.next());
         li.remove();
-        assertEquals("3",li.next());
-        assertEquals("1",c1.next());
-        assertEquals("3",c1.next());
-        assertEquals("1",c2.next());
-        
+        assertEquals("3", li.next());
+        assertEquals("1", c1.next());
+        assertEquals("3", c1.next());
+        assertEquals("1", c2.next());
+
         // test cursor c1 can remove elements from previously modified list
         // test cursor c2 skips elements removed via different cursor
         c1.remove();
-        assertEquals("5",c2.next());
-        c2.add("6");
-        assertEquals("5",c1.next());
-        assertEquals("6",c1.next());
-        assertEquals("7",c1.next());
-        
+        assertEquals("5", c2.next());
+        c2.add((E) "6");
+        assertEquals("5", c1.next());
+        assertEquals("6", c1.next());
+        assertEquals("7", c1.next());
+
         // test cursors remain valid when list mod via CursorableLinkedList
         // test cursor remains valid when elements inserted into list before
         // the current position of the cursor.
-        list.add(0, "0");
+        list.add(0, (E) "0");
 
         // test cursor remains valid when element inserted immediately after
         // current element of a cursor, and the element is seen on the
         // next call to the next method of that cursor.
-        list.add(5, "8");
-
-        assertEquals("8",c1.next());
-        assertEquals("9",c1.next());
-        c1.add("10");
-        assertEquals("7",c2.next());
-        assertEquals("8",c2.next());
-        assertEquals("9",c2.next());
-        assertEquals("10",c2.next());
-        
+        list.add(5, (E) "8");
+
+        assertEquals("8", c1.next());
+        assertEquals("9", c1.next());
+        c1.add((E) "10");
+        assertEquals("7", c2.next());
+        assertEquals("8", c2.next());
+        assertEquals("9", c2.next());
+        assertEquals("10", c2.next());
+
         try {
             c2.next();
             fail();
-        } catch (NoSuchElementException nse) {}
-        
+        } catch (NoSuchElementException nse) {
+        }
+
         try {
             li.next();
             fail();
-        } catch (ConcurrentModificationException cme) {}
-        
-        c1.close();  // not necessary
-        c2.close();  // not necessary
+        } catch (ConcurrentModificationException cme) {
+        }
+
+        c1.close(); // not necessary
+        c2.close(); // not necessary
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testCursorNextIndexMid() {
-        list.add("1");
-        list.add("2");
-        list.add("3");
-        list.add("5");
-
-        CursorableLinkedList.Cursor c1 = list.cursor();
-        Iterator li = list.iterator();
-        
+        list.add((E) "1");
+        list.add((E) "2");
+        list.add((E) "3");
+        list.add((E) "5");
+
+        CursorableLinkedList.Cursor<E> c1 = list.cursor();
+        Iterator<E> li = list.iterator();
+
         // test cursors remain valid when list modified by std Iterator
         // test cursors skip elements removed via ListIterator
         assertEquals("1", li.next());
@@ -382,15 +394,16 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         assertEquals(1, c1.nextIndex());
         assertEquals("3", c1.next());
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testCursorNextIndexFirst() {
-        list.add("1");
-        list.add("2");
-        list.add("3");
-        list.add("5");
+        list.add((E) "1");
+        list.add((E) "2");
+        list.add((E) "3");
+        list.add((E) "5");
+
+        CursorableLinkedList.Cursor<E> c1 = list.cursor();
 
-        CursorableLinkedList.Cursor c1 = list.cursor();
-        
         assertEquals(0, c1.nextIndex());
         list.remove(0);
         assertEquals(0, c1.nextIndex());
@@ -398,48 +411,51 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         assertEquals(1, c1.nextIndex());
         assertEquals("3", c1.next());
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testCursorNextIndexAddBefore() {
-        list.add("1");
-        list.add("2");
-        list.add("3");
-        list.add("5");
+        list.add((E) "1");
+        list.add((E) "2");
+        list.add((E) "3");
+        list.add((E) "5");
+
+        CursorableLinkedList.Cursor<E> c1 = list.cursor();
 
-        CursorableLinkedList.Cursor c1 = list.cursor();
-        
         assertEquals(0, c1.nextIndex());
         assertEquals("1", c1.next());
-        list.add(0, "0");
+        list.add(0, (E) "0");
         assertEquals(2, c1.nextIndex());
         assertEquals("2", c1.next());
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testCursorNextIndexAddNext() {
-        list.add("1");
-        list.add("2");
-        list.add("3");
-        list.add("5");
+        list.add((E) "1");
+        list.add((E) "2");
+        list.add((E) "3");
+        list.add((E) "5");
+
+        CursorableLinkedList.Cursor<E> c1 = list.cursor();
 
-        CursorableLinkedList.Cursor c1 = list.cursor();
-        
         assertEquals(0, c1.nextIndex());
-        list.add(0, "0");
+        list.add(0, (E) "0");
         assertEquals(0, c1.nextIndex());
         assertEquals("0", c1.next());
         assertEquals(1, c1.nextIndex());
         assertEquals("1", c1.next());
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testCursorNextIndexAddAfter() {
-        list.add("1");
-        list.add("2");
-        list.add("3");
-        list.add("5");
+        list.add((E) "1");
+        list.add((E) "2");
+        list.add((E) "3");
+        list.add((E) "5");
+
+        CursorableLinkedList.Cursor<E> c1 = list.cursor();
 
-        CursorableLinkedList.Cursor c1 = list.cursor();
-        
         assertEquals(0, c1.nextIndex());
-        list.add(1, "0");
+        list.add(1, (E) "0");
         assertEquals(0, c1.nextIndex());
         assertEquals("1", c1.next());
         assertEquals(1, c1.nextIndex());
@@ -447,24 +463,25 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testInternalState_CursorNextNextPreviousRemoveIndex1ByList() {
-        list.add("A");
-        list.add("B");
-        list.add("C");
+        list.add((E) "A");
+        list.add((E) "B");
+        list.add((E) "C");
 
-        CursorableLinkedList.Cursor c1 = list.cursor();
+        CursorableLinkedList.Cursor<E> c1 = list.cursor();
         assertEquals("A", c1.next());
         assertEquals("B", c1.next());
         assertEquals("B", c1.previous());
-        
+
         assertEquals("B", list.remove(1));
-        
+
         assertEquals(true, c1.nextIndexValid);
         assertEquals(1, c1.nextIndex);
         assertEquals(true, c1.currentRemovedByAnother);
         assertEquals(null, c1.current);
         assertEquals("C", c1.next.value);
-        
+
         assertEquals("[A, C]", list.toString());
         c1.remove();  // works ok
         assertEquals("[A, C]", list.toString());
@@ -474,22 +491,23 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         } catch (IllegalStateException ex) {}
     }
 
+    @SuppressWarnings("unchecked")
     public void testInternalState_CursorNextRemoveIndex1ByList() {
-        list.add("A");
-        list.add("B");
-        list.add("C");
+        list.add((E) "A");
+        list.add((E) "B");
+        list.add((E) "C");
 
-        CursorableLinkedList.Cursor c1 = list.cursor();
+        CursorableLinkedList.Cursor<E> c1 = list.cursor();
         assertEquals("A", c1.next());
-        
+
         assertEquals("B", list.remove(1));
-        
+
         assertEquals(true, c1.nextIndexValid);
         assertEquals(1, c1.nextIndex);
         assertEquals(false, c1.currentRemovedByAnother);
         assertEquals("A", c1.current.value);
         assertEquals("C", c1.next.value);
-        
+
         assertEquals("[A, C]", list.toString());
         c1.remove();  // works ok
         assertEquals("[C]", list.toString());
@@ -499,23 +517,24 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         } catch (IllegalStateException ex) {}
     }
 
+    @SuppressWarnings("unchecked")
     public void testInternalState_CursorNextNextRemoveIndex1ByList() {
-        list.add("A");
-        list.add("B");
-        list.add("C");
+        list.add((E) "A");
+        list.add((E) "B");
+        list.add((E) "C");
 
-        CursorableLinkedList.Cursor c1 = list.cursor();
+        CursorableLinkedList.Cursor<E> c1 = list.cursor();
         assertEquals("A", c1.next());
         assertEquals("B", c1.next());
-        
+
         assertEquals("B", list.remove(1));
-        
+
         assertEquals(true, c1.nextIndexValid);
         assertEquals(1, c1.nextIndex);
         assertEquals(true, c1.currentRemovedByAnother);
         assertEquals(null, c1.current);
         assertEquals("C", c1.next.value);
-        
+
         assertEquals("[A, C]", list.toString());
         c1.remove();  // works ok
         assertEquals("[A, C]", list.toString());
@@ -525,24 +544,25 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         } catch (IllegalStateException ex) {}
     }
 
+    @SuppressWarnings("unchecked")
     public void testInternalState_CursorNextNextNextRemoveIndex1ByList() {
-        list.add("A");
-        list.add("B");
-        list.add("C");
-        list.add("D");
+        list.add((E) "A");
+        list.add((E) "B");
+        list.add((E) "C");
+        list.add((E) "D");
 
-        CursorableLinkedList.Cursor c1 = list.cursor();
+        CursorableLinkedList.Cursor<E> c1 = list.cursor();
         assertEquals("A", c1.next());
         assertEquals("B", c1.next());
         assertEquals("C", c1.next());
-        
+
         assertEquals("B", list.remove(1));
-        
+
         assertEquals(false, c1.nextIndexValid);
         assertEquals(false, c1.currentRemovedByAnother);
         assertEquals("C", c1.current.value);
         assertEquals("D", c1.next.value);
-        
+
         assertEquals("[A, C, D]", list.toString());
         c1.remove();  // works ok
         assertEquals("[A, D]", list.toString());
@@ -553,24 +573,25 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testInternalState_CursorNextNextPreviousRemoveByIterator() {
-        list.add("A");
-        list.add("B");
-        list.add("C");
+        list.add((E) "A");
+        list.add((E) "B");
+        list.add((E) "C");
 
-        CursorableLinkedList.Cursor c1 = list.cursor();
+        CursorableLinkedList.Cursor<E> c1 = list.cursor();
         assertEquals("A", c1.next());
         assertEquals("B", c1.next());
         assertEquals("B", c1.previous());
-        
+
         c1.remove();
-        
+
         assertEquals(true, c1.nextIndexValid);
         assertEquals(1, c1.nextIndex);
         assertEquals(false, c1.currentRemovedByAnother);
         assertEquals(null, c1.current);
         assertEquals("C", c1.next.value);
-        
+
         assertEquals("[A, C]", list.toString());
         try {
             c1.remove();
@@ -578,23 +599,24 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         } catch (IllegalStateException ex) {}
     }
 
+    @SuppressWarnings("unchecked")
     public void testInternalState_CursorNextNextRemoveByIterator() {
-        list.add("A");
-        list.add("B");
-        list.add("C");
+        list.add((E) "A");
+        list.add((E) "B");
+        list.add((E) "C");
 
-        CursorableLinkedList.Cursor c1 = list.cursor();
+        CursorableLinkedList.Cursor<E> c1 = list.cursor();
         assertEquals("A", c1.next());
         assertEquals("B", c1.next());
-        
+
         c1.remove();
-        
+
         assertEquals(true, c1.nextIndexValid);
         assertEquals(1, c1.nextIndex);
         assertEquals(false, c1.currentRemovedByAnother);
         assertEquals(null, c1.current);
         assertEquals("C", c1.next.value);
-        
+
         assertEquals("[A, C]", list.toString());
         try {
             c1.remove();
@@ -603,23 +625,24 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testInternalState_CursorNextNextPreviousAddIndex1ByList() {
-        list.add("A");
-        list.add("B");
-        list.add("C");
+        list.add((E) "A");
+        list.add((E) "B");
+        list.add((E) "C");
 
-        CursorableLinkedList.Cursor c1 = list.cursor();
+        CursorableLinkedList.Cursor<E> c1 = list.cursor();
         assertEquals("A", c1.next());
         assertEquals("B", c1.next());
         assertEquals("B", c1.previous());
-        
-        list.add(1, "Z");
-        
+
+        list.add(1, (E) "Z");
+
         assertEquals(true, c1.nextIndexValid);
         assertEquals(1, c1.nextIndex);
         assertEquals("B", c1.current.value);
         assertEquals("Z", c1.next.value);
-        
+
         assertEquals("[A, Z, B, C]", list.toString());
         c1.remove();  // works ok
         assertEquals("[A, Z, C]", list.toString());
@@ -629,21 +652,22 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         } catch (IllegalStateException ex) {}
     }
 
+    @SuppressWarnings("unchecked")
     public void testInternalState_CursorNextAddIndex1ByList() {
-        list.add("A");
-        list.add("B");
-        list.add("C");
+        list.add((E) "A");
+        list.add((E) "B");
+        list.add((E) "C");
 
-        CursorableLinkedList.Cursor c1 = list.cursor();
+        CursorableLinkedList.Cursor<E> c1 = list.cursor();
         assertEquals("A", c1.next());
-        
-        list.add(1, "Z");
-        
+
+        list.add(1, (E) "Z");
+
         assertEquals(true, c1.nextIndexValid);
         assertEquals(1, c1.nextIndex);
         assertEquals("A", c1.current.value);
         assertEquals("Z", c1.next.value);
-        
+
         assertEquals("[A, Z, B, C]", list.toString());
         c1.remove();  // works ok
         assertEquals("[Z, B, C]", list.toString());
@@ -653,21 +677,22 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         } catch (IllegalStateException ex) {}
     }
 
+    @SuppressWarnings("unchecked")
     public void testInternalState_CursorNextNextAddIndex1ByList() {
-        list.add("A");
-        list.add("B");
-        list.add("C");
+        list.add((E) "A");
+        list.add((E) "B");
+        list.add((E) "C");
 
-        CursorableLinkedList.Cursor c1 = list.cursor();
+        CursorableLinkedList.Cursor<E> c1 = list.cursor();
         assertEquals("A", c1.next());
         assertEquals("B", c1.next());
-        
-        list.add(1, "Z");
-        
+
+        list.add(1, (E) "Z");
+
         assertEquals(false, c1.nextIndexValid);
         assertEquals("B", c1.current.value);
         assertEquals("C", c1.next.value);
-        
+
         assertEquals("[A, Z, B, C]", list.toString());
         c1.remove();  // works ok
         assertEquals("[A, Z, C]", list.toString());
@@ -678,23 +703,24 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testInternalState_CursorNextNextPreviousAddByIterator() {
-        list.add("A");
-        list.add("B");
-        list.add("C");
+        list.add((E) "A");
+        list.add((E) "B");
+        list.add((E) "C");
 
-        CursorableLinkedList.Cursor c1 = list.cursor();
+        CursorableLinkedList.Cursor<E> c1 = list.cursor();
         assertEquals("A", c1.next());
         assertEquals("B", c1.next());
         assertEquals("B", c1.previous());
-        
-        c1.add("Z");
-        
+
+        c1.add((E) "Z");
+
         assertEquals(true, c1.nextIndexValid);
         assertEquals(2, c1.nextIndex);
         assertEquals(null, c1.current);
         assertEquals("B", c1.next.value);
-        
+
         assertEquals("[A, Z, B, C]", list.toString());
         try {
             c1.remove();
@@ -702,23 +728,24 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         } catch (IllegalStateException ex) {}
     }
 
+    @SuppressWarnings("unchecked")
     public void testInternalState_CursorNextNextAddByIterator() {
-        list.add("A");
-        list.add("B");
-        list.add("C");
+        list.add((E) "A");
+        list.add((E) "B");
+        list.add((E) "C");
 
-        CursorableLinkedList.Cursor c1 = list.cursor();
+        CursorableLinkedList.Cursor<E> c1 = list.cursor();
         assertEquals("A", c1.next());
         assertEquals("B", c1.next());
-        
-        c1.add("Z");
-        
+
+        c1.add((E) "Z");
+
         assertEquals(true, c1.nextIndexValid);
         assertEquals(3, c1.nextIndex);
         assertEquals(false, c1.currentRemovedByAnother);
         assertEquals(null, c1.current);
         assertEquals("C", c1.next.value);
-        
+
         assertEquals("[A, B, Z, C]", list.toString());
         try {
             c1.remove();
@@ -727,47 +754,49 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testInternalState_CursorNextNextRemoveByListSetByIterator() {
-        list.add("A");
-        list.add("B");
-        list.add("C");
+        list.add((E) "A");
+        list.add((E) "B");
+        list.add((E) "C");
 
-        CursorableLinkedList.Cursor c1 = list.cursor();
+        CursorableLinkedList.Cursor<E> c1 = list.cursor();
         assertEquals("A", c1.next());
         assertEquals("B", c1.next());
-        
+
         list.remove(1);
-        
+
         assertEquals(true, c1.nextIndexValid);
         assertEquals(1, c1.nextIndex);
         assertEquals(null, c1.current);
         assertEquals("C", c1.next.value);
         assertEquals("[A, C]", list.toString());
-        
+
         try {
-            c1.set("Z");
+            c1.set((E) "Z");
             fail();
         } catch (IllegalStateException ex) {}
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testInternalState_CursorNextNextPreviousSetByIterator() {
-        list.add("A");
-        list.add("B");
-        list.add("C");
+        list.add((E) "A");
+        list.add((E) "B");
+        list.add((E) "C");
 
-        CursorableLinkedList.Cursor c1 = list.cursor();
+        CursorableLinkedList.Cursor<E> c1 = list.cursor();
         assertEquals("A", c1.next());
         assertEquals("B", c1.next());
         assertEquals("B", c1.previous());
-        
-        c1.set("Z");
-        
+
+        c1.set((E) "Z");
+
         assertEquals(true, c1.nextIndexValid);
         assertEquals(1, c1.nextIndex);
         assertEquals("Z", c1.current.value);
         assertEquals("Z", c1.next.value);
-        
+
         assertEquals("[A, Z, C]", list.toString());
         c1.remove();  // works ok
         assertEquals("[A, C]", list.toString());
@@ -777,22 +806,23 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         } catch (IllegalStateException ex) {}
     }
 
+    @SuppressWarnings("unchecked")
     public void testInternalState_CursorNextNextSetByIterator() {
-        list.add("A");
-        list.add("B");
-        list.add("C");
+        list.add((E) "A");
+        list.add((E) "B");
+        list.add((E) "C");
 
-        CursorableLinkedList.Cursor c1 = list.cursor();
+        CursorableLinkedList.Cursor<E> c1 = list.cursor();
         assertEquals("A", c1.next());
         assertEquals("B", c1.next());
-        
-        c1.set("Z");
-        
+
+        c1.set((E) "Z");
+
         assertEquals(true, c1.nextIndexValid);
         assertEquals(2, c1.nextIndex);
         assertEquals("Z", c1.current.value);
         assertEquals("C", c1.next.value);
-        
+
         assertEquals("[A, Z, C]", list.toString());
         c1.remove();  // works ok
         assertEquals("[A, C]", list.toString());
@@ -803,44 +833,45 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testEqualsAndHashCode() {
         assertTrue(list.equals(list));
         assertEquals(list.hashCode(),list.hashCode());
-        list.add("A");
+        list.add((E) "A");
         assertTrue(list.equals(list));
         assertEquals(list.hashCode(),list.hashCode());
 
-        CursorableLinkedList list2 = new CursorableLinkedList();
+        CursorableLinkedList<E> list2 = new CursorableLinkedList<E>();
         assertTrue(!list.equals(list2));
         assertTrue(!list2.equals(list));
 
-        java.util.List list3 = new java.util.LinkedList();
+        java.util.List<E> list3 = new java.util.LinkedList<E>();
         assertTrue(!list.equals(list3));
         assertTrue(!list3.equals(list));
         assertTrue(list2.equals(list3));
         assertTrue(list3.equals(list2));
         assertEquals(list2.hashCode(),list3.hashCode());
 
-        list2.add("A");
+        list2.add((E) "A");
         assertTrue(list.equals(list2));
         assertTrue(list2.equals(list));
         assertTrue(!list2.equals(list3));
         assertTrue(!list3.equals(list2));
 
-        list3.add("A");
+        list3.add((E) "A");
         assertTrue(list2.equals(list3));
         assertTrue(list3.equals(list2));
         assertEquals(list2.hashCode(),list3.hashCode());
 
-        list.add("B");
+        list.add((E) "B");
         assertTrue(list.equals(list));
         assertTrue(!list.equals(list2));
         assertTrue(!list2.equals(list));
         assertTrue(!list.equals(list3));
         assertTrue(!list3.equals(list));
 
-        list2.add("B");
-        list3.add("B");
+        list2.add((E) "B");
+        list3.add((E) "B");
         assertTrue(list.equals(list));
         assertTrue(list.equals(list2));
         assertTrue(list2.equals(list));
@@ -848,9 +879,9 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         assertTrue(list3.equals(list2));
         assertEquals(list2.hashCode(),list3.hashCode());
 
-        list.add("C");
-        list2.add("C");
-        list3.add("C");
+        list.add((E) "C");
+        list2.add((E) "C");
+        list3.add((E) "C");
         assertTrue(list.equals(list));
         assertTrue(list.equals(list2));
         assertTrue(list2.equals(list));
@@ -859,13 +890,14 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         assertEquals(list.hashCode(),list2.hashCode());
         assertEquals(list2.hashCode(),list3.hashCode());
 
-        list.add("D");
-        list2.addFirst("D");
+        list.add((E) "D");
+        list2.addFirst((E) "D");
         assertTrue(list.equals(list));
         assertTrue(!list.equals(list2));
         assertTrue(!list2.equals(list));
     }
 
+    @SuppressWarnings("unchecked")
     public void testGet() {
         try {
             list.get(0);
@@ -874,9 +906,9 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
             // expected
         }
 
-        assertTrue(list.add("A"));
+        assertTrue(list.add((E) "A"));
         assertEquals("A",list.get(0));
-        assertTrue(list.add("B"));
+        assertTrue(list.add((E) "B"));
         assertEquals("A",list.get(0));
         assertEquals("B",list.get(1));
 
@@ -895,195 +927,201 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         }
     }
 
+    @SuppressWarnings("unchecked")
     public void testIndexOf() {
         assertEquals(-1,list.indexOf("A"));
         assertEquals(-1,list.lastIndexOf("A"));
-        list.add("A");
+        list.add((E) "A");
         assertEquals(0,list.indexOf("A"));
         assertEquals(0,list.lastIndexOf("A"));
         assertEquals(-1,list.indexOf("B"));
         assertEquals(-1,list.lastIndexOf("B"));
-        list.add("B");
+        list.add((E) "B");
         assertEquals(0,list.indexOf("A"));
         assertEquals(0,list.lastIndexOf("A"));
         assertEquals(1,list.indexOf("B"));
         assertEquals(1,list.lastIndexOf("B"));
-        list.addFirst("B");
+        list.addFirst((E) "B");
         assertEquals(1,list.indexOf("A"));
         assertEquals(1,list.lastIndexOf("A"));
         assertEquals(0,list.indexOf("B"));
         assertEquals(2,list.lastIndexOf("B"));
     }
 
+    @SuppressWarnings("unchecked")
     public void testIsEmpty() {
         assertTrue(list.isEmpty());
-        list.add("element");
+        list.add((E) "element");
         assertTrue(!list.isEmpty());
         list.remove("element");
         assertTrue(list.isEmpty());
-        list.add("element");
+        list.add((E) "element");
         assertTrue(!list.isEmpty());
         list.clear();
         assertTrue(list.isEmpty());
     }
 
+    @SuppressWarnings("unchecked")
     public void testIterator() {
-        list.add("1");
-        list.add("2");
-        list.add("3");
-        list.add("4");
-        list.add("5");
-        Iterator it = list.iterator();
+        list.add((E) "1");
+        list.add((E) "2");
+        list.add((E) "3");
+        list.add((E) "4");
+        list.add((E) "5");
+        Iterator<E> it = list.iterator();
         assertTrue(it.hasNext());
-        assertEquals("1",it.next());
+        assertEquals("1", it.next());
         assertTrue(it.hasNext());
-        assertEquals("2",it.next());
+        assertEquals("2", it.next());
         assertTrue(it.hasNext());
-        assertEquals("3",it.next());
+        assertEquals("3", it.next());
         assertTrue(it.hasNext());
-        assertEquals("4",it.next());
+        assertEquals("4", it.next());
         assertTrue(it.hasNext());
-        assertEquals("5",it.next());
+        assertEquals("5", it.next());
         assertTrue(!it.hasNext());
 
         it = list.iterator();
         assertTrue(it.hasNext());
-        assertEquals("1",it.next());
+        assertEquals("1", it.next());
         it.remove();
-        assertEquals("[2, 3, 4, 5]",list.toString());
+        assertEquals("[2, 3, 4, 5]", list.toString());
         assertTrue(it.hasNext());
-        assertEquals("2",it.next());
+        assertEquals("2", it.next());
         it.remove();
-        assertEquals("[3, 4, 5]",list.toString());
+        assertEquals("[3, 4, 5]", list.toString());
         assertTrue(it.hasNext());
-        assertEquals("3",it.next());
+        assertEquals("3", it.next());
         it.remove();
-        assertEquals("[4, 5]",list.toString());
+        assertEquals("[4, 5]", list.toString());
         assertTrue(it.hasNext());
-        assertEquals("4",it.next());
+        assertEquals("4", it.next());
         it.remove();
-        assertEquals("[5]",list.toString());
+        assertEquals("[5]", list.toString());
         assertTrue(it.hasNext());
-        assertEquals("5",it.next());
+        assertEquals("5", it.next());
         it.remove();
-        assertEquals("[]",list.toString());
+        assertEquals("[]", list.toString());
         assertTrue(!it.hasNext());
     }
 
+    @SuppressWarnings("unchecked")
     public void testListIteratorNavigation() {
-        list.add("1");
-        list.add("2");
-        list.add("3");
-        list.add("4");
-        list.add("5");
-        ListIterator it = list.listIterator();
+        list.add((E) "1");
+        list.add((E) "2");
+        list.add((E) "3");
+        list.add((E) "4");
+        list.add((E) "5");
+        ListIterator<E> it = list.listIterator();
         assertTrue(it.hasNext());
         assertTrue(!it.hasPrevious());
-        assertEquals(-1,it.previousIndex());
-        assertEquals(0,it.nextIndex());
-        assertEquals("1",it.next());
+        assertEquals(-1, it.previousIndex());
+        assertEquals(0, it.nextIndex());
+        assertEquals("1", it.next());
         assertTrue(it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals(0,it.previousIndex());
-        assertEquals(1,it.nextIndex());
-        assertEquals("1",it.previous());
+        assertEquals(0, it.previousIndex());
+        assertEquals(1, it.nextIndex());
+        assertEquals("1", it.previous());
         assertTrue(it.hasNext());
         assertTrue(!it.hasPrevious());
-        assertEquals(-1,it.previousIndex());
-        assertEquals(0,it.nextIndex());
-        assertEquals("1",it.next());
+        assertEquals(-1, it.previousIndex());
+        assertEquals(0, it.nextIndex());
+        assertEquals("1", it.next());
         assertTrue(it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals(0,it.previousIndex());
-        assertEquals(1,it.nextIndex());
-        assertEquals("2",it.next());
+        assertEquals(0, it.previousIndex());
+        assertEquals(1, it.nextIndex());
+        assertEquals("2", it.next());
         assertTrue(it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals(1,it.previousIndex());
-        assertEquals(2,it.nextIndex());
-        assertEquals("2",it.previous());
+        assertEquals(1, it.previousIndex());
+        assertEquals(2, it.nextIndex());
+        assertEquals("2", it.previous());
         assertTrue(it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals(0,it.previousIndex());
-        assertEquals(1,it.nextIndex());
-        assertEquals("2",it.next());
+        assertEquals(0, it.previousIndex());
+        assertEquals(1, it.nextIndex());
+        assertEquals("2", it.next());
         assertTrue(it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals(1,it.previousIndex());
-        assertEquals(2,it.nextIndex());
-        assertEquals("3",it.next());
+        assertEquals(1, it.previousIndex());
+        assertEquals(2, it.nextIndex());
+        assertEquals("3", it.next());
         assertTrue(it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals(2,it.previousIndex());
-        assertEquals(3,it.nextIndex());
-        assertEquals("4",it.next());
+        assertEquals(2, it.previousIndex());
+        assertEquals(3, it.nextIndex());
+        assertEquals("4", it.next());
         assertTrue(it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals(3,it.previousIndex());
-        assertEquals(4,it.nextIndex());
-        assertEquals("5",it.next());
+        assertEquals(3, it.previousIndex());
+        assertEquals(4, it.nextIndex());
+        assertEquals("5", it.next());
         assertTrue(!it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals(4,it.previousIndex());
-        assertEquals(5,it.nextIndex());
-        assertEquals("5",it.previous());
+        assertEquals(4, it.previousIndex());
+        assertEquals(5, it.nextIndex());
+        assertEquals("5", it.previous());
         assertTrue(it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals(3,it.previousIndex());
-        assertEquals(4,it.nextIndex());
-        assertEquals("4",it.previous());
+        assertEquals(3, it.previousIndex());
+        assertEquals(4, it.nextIndex());
+        assertEquals("4", it.previous());
         assertTrue(it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals(2,it.previousIndex());
-        assertEquals(3,it.nextIndex());
-        assertEquals("3",it.previous());
+        assertEquals(2, it.previousIndex());
+        assertEquals(3, it.nextIndex());
+        assertEquals("3", it.previous());
         assertTrue(it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals(1,it.previousIndex());
-        assertEquals(2,it.nextIndex());
-        assertEquals("2",it.previous());
+        assertEquals(1, it.previousIndex());
+        assertEquals(2, it.nextIndex());
+        assertEquals("2", it.previous());
         assertTrue(it.hasNext());
         assertTrue(it.hasPrevious());
-        assertEquals(0,it.previousIndex());
-        assertEquals(1,it.nextIndex());
-        assertEquals("1",it.previous());
+        assertEquals(0, it.previousIndex());
+        assertEquals(1, it.nextIndex());
+        assertEquals("1", it.previous());
         assertTrue(it.hasNext());
         assertTrue(!it.hasPrevious());
-        assertEquals(-1,it.previousIndex());
-        assertEquals(0,it.nextIndex());
+        assertEquals(-1, it.previousIndex());
+        assertEquals(0, it.nextIndex());
     }
 
+    @SuppressWarnings("unchecked")
     public void testListIteratorSet() {
-        list.add("1");
-        list.add("2");
-        list.add("3");
-        list.add("4");
-        list.add("5");
-
-        ListIterator it = list.listIterator();
-        assertEquals("1",it.next());
-        it.set("a");
-        assertEquals("a",it.previous());
-        it.set("A");
-        assertEquals("A",it.next());
-        assertEquals("2",it.next());
-        it.set("B");
-        assertEquals("3",it.next());
-        assertEquals("4",it.next());
-        it.set("D");
-        assertEquals("5",it.next());
-        it.set("E");
-        assertEquals("[A, B, 3, D, E]",list.toString());
+        list.add((E) "1");
+        list.add((E) "2");
+        list.add((E) "3");
+        list.add((E) "4");
+        list.add((E) "5");
+
+        ListIterator<E> it = list.listIterator();
+        assertEquals("1", it.next());
+        it.set((E) "a");
+        assertEquals("a", it.previous());
+        it.set((E) "A");
+        assertEquals("A", it.next());
+        assertEquals("2", it.next());
+        it.set((E) "B");
+        assertEquals("3", it.next());
+        assertEquals("4", it.next());
+        it.set((E) "D");
+        assertEquals("5", it.next());
+        it.set((E) "E");
+        assertEquals("[A, B, 3, D, E]", list.toString());
     }
 
+    @SuppressWarnings("unchecked")
     public void testListIteratorRemove() {
-        list.add("1");
-        list.add("2");
-        list.add("3");
-        list.add("4");
-        list.add("5");
+        list.add((E) "1");
+        list.add((E) "2");
+        list.add((E) "3");
+        list.add((E) "4");
+        list.add((E) "5");
 
-        ListIterator it = list.listIterator();
+        ListIterator<E> it = list.listIterator();
         try {
             it.remove();
         } catch(IllegalStateException e) {
@@ -1117,274 +1155,287 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         assertEquals("[]",list.toString());
     }
 
+    @SuppressWarnings("unchecked")
     public void testListIteratorAdd() {
-        ListIterator it = list.listIterator();
-        it.add("1");
-        assertEquals("[1]",list.toString());
-        it.add("3");
-        assertEquals("[1, 3]",list.toString());
-        it.add("5");
-        assertEquals("[1, 3, 5]",list.toString());
-        assertEquals("5",it.previous());
-        it.add("4");
-        assertEquals("[1, 3, 4, 5]",list.toString());
-        assertEquals("4",it.previous());
-        assertEquals("3",it.previous());
-        it.add("2");
-        assertEquals("[1, 2, 3, 4, 5]",list.toString());
+        ListIterator<E> it = list.listIterator();
+        it.add((E) "1");
+        assertEquals("[1]", list.toString());
+        it.add((E) "3");
+        assertEquals("[1, 3]", list.toString());
+        it.add((E) "5");
+        assertEquals("[1, 3, 5]", list.toString());
+        assertEquals("5", it.previous());
+        it.add((E) "4");
+        assertEquals("[1, 3, 4, 5]", list.toString());
+        assertEquals("4", it.previous());
+        assertEquals("3", it.previous());
+        it.add((E) "2");
+        assertEquals("[1, 2, 3, 4, 5]", list.toString());
     }
 
+    @SuppressWarnings("unchecked")
     public void testRemoveAll() {
-        list.add("1");
-        list.add("2");
-        list.add("3");
-        list.add("4");
-        list.add("5");
-
-        HashSet set = new HashSet();
-        set.add("A");
-        set.add("2");
-        set.add("C");
-        set.add("4");
-        set.add("D");
+        list.add((E) "1");
+        list.add((E) "2");
+        list.add((E) "3");
+        list.add((E) "4");
+        list.add((E) "5");
+
+        HashSet<E> set = new HashSet<E>();
+        set.add((E) "A");
+        set.add((E) "2");
+        set.add((E) "C");
+        set.add((E) "4");
+        set.add((E) "D");
 
         assertTrue(list.removeAll(set));
-        assertEquals("[1, 3, 5]",list.toString());
+        assertEquals("[1, 3, 5]", list.toString());
         assertTrue(!list.removeAll(set));
     }
 
+    @SuppressWarnings("unchecked")
     public void testRemoveByIndex() {
-        list.add("1");
-        list.add("2");
-        list.add("3");
-        list.add("4");
-        list.add("5");
-        assertEquals("[1, 2, 3, 4, 5]",list.toString());
-        assertEquals("1",list.remove(0));
-        assertEquals("[2, 3, 4, 5]",list.toString());
-        assertEquals("3",list.remove(1));
-        assertEquals("[2, 4, 5]",list.toString());
-        assertEquals("4",list.remove(1));
-        assertEquals("[2, 5]",list.toString());
-        assertEquals("5",list.remove(1));
-        assertEquals("[2]",list.toString());
-        assertEquals("2",list.remove(0));
-        assertEquals("[]",list.toString());
+        list.add((E) "1");
+        list.add((E) "2");
+        list.add((E) "3");
+        list.add((E) "4");
+        list.add((E) "5");
+        assertEquals("[1, 2, 3, 4, 5]", list.toString());
+        assertEquals("1", list.remove(0));
+        assertEquals("[2, 3, 4, 5]", list.toString());
+        assertEquals("3", list.remove(1));
+        assertEquals("[2, 4, 5]", list.toString());
+        assertEquals("4", list.remove(1));
+        assertEquals("[2, 5]", list.toString());
+        assertEquals("5", list.remove(1));
+        assertEquals("[2]", list.toString());
+        assertEquals("2", list.remove(0));
+        assertEquals("[]", list.toString());
     }
 
+    @SuppressWarnings("unchecked")
     public void testRemove() {
-        list.add("1");
-        list.add("1");
-        list.add("2");
-        list.add("3");
-        list.add("4");
-        list.add("5");
-        list.add("2");
-        list.add("3");
-        list.add("4");
-        list.add("5");
-        assertEquals("[1, 1, 2, 3, 4, 5, 2, 3, 4, 5]",list.toString());
+        list.add((E) "1");
+        list.add((E) "1");
+        list.add((E) "2");
+        list.add((E) "3");
+        list.add((E) "4");
+        list.add((E) "5");
+        list.add((E) "2");
+        list.add((E) "3");
+        list.add((E) "4");
+        list.add((E) "5");
+        assertEquals("[1, 1, 2, 3, 4, 5, 2, 3, 4, 5]", list.toString());
         assertTrue(!list.remove("6"));
         assertTrue(list.remove("5"));
-        assertEquals("[1, 1, 2, 3, 4, 2, 3, 4, 5]",list.toString());
+        assertEquals("[1, 1, 2, 3, 4, 2, 3, 4, 5]", list.toString());
         assertTrue(list.remove("5"));
-        assertEquals("[1, 1, 2, 3, 4, 2, 3, 4]",list.toString());
+        assertEquals("[1, 1, 2, 3, 4, 2, 3, 4]", list.toString());
         assertTrue(!list.remove("5"));
         assertTrue(list.remove("1"));
-        assertEquals("[1, 2, 3, 4, 2, 3, 4]",list.toString());
+        assertEquals("[1, 2, 3, 4, 2, 3, 4]", list.toString());
         assertTrue(list.remove("1"));
-        assertEquals("[2, 3, 4, 2, 3, 4]",list.toString());
+        assertEquals("[2, 3, 4, 2, 3, 4]", list.toString());
         assertTrue(list.remove("2"));
-        assertEquals("[3, 4, 2, 3, 4]",list.toString());
+        assertEquals("[3, 4, 2, 3, 4]", list.toString());
         assertTrue(list.remove("2"));
-        assertEquals("[3, 4, 3, 4]",list.toString());
+        assertEquals("[3, 4, 3, 4]", list.toString());
         assertTrue(list.remove("3"));
-        assertEquals("[4, 3, 4]",list.toString());
+        assertEquals("[4, 3, 4]", list.toString());
         assertTrue(list.remove("3"));
-        assertEquals("[4, 4]",list.toString());
+        assertEquals("[4, 4]", list.toString());
         assertTrue(list.remove("4"));
-        assertEquals("[4]",list.toString());
+        assertEquals("[4]", list.toString());
         assertTrue(list.remove("4"));
-        assertEquals("[]",list.toString());
+        assertEquals("[]", list.toString());
     }
 
+    @SuppressWarnings("unchecked")
     public void testRetainAll() {
-        list.add("1");
-        list.add("1");
-        list.add("2");
-        list.add("2");
-        list.add("3");
-        list.add("3");
-        list.add("4");
-        list.add("4");
-        list.add("5");
-        list.add("5");
-
-        HashSet set = new HashSet();
-        set.add("A");
-        set.add("2");
-        set.add("C");
-        set.add("4");
-        set.add("D");
+        list.add((E) "1");
+        list.add((E) "1");
+        list.add((E) "2");
+        list.add((E) "2");
+        list.add((E) "3");
+        list.add((E) "3");
+        list.add((E) "4");
+        list.add((E) "4");
+        list.add((E) "5");
+        list.add((E) "5");
+
+        HashSet<E> set = new HashSet<E>();
+        set.add((E) "A");
+        set.add((E) "2");
+        set.add((E) "C");
+        set.add((E) "4");
+        set.add((E) "D");
 
         assertTrue(list.retainAll(set));
-        assertEquals("[2, 2, 4, 4]",list.toString());
+        assertEquals("[2, 2, 4, 4]", list.toString());
         assertTrue(!list.retainAll(set));
     }
 
+    @SuppressWarnings("unchecked")
     public void testSet() {
-        list.add("1");
-        list.add("2");
-        list.add("3");
-        list.add("4");
-        list.add("5");
-        assertEquals("[1, 2, 3, 4, 5]",list.toString());
-        list.set(0,"A");
-        assertEquals("[A, 2, 3, 4, 5]",list.toString());
-        list.set(1,"B");
-        assertEquals("[A, B, 3, 4, 5]",list.toString());
-        list.set(2,"C");
-        assertEquals("[A, B, C, 4, 5]",list.toString());
-        list.set(3,"D");
-        assertEquals("[A, B, C, D, 5]",list.toString());
-        list.set(4,"E");
-        assertEquals("[A, B, C, D, E]",list.toString());
+        list.add((E) "1");
+        list.add((E) "2");
+        list.add((E) "3");
+        list.add((E) "4");
+        list.add((E) "5");
+        assertEquals("[1, 2, 3, 4, 5]", list.toString());
+        list.set(0, (E) "A");
+        assertEquals("[A, 2, 3, 4, 5]", list.toString());
+        list.set(1, (E) "B");
+        assertEquals("[A, B, 3, 4, 5]", list.toString());
+        list.set(2, (E) "C");
+        assertEquals("[A, B, C, 4, 5]", list.toString());
+        list.set(3, (E) "D");
+        assertEquals("[A, B, C, D, 5]", list.toString());
+        list.set(4, (E) "E");
+        assertEquals("[A, B, C, D, E]", list.toString());
     }
 
+    @SuppressWarnings("unchecked")
     public void testSubList() {
-        list.add("A");
-        list.add("B");
-        list.add("C");
-        list.add("D");
-        list.add("E");
-
-        assertEquals("[A, B, C, D, E]",list.toString());
-        assertEquals("[A, B, C, D, E]",list.subList(0,5).toString());
-        assertEquals("[B, C, D, E]",list.subList(1,5).toString());
-        assertEquals("[C, D, E]",list.subList(2,5).toString());
-        assertEquals("[D, E]",list.subList(3,5).toString());
-        assertEquals("[E]",list.subList(4,5).toString());
-        assertEquals("[]",list.subList(5,5).toString());
+        list.add((E) "A");
+        list.add((E) "B");
+        list.add((E) "C");
+        list.add((E) "D");
+        list.add((E) "E");
+
+        assertEquals("[A, B, C, D, E]", list.toString());
+        assertEquals("[A, B, C, D, E]", list.subList(0, 5).toString());
+        assertEquals("[B, C, D, E]", list.subList(1, 5).toString());
+        assertEquals("[C, D, E]", list.subList(2, 5).toString());
+        assertEquals("[D, E]", list.subList(3, 5).toString());
+        assertEquals("[E]", list.subList(4, 5).toString());
+        assertEquals("[]", list.subList(5, 5).toString());
     }
 
+    @SuppressWarnings("unchecked")
     public void testSubListAddEnd() {
-        list.add("A");
-        list.add("B");
-        list.add("C");
-        list.add("D");
-        list.add("E");
-
-        List sublist = list.subList(5,5);
-        sublist.add("F");
-        assertEquals("[A, B, C, D, E, F]",list.toString());
-        assertEquals("[F]",sublist.toString());
-        sublist.add("G");
-        assertEquals("[A, B, C, D, E, F, G]",list.toString());
-        assertEquals("[F, G]",sublist.toString());
+        list.add((E) "A");
+        list.add((E) "B");
+        list.add((E) "C");
+        list.add((E) "D");
+        list.add((E) "E");
+
+        List<E> sublist = list.subList(5, 5);
+        sublist.add((E) "F");
+        assertEquals("[A, B, C, D, E, F]", list.toString());
+        assertEquals("[F]", sublist.toString());
+        sublist.add((E) "G");
+        assertEquals("[A, B, C, D, E, F, G]", list.toString());
+        assertEquals("[F, G]", sublist.toString());
     }
 
+    @SuppressWarnings("unchecked")
     public void testSubListAddBegin() {
-        list.add("A");
-        list.add("B");
-        list.add("C");
-        list.add("D");
-        list.add("E");
-
-        List sublist = list.subList(0,0);
-        sublist.add("a");
-        assertEquals("[a, A, B, C, D, E]",list.toString());
-        assertEquals("[a]",sublist.toString());
-        sublist.add("b");
-        assertEquals("[a, b, A, B, C, D, E]",list.toString());
-        assertEquals("[a, b]",sublist.toString());
+        list.add((E) "A");
+        list.add((E) "B");
+        list.add((E) "C");
+        list.add((E) "D");
+        list.add((E) "E");
+
+        List<E> sublist = list.subList(0, 0);
+        sublist.add((E) "a");
+        assertEquals("[a, A, B, C, D, E]", list.toString());
+        assertEquals("[a]", sublist.toString());
+        sublist.add((E) "b");
+        assertEquals("[a, b, A, B, C, D, E]", list.toString());
+        assertEquals("[a, b]", sublist.toString());
     }
 
+    @SuppressWarnings("unchecked")
     public void testSubListAddMiddle() {
-        list.add("A");
-        list.add("B");
-        list.add("C");
-        list.add("D");
-        list.add("E");
-
-        List sublist = list.subList(1,3);
-        sublist.add("a");
-        assertEquals("[A, B, C, a, D, E]",list.toString());
-        assertEquals("[B, C, a]",sublist.toString());
-        sublist.add("b");
-        assertEquals("[A, B, C, a, b, D, E]",list.toString());
-        assertEquals("[B, C, a, b]",sublist.toString());
+        list.add((E) "A");
+        list.add((E) "B");
+        list.add((E) "C");
+        list.add((E) "D");
+        list.add((E) "E");
+
+        List<E> sublist = list.subList(1, 3);
+        sublist.add((E) "a");
+        assertEquals("[A, B, C, a, D, E]", list.toString());
+        assertEquals("[B, C, a]", sublist.toString());
+        sublist.add((E) "b");
+        assertEquals("[A, B, C, a, b, D, E]", list.toString());
+        assertEquals("[B, C, a, b]", sublist.toString());
     }
 
+    @SuppressWarnings("unchecked")
     public void testSubListRemove() {
-        list.add("A");
-        list.add("B");
-        list.add("C");
-        list.add("D");
-        list.add("E");
-
-        List sublist = list.subList(1,4);
-        assertEquals("[B, C, D]",sublist.toString());
-        assertEquals("[A, B, C, D, E]",list.toString());
+        list.add((E) "A");
+        list.add((E) "B");
+        list.add((E) "C");
+        list.add((E) "D");
+        list.add((E) "E");
+
+        List<E> sublist = list.subList(1, 4);
+        assertEquals("[B, C, D]", sublist.toString());
+        assertEquals("[A, B, C, D, E]", list.toString());
         sublist.remove("C");
-        assertEquals("[B, D]",sublist.toString());
-        assertEquals("[A, B, D, E]",list.toString());
+        assertEquals("[B, D]", sublist.toString());
+        assertEquals("[A, B, D, E]", list.toString());
         sublist.remove(1);
-        assertEquals("[B]",sublist.toString());
-        assertEquals("[A, B, E]",list.toString());
+        assertEquals("[B]", sublist.toString());
+        assertEquals("[A, B, E]", list.toString());
         sublist.clear();
-        assertEquals("[]",sublist.toString());
-        assertEquals("[A, E]",list.toString());
+        assertEquals("[]", sublist.toString());
+        assertEquals("[A, E]", list.toString());
     }
 
+    @SuppressWarnings("unchecked")
     public void testToArray() {
-        list.add("1");
-        list.add("2");
-        list.add("3");
-        list.add("4");
-        list.add("5");
+        list.add((E) "1");
+        list.add((E) "2");
+        list.add((E) "3");
+        list.add((E) "4");
+        list.add((E) "5");
 
         Object[] elts = list.toArray();
-        assertEquals("1",elts[0]);
-        assertEquals("2",elts[1]);
-        assertEquals("3",elts[2]);
-        assertEquals("4",elts[3]);
-        assertEquals("5",elts[4]);
-        assertEquals(5,elts.length);
-
-        String[] elts2 = (String[])(list.toArray(new String[0]));
-        assertEquals("1",elts2[0]);
-        assertEquals("2",elts2[1]);
-        assertEquals("3",elts2[2]);
-        assertEquals("4",elts2[3]);
-        assertEquals("5",elts2[4]);
-        assertEquals(5,elts2.length);
+        assertEquals("1", elts[0]);
+        assertEquals("2", elts[1]);
+        assertEquals("3", elts[2]);
+        assertEquals("4", elts[3]);
+        assertEquals("5", elts[4]);
+        assertEquals(5, elts.length);
+
+        String[] elts2 = (String[]) (list.toArray(new String[0]));
+        assertEquals("1", elts2[0]);
+        assertEquals("2", elts2[1]);
+        assertEquals("3", elts2[2]);
+        assertEquals("4", elts2[3]);
+        assertEquals("5", elts2[4]);
+        assertEquals(5, elts2.length);
 
         String[] elts3 = new String[5];
-        assertSame(elts3,list.toArray(elts3));
-        assertEquals("1",elts3[0]);
-        assertEquals("2",elts3[1]);
-        assertEquals("3",elts3[2]);
-        assertEquals("4",elts3[3]);
-        assertEquals("5",elts3[4]);
-        assertEquals(5,elts3.length);
+        assertSame(elts3, list.toArray(elts3));
+        assertEquals("1", elts3[0]);
+        assertEquals("2", elts3[1]);
+        assertEquals("3", elts3[2]);
+        assertEquals("4", elts3[3]);
+        assertEquals("5", elts3[4]);
+        assertEquals(5, elts3.length);
 
         String[] elts4 = new String[3];
-        String[] elts4b = (String[])(list.toArray(elts4));
+        String[] elts4b = (String[]) (list.toArray(elts4));
         assertTrue(elts4 != elts4b);
-        assertEquals("1",elts4b[0]);
-        assertEquals("2",elts4b[1]);
-        assertEquals("3",elts4b[2]);
-        assertEquals("4",elts4b[3]);
-        assertEquals("5",elts4b[4]);
-        assertEquals(5,elts4b.length);
+        assertEquals("1", elts4b[0]);
+        assertEquals("2", elts4b[1]);
+        assertEquals("3", elts4b[2]);
+        assertEquals("4", elts4b[3]);
+        assertEquals("5", elts4b[4]);
+        assertEquals(5, elts4b.length);
     }
 
+    @SuppressWarnings("unchecked")
     public void testSerialization() throws Exception {
-        list.add("A");
-        list.add("B");
-        list.add("C");
-        list.add("D");
-        list.add("E");
+        list.add((E) "A");
+        list.add((E) "B");
+        list.add((E) "C");
+        list.add((E) "D");
+        list.add((E) "E");
 
         java.io.ByteArrayOutputStream buf = new java.io.ByteArrayOutputStream();
         java.io.ObjectOutputStream out = new java.io.ObjectOutputStream(buf);
@@ -1401,14 +1452,13 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         assertTrue(list.equals(list2));
     }
 
+    @SuppressWarnings("unchecked")
     public void testSerializationWithOpenCursor() throws Exception {
-        list.add("A");
-        list.add("B");
-        list.add("C");
-        list.add("D");
-        list.add("E");
-        CursorableLinkedList.Cursor cursor = list.cursor();
-
+        list.add((E) "A");
+        list.add((E) "B");
+        list.add((E) "C");
+        list.add((E) "D");
+        list.add((E) "E");
         java.io.ByteArrayOutputStream buf = new java.io.ByteArrayOutputStream();
         java.io.ObjectOutputStream out = new java.io.ObjectOutputStream(buf);
         out.writeObject(list);
@@ -1424,11 +1474,12 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         assertTrue(list.equals(list2));
     }
 
+    @SuppressWarnings("unchecked")
     public void testLongSerialization() throws Exception {
         // recursive serialization will cause a stack
         // overflow exception with long lists
-        for(int i=0;i<10000;i++) {
-            list.add(new Integer(i));
+        for (int i = 0; i < 10000; i++) {
+            list.add((E) new Integer(i));
         }
 
         java.io.ByteArrayOutputStream buf = new java.io.ByteArrayOutputStream();
@@ -1446,31 +1497,30 @@ public class TestCursorableLinkedList extends TestAbstractLinkedList {
         assertTrue(list.equals(list2));
     }
 
-
     /**
      *  Ignore the serialization tests for sublists and sub-sublists.
      *
-     *  @return an array of sublist serialization test names 
+     *  @return an array of sublist serialization test names
      */
     public String[] ignoredTests() {
-        ArrayList list = new ArrayList();
+        ArrayList<String> list = new ArrayList<String>();
         String prefix = "TestCursorableLinkedList";
         String bulk = ".bulkTestSubList";
         String[] ignored = new String[] {
-          ".testEmptyListSerialization",
-          ".testFullListSerialization", 
-          ".testEmptyListCompatibility", 
-          ".testFullListCompatibility", 
-          ".testSimpleSerialization",
-          ".testCanonicalEmptyCollectionExists",
-          ".testCanonicalFullCollectionExists",
-          ".testSerializeDeserializeThenCompare"
+                ".testEmptyListSerialization",
+                ".testFullListSerialization",
+                ".testEmptyListCompatibility",
+                ".testFullListCompatibility",
+                ".testSimpleSerialization",
+                ".testCanonicalEmptyCollectionExists",
+                ".testCanonicalFullCollectionExists",
+                ".testSerializeDeserializeThenCompare"
         };
         for (int i = 0; i < ignored.length; i++) {
             list.add(prefix + bulk + ignored[i]);
             list.add(prefix + bulk + bulk + ignored[i]);
         }
-        return (String[])list.toArray(new String[0]);
+        return (String[]) list.toArray(new String[0]);
     }
 
     public String getCompatibilityVersion() {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/list/TestFixedSizeList.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/list/TestFixedSizeList.java b/src/test/org/apache/commons/collections/list/TestFixedSizeList.java
index 811a829..7e15952 100644
--- a/src/test/org/apache/commons/collections/list/TestFixedSizeList.java
+++ b/src/test/org/apache/commons/collections/list/TestFixedSizeList.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,10 +29,10 @@ import junit.framework.TestSuite;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestFixedSizeList extends AbstractTestList {
+public class TestFixedSizeList<E> extends AbstractTestList<E> {
 
     public TestFixedSizeList(String testName) {
         super(testName);
@@ -47,16 +47,16 @@ public class TestFixedSizeList extends AbstractTestList {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public List makeEmptyList() {
-        return FixedSizeList.decorate(new ArrayList());
+    public List<E> makeObject() {
+        return FixedSizeList.decorate(new ArrayList<E>());
     }
 
-    public List makeFullList() {
-        List list = new ArrayList();
+    public List<E> makeFullCollection() {
+        List<E> list = new ArrayList<E>();
         list.addAll(Arrays.asList(getFullElements()));
         return FixedSizeList.decorate(list);
     }
-    
+
     public boolean isAddSupported() {
         return false;
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/list/TestGrowthList.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/list/TestGrowthList.java b/src/test/org/apache/commons/collections/list/TestGrowthList.java
index 22af210..1b6e1a7 100644
--- a/src/test/org/apache/commons/collections/list/TestGrowthList.java
+++ b/src/test/org/apache/commons/collections/list/TestGrowthList.java
@@ -32,7 +32,7 @@ import junit.framework.TestSuite;
  * 
  * @author Stephen Colebourne
  */
-public class TestGrowthList extends AbstractTestList {
+public class TestGrowthList<E> extends AbstractTestList<E> {
 
     public TestGrowthList(String testName) {
         super(testName);
@@ -47,12 +47,12 @@ public class TestGrowthList extends AbstractTestList {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public List makeEmptyList() {
-        return new GrowthList();
+    public List<E> makeObject() {
+        return new GrowthList<E>();
     }
 
-    public List makeFullList() {
-        List list = new ArrayList();
+    public List<E> makeFullCollection() {
+        List<E> list = new ArrayList<E>();
         list.addAll(Arrays.asList(getFullElements()));
         return GrowthList.decorate(list);
     }
@@ -60,7 +60,7 @@ public class TestGrowthList extends AbstractTestList {
     //-----------------------------------------------------------------------
     public void testGrowthAdd() {
         Integer one = new Integer(1);
-        GrowthList grower = new GrowthList();
+        GrowthList<Integer> grower = new GrowthList<Integer>();
         assertEquals(0, grower.size());
         grower.add(1, one);
         assertEquals(2, grower.size());
@@ -71,10 +71,10 @@ public class TestGrowthList extends AbstractTestList {
     public void testGrowthAddAll() {
         Integer one = new Integer(1);
         Integer two = new Integer(2);
-        Collection coll = new ArrayList();
+        Collection<Integer> coll = new ArrayList<Integer>();
         coll.add(one);
         coll.add(two);
-        GrowthList grower = new GrowthList();
+        GrowthList<Integer> grower = new GrowthList<Integer>();
         assertEquals(0, grower.size());
         grower.addAll(1, coll);
         assertEquals(3, grower.size());
@@ -85,7 +85,7 @@ public class TestGrowthList extends AbstractTestList {
 
     public void testGrowthSet1() {
         Integer one = new Integer(1);
-        GrowthList grower = new GrowthList();
+        GrowthList<Integer> grower = new GrowthList<Integer>();
         assertEquals(0, grower.size());
         grower.set(1, one);
         assertEquals(2, grower.size());
@@ -95,7 +95,7 @@ public class TestGrowthList extends AbstractTestList {
 
     public void testGrowthSet2() {
         Integer one = new Integer(1);
-        GrowthList grower = new GrowthList();
+        GrowthList<Integer> grower = new GrowthList<Integer>();
         assertEquals(0, grower.size());
         grower.set(0, one);
         assertEquals(1, grower.size());
@@ -107,10 +107,10 @@ public class TestGrowthList extends AbstractTestList {
      * Override.
      */
     public void testListAddByIndexBoundsChecking() {
-        List list;
-        Object element = getOtherElements()[0];
+        List<E> list;
+        E element = getOtherElements()[0];
         try {
-            list = makeEmptyList();
+            list = makeObject();
             list.add(-1, element);
             fail("List.add should throw IndexOutOfBoundsException [-1]");
         } catch (IndexOutOfBoundsException e) {
@@ -122,10 +122,10 @@ public class TestGrowthList extends AbstractTestList {
      * Override.
      */
     public void testListAddByIndexBoundsChecking2() {
-        List list;
-        Object element = getOtherElements()[0];
+        List<E> list;
+        E element = getOtherElements()[0];
         try {
-            list = makeFullList();
+            list = makeFullCollection();
             list.add(-1, element);
             fail("List.add should throw IndexOutOfBoundsException [-1]");
         } catch (IndexOutOfBoundsException e) {
@@ -137,8 +137,8 @@ public class TestGrowthList extends AbstractTestList {
      * Override.
      */
     public void testListSetByIndexBoundsChecking() {
-        List list = makeEmptyList();
-        Object element = getOtherElements()[0];
+        List<E> list = makeObject();
+        E element = getOtherElements()[0];
         try {
             list.set(-1, element);
             fail("List.set should throw IndexOutOfBoundsException [-1]");
@@ -151,8 +151,8 @@ public class TestGrowthList extends AbstractTestList {
      * Override.
      */
     public void testListSetByIndexBoundsChecking2() {
-        List list = makeFullList();
-        Object element = getOtherElements()[0];
+        List<E> list = makeFullCollection();
+        E element = getOtherElements()[0];
         try {
             list.set(-1, element);
             fail("List.set should throw IndexOutOfBoundsException [-1]");

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/list/TestNodeCachingLinkedList.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/list/TestNodeCachingLinkedList.java b/src/test/org/apache/commons/collections/list/TestNodeCachingLinkedList.java
index 689560a..a464896 100644
--- a/src/test/org/apache/commons/collections/list/TestNodeCachingLinkedList.java
+++ b/src/test/org/apache/commons/collections/list/TestNodeCachingLinkedList.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.list;
 
 import java.util.Arrays;
 import java.util.LinkedList;
-import java.util.List;
 
 import junit.framework.Test;
 
@@ -26,13 +25,13 @@ import org.apache.commons.collections.BulkTest;
 
 /**
  * Test class for NodeCachingLinkedList, a performance optimised LinkedList.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Jeff Varszegi
  * @author Phil Steitz
  */
-public class TestNodeCachingLinkedList extends TestAbstractLinkedList {
+public class TestNodeCachingLinkedList<E> extends TestAbstractLinkedList<E> {
 
     public TestNodeCachingLinkedList(String testName) {
         super(testName);
@@ -48,49 +47,50 @@ public class TestNodeCachingLinkedList extends TestAbstractLinkedList {
         return BulkTest.makeSuite(TestNodeCachingLinkedList.class);
     }
 
-    //-----------------------------------------------------------------------    
-    public List makeEmptyList() {
-        return new NodeCachingLinkedList();
+    //-----------------------------------------------------------------------
+    public NodeCachingLinkedList<E> makeObject() {
+        return new NodeCachingLinkedList<E>();
     }
 
     public String getCompatibilityVersion() {
         return "3";
     }
-    
+
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testShrinkCache() {
         if (isRemoveSupported() == false || isAddSupported() == false) return;
         resetEmpty();
-        NodeCachingLinkedList list = (NodeCachingLinkedList) collection;
-        
-        list.addAll( Arrays.asList( new String[]{"1", "2", "3", "4"}));
-        list.removeAllNodes();        // Will dump all 4 elements into cache
-        ((NodeCachingLinkedList) list).setMaximumCacheSize(2); // shrink cache
-        list.addAll( Arrays.asList( new String[]{"1", "2", "3", "4"}));
+        NodeCachingLinkedList<E> list = getCollection();
+
+        list.addAll(Arrays.asList((E[]) new String[] { "1", "2", "3", "4" }));
+        list.removeAllNodes(); // Will dump all 4 elements into cache
+        list.setMaximumCacheSize(2); // shrink cache
+        list.addAll(Arrays.asList((E[]) new String[] { "1", "2", "3", "4" }));
         checkNodes();
         list.removeNode(list.getNode(0, false)); // no room in cache
-        list.removeNode(list.getNode(0, false)); 
-        list.removeNode(list.getNode(0, false)); 
-        checkNodes();    
-        list.addAll( Arrays.asList( new String[]{"1", "2", "3", "4"}));
-        checkNodes();     
-    }       
-    
+        list.removeNode(list.getNode(0, false));
+        list.removeNode(list.getNode(0, false));
+        checkNodes();
+        list.addAll(Arrays.asList((E[]) new String[] { "1", "2", "3", "4" }));
+        checkNodes();
+    }
+
     //-----------------------------------------------------------------------
     public static void compareSpeed() {
-        NodeCachingLinkedList ncll = new NodeCachingLinkedList();
-        LinkedList ll = new LinkedList();
-        
+        NodeCachingLinkedList<Object> ncll = new NodeCachingLinkedList<Object>();
+        LinkedList<Object> ll = new LinkedList<Object>();
+
         Object o1 = new Object();
         Object o2 = new Object();
-        
+
         int loopCount = 4000000;
-        
+
         long startTime, endTime;
-        
+
         System.out.println("Testing relative execution time of commonly-used methods...");
-        
-        startTime = System.currentTimeMillis();   
+
+        startTime = System.currentTimeMillis();
         for(int x = loopCount; x > 0; x--) {
             // unrolled a few times to minimize effect of loop
             ll.addFirst(o1);
@@ -114,10 +114,10 @@ public class TestNodeCachingLinkedList extends TestAbstractLinkedList {
             ll.add(o1);
             ll.remove(0);
         }
-        endTime = System.currentTimeMillis();   
+        endTime = System.currentTimeMillis();
         System.out.println("Time with LinkedList: " + (endTime - startTime) + " ms");
 
-        startTime = System.currentTimeMillis();   
+        startTime = System.currentTimeMillis();
         for(int x = loopCount; x > 0; x--) {
             ncll.addFirst(o1);
             ncll.addLast(o2);
@@ -140,11 +140,11 @@ public class TestNodeCachingLinkedList extends TestAbstractLinkedList {
             ncll.add(o1);
             ncll.remove(0);
         }
-        endTime = System.currentTimeMillis();   
+        endTime = System.currentTimeMillis();
         System.out.println("Time with NodeCachingLinkedList: " + (endTime - startTime) + " ms");
 
     }
-    
+
 //    public void testCreate() throws Exception {
 //        resetEmpty();
 //        writeExternalFormToDisk((java.io.Serializable) collection,
@@ -153,4 +153,12 @@ public class TestNodeCachingLinkedList extends TestAbstractLinkedList {
 //        writeExternalFormToDisk((java.io.Serializable) collection,
 //            "D:/dev/collections/data/test/NodeCachingLinkedList.fullCollection.version3.obj");
 //    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public NodeCachingLinkedList<E> getCollection() {
+        return (NodeCachingLinkedList<E>) super.getCollection();
+    }
 }


[05/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/AbstractTestMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/AbstractTestMap.java b/src/test/org/apache/commons/collections/map/AbstractTestMap.java
index b2bb938..47155f3 100644
--- a/src/test/org/apache/commons/collections/map/AbstractTestMap.java
+++ b/src/test/org/apache/commons/collections/map/AbstractTestMap.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,6 +24,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.Map.Entry;
 
 import org.apache.commons.collections.AbstractTestObject;
 import org.apache.commons.collections.BulkTest;
@@ -45,7 +46,7 @@ import org.apache.commons.collections.set.AbstractTestSet;
  * <b>Entry Population Methods</b>
  * <p>
  * Override these methods if your map requires special entries:
- * 
+ *
  * <ul>
  * <li>{@link #getSampleKeys()}
  * <li>{@link #getSampleValues()}
@@ -85,14 +86,14 @@ import org.apache.commons.collections.set.AbstractTestSet;
  * The upshot of all that is that <I>any</I> test that modifies the map in
  * <I>any</I> way will verify that <I>all</I> of the map's state is still
  * correct, including the state of its collection views.  So for instance
- * if a key is removed by the map's key set's iterator, then the entry set 
+ * if a key is removed by the map's key set's iterator, then the entry set
  * is checked to make sure the key/value pair no longer appears.<P>
  *
  * The {@link #map} field holds an instance of your collection implementation.
  * The {@link #entrySet}, {@link #keySet} and {@link #values} fields hold
  * that map's collection views.  And the {@link #confirmed} field holds
- * an instance of the confirmed collection implementation.  The 
- * {@link #resetEmpty()} and {@link #resetFull()} methods set these fields to 
+ * an instance of the confirmed collection implementation.  The
+ * {@link #resetEmpty()} and {@link #resetFull()} methods set these fields to
  * empty or full maps, so that tests can proceed from a known state.<P>
  *
  * After a modification operation to both {@link #map} and {@link #confirmed},
@@ -104,7 +105,7 @@ import org.apache.commons.collections.set.AbstractTestSet;
  * instance, TestDoubleOrderedMap would want override its
  * {@link #verifyValues()} method to verify that the values are unique and in
  * ascending order.<P>
- *  
+ *
  * <b>Other Notes</b>
  * <p>
  * If your {@link Map} fails one of these tests by design, you may still use
@@ -119,7 +120,7 @@ import org.apache.commons.collections.set.AbstractTestSet;
  * @author Stephen Colebourne
  * @version $Revision$ $Date$
  */
-public abstract class AbstractTestMap extends AbstractTestObject {
+public abstract class AbstractTestMap<K, V> extends AbstractTestObject {
 
     /**
      * JDK1.2 has bugs in null handling of Maps, especially HashMap.Entry.toString
@@ -132,32 +133,31 @@ public abstract class AbstractTestMap extends AbstractTestObject {
     }
 
     // These instance variables are initialized with the reset method.
-    // Tests for map methods that alter the map (put, putAll, remove) 
+    // Tests for map methods that alter the map (put, putAll, remove)
     // first call reset() to create the map and its views; then perform
     // the modification on the map; perform the same modification on the
     // confirmed; and then call verify() to ensure that the map is equal
     // to the confirmed, that the already-constructed collection views
     // are still equal to the confirmed's collection views.
 
-
     /** Map created by reset(). */
-    protected Map map;
+    protected Map<K, V> map;
 
     /** Entry set of map created by reset(). */
-    protected Set entrySet;
+    protected Set<Map.Entry<K, V>> entrySet;
 
     /** Key set of map created by reset(). */
-    protected Set keySet;
+    protected Set<K> keySet;
 
     /** Values collection of map created by reset(). */
-    protected Collection values;
+    protected Collection<V> values;
 
     /** HashMap created by reset(). */
-    protected Map confirmed;
+    protected Map<K, V> confirmed;
 
     /**
      * JUnit constructor.
-     * 
+     *
      * @param testName  the test name
      */
     public AbstractTestMap(String testName) {
@@ -165,7 +165,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
     }
 
     /**
-     * Returns true if the maps produced by 
+     * Returns true if the maps produced by
      * {@link #makeEmptyMap()} and {@link #makeFullMap()}
      * support the <code>put</code> and <code>putAll</code> operations
      * adding new mappings.
@@ -178,7 +178,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
     }
 
     /**
-     * Returns true if the maps produced by 
+     * Returns true if the maps produced by
      * {@link #makeEmptyMap()} and {@link #makeFullMap()}
      * support the <code>put</code> and <code>putAll</code> operations
      * changing existing mappings.
@@ -191,7 +191,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
     }
 
     /**
-     * Returns true if the maps produced by 
+     * Returns true if the maps produced by
      * {@link #makeEmptyMap()} and {@link #makeFullMap()}
      * support the <code>setValue</code> operation on entrySet entries.
      * <p>
@@ -204,7 +204,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
     }
 
     /**
-     * Returns true if the maps produced by 
+     * Returns true if the maps produced by
      * {@link #makeEmptyMap()} and {@link #makeFullMap()}
      * support the <code>remove</code> and <code>clear</code> operations.
      * <p>
@@ -216,7 +216,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
     }
 
     /**
-     * Returns true if the maps produced by 
+     * Returns true if the maps produced by
      * {@link #makeEmptyMap()} and {@link #makeFullMap()}
      * can cause structural modification on a get(). The example is LRUMap.
      * <p>
@@ -231,7 +231,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
      * Returns whether the sub map views of SortedMap are serializable.
      * If the class being tested is based around a TreeMap then you should
      * override and return false as TreeMap has a bug in deserialization.
-     * 
+     *
      * @return false
      */
     public boolean isSubMapViewsSerializable() {
@@ -239,7 +239,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
     }
 
     /**
-     * Returns true if the maps produced by 
+     * Returns true if the maps produced by
      * {@link #makeEmptyMap()} and {@link #makeFullMap()}
      * supports null keys.
      * <p>
@@ -251,7 +251,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
     }
 
     /**
-     * Returns true if the maps produced by 
+     * Returns true if the maps produced by
      * {@link #makeEmptyMap()} and {@link #makeFullMap()}
      * supports null values.
      * <p>
@@ -263,7 +263,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
     }
 
     /**
-     * Returns true if the maps produced by 
+     * Returns true if the maps produced by
      * {@link #makeEmptyMap()} and {@link #makeFullMap()}
      * supports duplicate values.
      * <p>
@@ -281,24 +281,26 @@ public abstract class AbstractTestMap extends AbstractTestObject {
      *  default implementation constructs a set of String keys, and includes a
      *  single null key if {@link #isAllowNullKey()} returns <code>true</code>.
      */
-    public Object[] getSampleKeys() {
+    @SuppressWarnings("unchecked")
+    public K[] getSampleKeys() {
         Object[] result = new Object[] {
-            "blah", "foo", "bar", "baz", "tmp", "gosh", "golly", "gee", 
+            "blah", "foo", "bar", "baz", "tmp", "gosh", "golly", "gee",
             "hello", "goodbye", "we'll", "see", "you", "all", "again",
             "key",
             "key2",
             (isAllowNullKey() && !JDK12) ? null : "nonnullkey"
         };
-        return result;
+        return (K[]) result;
     }
 
-
-    public Object[] getOtherKeys() {
-        return getOtherNonNullStringElements();
+    @SuppressWarnings("unchecked")
+    public K[] getOtherKeys() {
+        return (K[]) getOtherNonNullStringElements();
     }
 
-    public Object[] getOtherValues() {
-        return getOtherNonNullStringElements();
+    @SuppressWarnings("unchecked")
+    public V[] getOtherValues() {
+        return (V[]) getOtherNonNullStringElements();
     }
 
     /**
@@ -320,12 +322,13 @@ public abstract class AbstractTestMap extends AbstractTestObject {
      * Returns the set of values in the mappings used to test the map.  This
      * method must return an array with the same length as
      * {@link #getSampleKeys()}.  The default implementation constructs a set of
-     * String values and includes a single null value if 
+     * String values and includes a single null value if
      * {@link #isAllowNullValue()} returns <code>true</code>, and includes
      * two values that are the same if {@link #isAllowDuplicateValues()} returns
      * <code>true</code>.
      */
-    public Object[] getSampleValues() {
+    @SuppressWarnings("unchecked")
+    public V[] getSampleValues() {
         Object[] result = new Object[] {
             "blahv", "foov", "barv", "bazv", "tmpv", "goshv", "gollyv", "geev",
             "hellov", "goodbyev", "we'llv", "seev", "youv", "allv", "againv",
@@ -333,7 +336,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
             "value",
             (isAllowDuplicateValues()) ? "value" : "value2",
         };
-        return result;
+        return (V[]) result;
     }
 
     /**
@@ -345,45 +348,46 @@ public abstract class AbstractTestMap extends AbstractTestObject {
      * set of String values and includes a single null value if
      * {@link #isAllowNullValue()} returns <code>true</code>, and includes two values
      * that are the same if {@link #isAllowDuplicateValues()} returns
-     * <code>true</code>.  
+     * <code>true</code>.
      */
-    public Object[] getNewSampleValues() {
+    @SuppressWarnings("unchecked")
+    public V[] getNewSampleValues() {
         Object[] result = new Object[] {
             (isAllowNullValue() && !JDK12 && isAllowDuplicateValues()) ? null : "newnonnullvalue",
             "newvalue",
             (isAllowDuplicateValues()) ? "newvalue" : "newvalue2",
-            "newblahv", "newfoov", "newbarv", "newbazv", "newtmpv", "newgoshv", 
-            "newgollyv", "newgeev", "newhellov", "newgoodbyev", "newwe'llv", 
+            "newblahv", "newfoov", "newbarv", "newbazv", "newtmpv", "newgoshv",
+            "newgollyv", "newgeev", "newhellov", "newgoodbyev", "newwe'llv",
             "newseev", "newyouv", "newallv", "newagainv",
         };
-        return result;
+        return (V[]) result;
     }
 
     /**
      *  Helper method to add all the mappings described by
      * {@link #getSampleKeys()} and {@link #getSampleValues()}.
      */
-    public void addSampleMappings(Map m) {
+    public void addSampleMappings(Map<? super K, ? super V> m) {
 
-        Object[] keys = getSampleKeys();
-        Object[] values = getSampleValues();
-        
-        for(int i = 0; i < keys.length; i++) {
+        K[] keys = getSampleKeys();
+        V[] values = getSampleValues();
+
+        for (int i = 0; i < keys.length; i++) {
             try {
                 m.put(keys[i], values[i]);
             } catch (NullPointerException exception) {
                 assertTrue("NullPointerException only allowed to be thrown " +
-                           "if either the key or value is null.", 
+                           "if either the key or value is null.",
                            keys[i] == null || values[i] == null);
-                
+
                 assertTrue("NullPointerException on null key, but " +
-                           "isAllowNullKey is not overridden to return false.", 
+                           "isAllowNullKey is not overridden to return false.",
                            keys[i] == null || !isAllowNullKey());
-                
+
                 assertTrue("NullPointerException on null value, but " +
                            "isAllowNullValue is not overridden to return false.",
                            values[i] == null || !isAllowNullValue());
-                
+
                 assertTrue("Unknown reason for NullPointer.", false);
             }
         }
@@ -393,11 +397,11 @@ public abstract class AbstractTestMap extends AbstractTestObject {
 
     //-----------------------------------------------------------------------
     /**
-     * Return a new, empty {@link Map} to be used for testing. 
-     * 
+     * Return a new, empty {@link Map} to be used for testing.
+     *
      * @return the map to be tested
      */
-    public abstract <K,V> Map<K,V> makeEmptyMap();
+    public abstract Map<K,V> makeObject();
 
     /**
      * Return a new, populated map.  The mappings in the map should match the
@@ -405,40 +409,31 @@ public abstract class AbstractTestMap extends AbstractTestObject {
      * {@link #getSampleValues()}.  The default implementation uses makeEmptyMap()
      * and calls {@link #addSampleMappings} to add all the mappings to the
      * map.
-     * 
+     *
      * @return the map to be tested
      */
-    public Map makeFullMap() {
-        Map m = makeEmptyMap();
+    public Map<K, V> makeFullMap() {
+        Map<K, V> m = makeObject();
         addSampleMappings(m);
         return m;
     }
 
     /**
-     * Implements the superclass method to return the map to be tested.
-     * 
-     * @return the map to be tested
-     */
-    public Object makeObject() {
-        return makeEmptyMap();
-    }
-
-    /**
      * Override to return a map other than HashMap as the confirmed map.
-     * 
+     *
      * @return a map that is known to be valid
      */
-    public Map makeConfirmedMap() {
-        return new HashMap();
+    public Map<K, V> makeConfirmedMap() {
+        return new HashMap<K, V>();
     }
 
     /**
      * Creates a new Map Entry that is independent of the first and the map.
      */
-    public Map.Entry cloneMapEntry(Map.Entry entry) {
-        HashMap map = new HashMap();
+    public static <K, V> Map.Entry<K, V> cloneMapEntry(Map.Entry<K, V> entry) {
+        HashMap<K, V> map = new HashMap<K, V>();
         map.put(entry.getKey(), entry.getValue());
-        return (Map.Entry) map.entrySet().iterator().next();
+        return map.entrySet().iterator().next();
     }
 
     /**
@@ -447,6 +442,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
     public String getCompatibilityVersion() {
         return super.getCompatibilityVersion();
     }
+
     //-----------------------------------------------------------------------
     /**
      * Test to ensure the test setup is working properly.  This method checks
@@ -456,75 +452,76 @@ public abstract class AbstractTestMap extends AbstractTestObject {
      * duplicate values, and may only contain a (single) null key if
      * isNullKeySupported() returns true.  The values array must only have a null
      * value if useNullValue() is true and may only have duplicate values if
-     * isAllowDuplicateValues() returns true.  
+     * isAllowDuplicateValues() returns true.
      */
     public void testSampleMappings() {
-      Object[] keys = getSampleKeys();
-      Object[] values = getSampleValues();
-      Object[] newValues = getNewSampleValues();
+        Object[] keys = getSampleKeys();
+        Object[] values = getSampleValues();
+        Object[] newValues = getNewSampleValues();
 
-      assertTrue("failure in test: Must have keys returned from " +
+        assertTrue("failure in test: Must have keys returned from " +
                  "getSampleKeys.", keys != null);
 
-      assertTrue("failure in test: Must have values returned from " +
+        assertTrue("failure in test: Must have values returned from " +
                  "getSampleValues.", values != null);
 
-      // verify keys and values have equivalent lengths (in case getSampleX are
-      // overridden)
-      assertEquals("failure in test: not the same number of sample " +
+        // verify keys and values have equivalent lengths (in case getSampleX are
+        // overridden)
+        assertEquals("failure in test: not the same number of sample " +
                    "keys and values.",  keys.length, values.length);
-      
-      assertEquals("failure in test: not the same number of values and new values.",
+
+        assertEquals("failure in test: not the same number of values and new values.",
                    values.length, newValues.length);
 
-      // verify there aren't duplicate keys, and check values
-      for(int i = 0; i < keys.length - 1; i++) {
-          for(int j = i + 1; j < keys.length; j++) {
-              assertTrue("failure in test: duplicate null keys.",
-                         (keys[i] != null || keys[j] != null));
-              assertTrue("failure in test: duplicate non-null key.",
-                         (keys[i] == null || keys[j] == null || 
-                          (!keys[i].equals(keys[j]) && 
-                           !keys[j].equals(keys[i]))));
-          }
-          assertTrue("failure in test: found null key, but isNullKeySupported " +
-                     "is false.", keys[i] != null || isAllowNullKey());
-          assertTrue("failure in test: found null value, but isNullValueSupported " +
-                     "is false.", values[i] != null || isAllowNullValue());
-          assertTrue("failure in test: found null new value, but isNullValueSupported " +
-                     "is false.", newValues[i] != null || isAllowNullValue());
-          assertTrue("failure in test: values should not be the same as new value",
-                     values[i] != newValues[i] && 
-                     (values[i] == null || !values[i].equals(newValues[i])));
-      }
+        // verify there aren't duplicate keys, and check values
+        for (int i = 0; i < keys.length - 1; i++) {
+            for (int j = i + 1; j < keys.length; j++) {
+                assertTrue("failure in test: duplicate null keys.",
+                        (keys[i] != null || keys[j] != null));
+                assertTrue(
+                        "failure in test: duplicate non-null key.",
+                        (keys[i] == null || keys[j] == null || (!keys[i].equals(keys[j]) && !keys[j]
+                                .equals(keys[i]))));
+            }
+            assertTrue("failure in test: found null key, but isNullKeySupported " + "is false.",
+                    keys[i] != null || isAllowNullKey());
+            assertTrue(
+                    "failure in test: found null value, but isNullValueSupported " + "is false.",
+                    values[i] != null || isAllowNullValue());
+            assertTrue("failure in test: found null new value, but isNullValueSupported "
+                    + "is false.", newValues[i] != null || isAllowNullValue());
+            assertTrue("failure in test: values should not be the same as new value",
+                    values[i] != newValues[i]
+                            && (values[i] == null || !values[i].equals(newValues[i])));
+        }
     }
-    
+
     // tests begin here.  Each test adds a little bit of tested functionality.
     // Many methods assume previous methods passed.  That is, they do not
     // exhaustively recheck things that have already been checked in a previous
-    // test methods.  
+    // test methods.
 
     /**
      * Test to ensure that makeEmptyMap and makeFull returns a new non-null
-     * map with each invocation.  
+     * map with each invocation.
      */
     public void testMakeMap() {
-        Map em = makeEmptyMap();
+        Map<K, V> em = makeObject();
         assertTrue("failure in test: makeEmptyMap must return a non-null map.",
                    em != null);
-        
-        Map em2 = makeEmptyMap();
+
+        Map<K, V> em2 = makeObject();
         assertTrue("failure in test: makeEmptyMap must return a non-null map.",
                    em != null);
 
         assertTrue("failure in test: makeEmptyMap must return a new map " +
                    "with each invocation.", em != em2);
 
-        Map fm = makeFullMap();
+        Map<K, V> fm = makeFullMap();
         assertTrue("failure in test: makeFullMap must return a non-null map.",
                    fm != null);
-        
-        Map fm2 = makeFullMap();
+
+        Map<K, V> fm2 = makeFullMap();
         assertTrue("failure in test: makeFullMap must return a non-null map.",
                    fm != null);
 
@@ -537,13 +534,13 @@ public abstract class AbstractTestMap extends AbstractTestObject {
      */
     public void testMapIsEmpty() {
         resetEmpty();
-        assertEquals("Map.isEmpty() should return true with an empty map", 
-                     true, map.isEmpty());
+        assertEquals("Map.isEmpty() should return true with an empty map",
+                     true, getMap().isEmpty());
         verify();
 
         resetFull();
         assertEquals("Map.isEmpty() should return false with a non-empty map",
-                     false, map.isEmpty());
+                     false, getMap().isEmpty());
         verify();
     }
 
@@ -553,12 +550,12 @@ public abstract class AbstractTestMap extends AbstractTestObject {
     public void testMapSize() {
         resetEmpty();
         assertEquals("Map.size() should be 0 with an empty map",
-                     0, map.size());
+                     0, getMap().size());
         verify();
 
         resetFull();
         assertEquals("Map.size() should equal the number of entries " +
-                     "in the map", getSampleKeys().length, map.size());
+                     "in the map", getSampleKeys().length, getMap().size());
         verify();
     }
 
@@ -574,43 +571,42 @@ public abstract class AbstractTestMap extends AbstractTestObject {
         if (!isRemoveSupported()) {
             try {
                 resetFull();
-                map.clear();
+                getMap().clear();
                 fail("Expected UnsupportedOperationException on clear");
             } catch (UnsupportedOperationException ex) {}
             return;
         }
 
         resetEmpty();
-        map.clear();
-        confirmed.clear();
+        getMap().clear();
+        getConfirmed().clear();
         verify();
-        
+
         resetFull();
-        map.clear();
-        confirmed.clear();
+        getMap().clear();
+        getConfirmed().clear();
         verify();
     }
 
-
     /**
      * Tests Map.containsKey(Object) by verifying it returns false for all
      * sample keys on a map created using an empty map and returns true for
-     * all sample keys returned on a full map. 
+     * all sample keys returned on a full map.
      */
     public void testMapContainsKey() {
         Object[] keys = getSampleKeys();
 
         resetEmpty();
         for(int i = 0; i < keys.length; i++) {
-            assertTrue("Map must not contain key when map is empty", 
-                       !map.containsKey(keys[i]));
+            assertTrue("Map must not contain key when map is empty",
+                       !getMap().containsKey(keys[i]));
         }
         verify();
 
         resetFull();
         for(int i = 0; i < keys.length; i++) {
             assertTrue("Map must contain key for a mapping in the map. " +
-                       "Missing: " + keys[i], map.containsKey(keys[i]));
+                       "Missing: " + keys[i], getMap().containsKey(keys[i]));
         }
         verify();
     }
@@ -625,15 +621,15 @@ public abstract class AbstractTestMap extends AbstractTestObject {
 
         resetEmpty();
         for(int i = 0; i < values.length; i++) {
-            assertTrue("Empty map must not contain value", 
-                       !map.containsValue(values[i]));
+            assertTrue("Empty map must not contain value",
+                       !getMap().containsValue(values[i]));
         }
         verify();
-        
+
         resetFull();
         for(int i = 0; i < values.length; i++) {
-            assertTrue("Map must contain value for a mapping in the map.", 
-                       map.containsValue(values[i]));
+            assertTrue("Map must contain value for a mapping in the map.",
+                    getMap().containsValue(values[i]));
         }
         verify();
     }
@@ -644,29 +640,28 @@ public abstract class AbstractTestMap extends AbstractTestObject {
      */
     public void testMapEquals() {
         resetEmpty();
-        assertTrue("Empty maps unequal.", map.equals(confirmed));
+        assertTrue("Empty maps unequal.", getMap().equals(confirmed));
         verify();
 
         resetFull();
-        assertTrue("Full maps unequal.", map.equals(confirmed));
+        assertTrue("Full maps unequal.", getMap().equals(confirmed));
         verify();
 
         resetFull();
         // modify the HashMap created from the full map and make sure this
         // change results in map.equals() to return false.
-        Iterator iter = confirmed.keySet().iterator();
+        Iterator<K> iter = confirmed.keySet().iterator();
         iter.next();
         iter.remove();
-        assertTrue("Different maps equal.", !map.equals(confirmed));
-        
+        assertTrue("Different maps equal.", !getMap().equals(confirmed));
+
         resetFull();
-        assertTrue("equals(null) returned true.", !map.equals(null));
-        assertTrue("equals(new Object()) returned true.", 
-                   !map.equals(new Object()));
+        assertTrue("equals(null) returned true.", !getMap().equals(null));
+        assertTrue("equals(new Object()) returned true.",
+                   !getMap().equals(new Object()));
         verify();
     }
 
-
     /**
      * Tests Map.get(Object)
      */
@@ -677,15 +672,15 @@ public abstract class AbstractTestMap extends AbstractTestObject {
         Object[] values = getSampleValues();
 
         for (int i = 0; i < keys.length; i++) {
-            assertTrue("Empty map.get() should return null.", 
-                       map.get(keys[i]) == null);
+            assertTrue("Empty map.get() should return null.",
+                    getMap().get(keys[i]) == null);
         }
         verify();
 
         resetFull();
         for (int i = 0; i < keys.length; i++) {
-            assertEquals("Full map.get() should return value from mapping.", 
-                         values[i], map.get(keys[i]));
+            assertEquals("Full map.get() should return value from mapping.",
+                         values[i], getMap().get(keys[i]));
         }
     }
 
@@ -694,12 +689,12 @@ public abstract class AbstractTestMap extends AbstractTestObject {
      */
     public void testMapHashCode() {
         resetEmpty();
-        assertTrue("Empty maps have different hashCodes.", 
-                   map.hashCode() == confirmed.hashCode());
+        assertTrue("Empty maps have different hashCodes.",
+                getMap().hashCode() == confirmed.hashCode());
 
         resetFull();
-        assertTrue("Equal maps have different hashCodes.", 
-                   map.hashCode() == confirmed.hashCode());
+        assertTrue("Equal maps have different hashCodes.",
+                getMap().hashCode() == confirmed.hashCode());
     }
 
     /**
@@ -713,32 +708,32 @@ public abstract class AbstractTestMap extends AbstractTestObject {
      */
     public void testMapToString() {
         resetEmpty();
-        assertTrue("Empty map toString() should not return null", 
-                   map.toString() != null);
+        assertTrue("Empty map toString() should not return null",
+                getMap().toString() != null);
         verify();
 
         resetFull();
-        assertTrue("Empty map toString() should not return null", 
-                   map.toString() != null);
+        assertTrue("Empty map toString() should not return null",
+                getMap().toString() != null);
         verify();
     }
 
-
     /**
      * Compare the current serialized form of the Map
      * against the canonical version in CVS.
      */
+    @SuppressWarnings("unchecked")
     public void testEmptyMapCompatibility() throws Exception {
         /**
          * Create canonical objects with this code
         Map map = makeEmptyMap();
         if (!(map instanceof Serializable)) return;
-        
+
         writeExternalFormToDisk((Serializable) map, getCanonicalEmptyCollectionName(map));
         */
 
         // test to make sure the canonical form has been preserved
-        Map map = makeEmptyMap();
+        Map map = makeObject();
         if (map instanceof Serializable && !skipSerializedCanonicalTests() && isTestSerialization()) {
             Map map2 = (Map) readExternalFormFromDisk(getCanonicalEmptyCollectionName(map));
             assertEquals("Map is empty", 0, map2.size());
@@ -749,12 +744,13 @@ public abstract class AbstractTestMap extends AbstractTestObject {
      * Compare the current serialized form of the Map
      * against the canonical version in CVS.
      */
+    @SuppressWarnings("unchecked")
     public void testFullMapCompatibility() throws Exception {
         /**
          * Create canonical objects with this code
         Map map = makeFullMap();
         if (!(map instanceof Serializable)) return;
-        
+
         writeExternalFormToDisk((Serializable) map, getCanonicalFullCollectionName(map));
         */
 
@@ -771,82 +767,80 @@ public abstract class AbstractTestMap extends AbstractTestObject {
      */
     public void testMapPut() {
         resetEmpty();
-        Object[] keys = getSampleKeys();
-        Object[] values = getSampleValues();
-        Object[] newValues = getNewSampleValues();
+        K[] keys = getSampleKeys();
+        V[] values = getSampleValues();
+        V[] newValues = getNewSampleValues();
 
         if (isPutAddSupported()) {
             for (int i = 0; i < keys.length; i++) {
-                Object o = map.put(keys[i], values[i]);
-                confirmed.put(keys[i], values[i]);
+                Object o = getMap().put(keys[i], values[i]);
+                getConfirmed().put(keys[i], values[i]);
                 verify();
                 assertTrue("First map.put should return null", o == null);
-                assertTrue("Map should contain key after put", 
-                           map.containsKey(keys[i]));
-                assertTrue("Map should contain value after put", 
-                           map.containsValue(values[i]));
+                assertTrue("Map should contain key after put",
+                        getMap().containsKey(keys[i]));
+                assertTrue("Map should contain value after put",
+                        getMap().containsValue(values[i]));
             }
             if (isPutChangeSupported()) {
                 for (int i = 0; i < keys.length; i++) {
-                    Object o = map.put(keys[i], newValues[i]);
-                    confirmed.put(keys[i], newValues[i]);
+                    Object o = getMap().put(keys[i], newValues[i]);
+                    getConfirmed().put(keys[i], newValues[i]);
                     verify();
-                    assertEquals("Map.put should return previous value when changed",
-                                 values[i], o);
+                    assertEquals("Map.put should return previous value when changed", values[i], o);
                     assertTrue("Map should still contain key after put when changed",
-                               map.containsKey(keys[i]));
+                            getMap().containsKey(keys[i]));
                     assertTrue("Map should contain new value after put when changed",
-                               map.containsValue(newValues[i]));
-        
+                            getMap().containsValue(newValues[i]));
+
                     // if duplicates are allowed, we're not guaranteed that the value
                     // no longer exists, so don't try checking that.
                     if (!isAllowDuplicateValues()) {
                         assertTrue("Map should not contain old value after put when changed",
-                                   !map.containsValue(values[i]));
+                                !getMap().containsValue(values[i]));
                     }
                 }
             } else {
                 try {
                     // two possible exception here, either valid
-                    map.put(keys[0], newValues[0]);
+                    getMap().put(keys[0], newValues[0]);
                     fail("Expected IllegalArgumentException or UnsupportedOperationException on put (change)");
                 } catch (IllegalArgumentException ex) {
                 } catch (UnsupportedOperationException ex) {}
             }
-            
+
         } else if (isPutChangeSupported()) {
             resetEmpty();
             try {
-                map.put(keys[0], values[0]);
+                getMap().put(keys[0], values[0]);
                 fail("Expected UnsupportedOperationException or IllegalArgumentException on put (add) when fixed size");
             } catch (IllegalArgumentException ex) {
             } catch (UnsupportedOperationException ex) {
             }
-            
+
             resetFull();
             int i = 0;
-            for (Iterator it = map.keySet().iterator(); it.hasNext() && i < newValues.length; i++) {
-                Object key = it.next();
-                Object o = map.put(key, newValues[i]);
-                Object value = confirmed.put(key, newValues[i]);
+            for (Iterator<K> it = getMap().keySet().iterator(); it.hasNext() && i < newValues.length; i++) {
+                K  key = it.next();
+                V o = getMap().put(key, newValues[i]);
+                V value = getConfirmed().put(key, newValues[i]);
                 verify();
-                assertEquals("Map.put should return previous value when changed",
-                    value, o);
-                assertTrue("Map should still contain key after put when changed",
-                    map.containsKey(key));
-                assertTrue("Map should contain new value after put when changed",
-                    map.containsValue(newValues[i]));
-        
+                assertEquals("Map.put should return previous value when changed", value, o);
+                assertTrue("Map should still contain key after put when changed", getMap()
+                        .containsKey(key));
+                assertTrue("Map should contain new value after put when changed", getMap()
+                        .containsValue(newValues[i]));
+
                 // if duplicates are allowed, we're not guaranteed that the value
                 // no longer exists, so don't try checking that.
                 if (!isAllowDuplicateValues()) {
                     assertTrue("Map should not contain old value after put when changed",
-                        !map.containsValue(values[i]));
+                        !getMap().containsValue(values[i]));
                 }
             }
         } else {
             try {
-                map.put(keys[0], values[0]);
+                getMap().put(keys[0], values[0]);
                 fail("Expected UnsupportedOperationException on put (add)");
             } catch (UnsupportedOperationException ex) {}
         }
@@ -857,51 +851,51 @@ public abstract class AbstractTestMap extends AbstractTestObject {
      */
     public void testMapPutNullKey() {
         resetFull();
-        Object[] values = getSampleValues();
-    
+        V[] values = getSampleValues();
+
         if (isPutAddSupported()) {
             if (isAllowNullKey()) {
-                map.put(null, values[0]);
+                getMap().put(null, values[0]);
             } else {
                 try {
-                    map.put(null, values[0]);
+                    getMap().put(null, values[0]);
                     fail("put(null, value) should throw NPE/IAE");
                 } catch (NullPointerException ex) {
                 } catch (IllegalArgumentException ex) {}
             }
         }
     }
-    
+
     /**
      * Tests Map.put(null, value)
      */
     public void testMapPutNullValue() {
         resetFull();
-        Object[] keys = getSampleKeys();
-        
+        K[] keys = getSampleKeys();
+
         if (isPutAddSupported()) {
             if (isAllowNullValue()) {
-                map.put(keys[0], null);
+                getMap().put(keys[0], null);
             } else {
                 try {
-                    map.put(keys[0], null);
+                    getMap().put(keys[0], null);
                     fail("put(key, null) should throw NPE/IAE");
                 } catch (NullPointerException ex) {
                 } catch (IllegalArgumentException ex) {}
             }
         }
     }
-    
+
     /**
      * Tests Map.putAll(map)
      */
     public void testMapPutAll() {
         if (!isPutAddSupported()) {
             if (!isPutChangeSupported()) {
-                Map temp = makeFullMap();
+                Map<K, V> temp = makeFullMap();
                 resetEmpty();
                 try {
-                    map.putAll(temp);
+                    getMap().putAll(temp);
                     fail("Expected UnsupportedOperationException on putAll");
                 } catch (UnsupportedOperationException ex) {}
             }
@@ -910,46 +904,46 @@ public abstract class AbstractTestMap extends AbstractTestObject {
 
         // check putAll OK adding empty map to empty map
         resetEmpty();
-        assertEquals(0, map.size());
-        map.putAll(new HashMap());
-        assertEquals(0, map.size());
+        assertEquals(0, getMap().size());
+        getMap().putAll(new HashMap<K, V>());
+        assertEquals(0, getMap().size());
 
         // check putAll OK adding empty map to non-empty map
         resetFull();
-        int size = map.size();
-        map.putAll(new HashMap());
-        assertEquals(size, map.size());
+        int size = getMap().size();
+        getMap().putAll(new HashMap<K, V>());
+        assertEquals(size, getMap().size());
 
         // check putAll OK adding non-empty map to empty map
         resetEmpty();
-        Map m2 = makeFullMap();
-        map.putAll(m2);
-        confirmed.putAll(m2);
+        Map<K, V> m2 = makeFullMap();
+        getMap().putAll(m2);
+        getConfirmed().putAll(m2);
         verify();
 
         // check putAll OK adding non-empty JDK map to empty map
         resetEmpty();
         m2 = makeConfirmedMap();
-        Object[] keys = getSampleKeys();
-        Object[] values = getSampleValues();
+        K[] keys = getSampleKeys();
+        V[] values = getSampleValues();
         for(int i = 0; i < keys.length; i++) {
             m2.put(keys[i], values[i]);
         }
-        map.putAll(m2);
-        confirmed.putAll(m2);
+        getMap().putAll(m2);
+        getConfirmed().putAll(m2);
         verify();
 
         // check putAll OK adding non-empty JDK map to non-empty map
         resetEmpty();
         m2 = makeConfirmedMap();
-        map.put(keys[0], values[0]);
-        confirmed.put(keys[0], values[0]);
+        getMap().put(keys[0], values[0]);
+        getConfirmed().put(keys[0], values[0]);
         verify();
         for(int i = 1; i < keys.length; i++) {
             m2.put(keys[i], values[i]);
         }
-        map.putAll(m2);
-        confirmed.putAll(m2);
+        getMap().putAll(m2);
+        getConfirmed().putAll(m2);
         verify();
     }
 
@@ -960,7 +954,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
         if (!isRemoveSupported()) {
             try {
                 resetFull();
-                map.remove(map.keySet().iterator().next());
+                getMap().remove(getMap().keySet().iterator().next());
                 fail("Expected UnsupportedOperationException on remove");
             } catch (UnsupportedOperationException ex) {}
             return;
@@ -970,17 +964,17 @@ public abstract class AbstractTestMap extends AbstractTestObject {
 
         Object[] keys = getSampleKeys();
         Object[] values = getSampleValues();
-        for(int i = 0; i < keys.length; i++) {
-            Object o = map.remove(keys[i]);
+        for (int i = 0; i < keys.length; i++) {
+            Object o = getMap().remove(keys[i]);
             assertTrue("First map.remove should return null", o == null);
         }
         verify();
 
         resetFull();
 
-        for(int i = 0; i < keys.length; i++) {
-            Object o = map.remove(keys[i]);
-            confirmed.remove(keys[i]);
+        for (int i = 0; i < keys.length; i++) {
+            Object o = getMap().remove(keys[i]);
+            getConfirmed().remove(keys[i]);
             verify();
 
             assertEquals("map.remove with valid key should return value",
@@ -990,13 +984,13 @@ public abstract class AbstractTestMap extends AbstractTestObject {
         Object[] other = getOtherKeys();
 
         resetFull();
-        int size = map.size();
+        int size = getMap().size();
         for (int i = 0; i < other.length; i++) {
-            Object o = map.remove(other[i]);
+            Object o = getMap().remove(other[i]);
             assertEquals("map.remove for nonexistent key should return null",
                          o, null);
             assertEquals("map.remove for nonexistent key should not " +
-                         "shrink map", size, map.size());
+                         "shrink map", size, getMap().size());
         }
         verify();
     }
@@ -1008,143 +1002,149 @@ public abstract class AbstractTestMap extends AbstractTestObject {
      */
     public void testValuesClearChangesMap() {
         if (!isRemoveSupported()) return;
-        
+
         // clear values, reflected in map
         resetFull();
-        Collection values = map.values();
-        assertTrue(map.size() > 0);
+        Collection<V> values = getMap().values();
+        assertTrue(getMap().size() > 0);
         assertTrue(values.size() > 0);
         values.clear();
-        assertTrue(map.size() == 0);
+        assertTrue(getMap().size() == 0);
         assertTrue(values.size() == 0);
-        
+
         // clear map, reflected in values
         resetFull();
-        values = map.values();
-        assertTrue(map.size() > 0);
+        values = getMap().values();
+        assertTrue(getMap().size() > 0);
         assertTrue(values.size() > 0);
-        map.clear();
-        assertTrue(map.size() == 0);
+        getMap().clear();
+        assertTrue(getMap().size() == 0);
         assertTrue(values.size() == 0);
     }
-    
+
     /**
      * Tests that the {@link Map#keySet} collection is backed by
      * the underlying map for clear().
      */
     public void testKeySetClearChangesMap() {
         if (!isRemoveSupported()) return;
-        
+
         // clear values, reflected in map
         resetFull();
-        Set keySet = map.keySet();
-        assertTrue(map.size() > 0);
+        Set<K> keySet = getMap().keySet();
+        assertTrue(getMap().size() > 0);
         assertTrue(keySet.size() > 0);
         keySet.clear();
-        assertTrue(map.size() == 0);
+        assertTrue(getMap().size() == 0);
         assertTrue(keySet.size() == 0);
-        
+
         // clear map, reflected in values
         resetFull();
-        keySet = map.keySet();
-        assertTrue(map.size() > 0);
+        keySet = getMap().keySet();
+        assertTrue(getMap().size() > 0);
         assertTrue(keySet.size() > 0);
-        map.clear();
-        assertTrue(map.size() == 0);
+        getMap().clear();
+        assertTrue(getMap().size() == 0);
         assertTrue(keySet.size() == 0);
     }
-    
+
     /**
      * Tests that the {@link Map#entrySet()} collection is backed by
      * the underlying map for clear().
      */
     public void testEntrySetClearChangesMap() {
         if (!isRemoveSupported()) return;
-        
+
         // clear values, reflected in map
         resetFull();
-        Set entrySet = map.entrySet();
-        assertTrue(map.size() > 0);
+        Set<Map.Entry<K, V>> entrySet = getMap().entrySet();
+        assertTrue(getMap().size() > 0);
         assertTrue(entrySet.size() > 0);
         entrySet.clear();
-        assertTrue(map.size() == 0);
+        assertTrue(getMap().size() == 0);
         assertTrue(entrySet.size() == 0);
-        
+
         // clear map, reflected in values
         resetFull();
-        entrySet = map.entrySet();
-        assertTrue(map.size() > 0);
+        entrySet = getMap().entrySet();
+        assertTrue(getMap().size() > 0);
         assertTrue(entrySet.size() > 0);
-        map.clear();
-        assertTrue(map.size() == 0);
+        getMap().clear();
+        assertTrue(getMap().size() == 0);
         assertTrue(entrySet.size() == 0);
     }
 
-    //-----------------------------------------------------------------------    
+    //-----------------------------------------------------------------------
     public void testEntrySetContains1() {
         resetFull();
-        Set entrySet = map.entrySet();
-        Map.Entry entry = (Map.Entry) entrySet.iterator().next();
+        Set<Map.Entry<K, V>> entrySet = getMap().entrySet();
+        Map.Entry<K, V> entry = entrySet.iterator().next();
         assertEquals(true, entrySet.contains(entry));
     }
+
     public void testEntrySetContains2() {
         resetFull();
-        Set entrySet = map.entrySet();
-        Map.Entry entry = (Map.Entry) entrySet.iterator().next();
-        Map.Entry test = cloneMapEntry(entry);
+        Set<Map.Entry<K, V>> entrySet = getMap().entrySet();
+        Map.Entry<K, V> entry = entrySet.iterator().next();
+        Map.Entry<K, V> test = cloneMapEntry(entry);
         assertEquals(true, entrySet.contains(test));
     }
+    
+    @SuppressWarnings("unchecked")
     public void testEntrySetContains3() {
         resetFull();
-        Set entrySet = map.entrySet();
-        Map.Entry entry = (Map.Entry) entrySet.iterator().next();
-        HashMap temp = new HashMap();
-        temp.put(entry.getKey(), "A VERY DIFFERENT VALUE");
-        Map.Entry test = (Map.Entry) temp.entrySet().iterator().next();
+        Set<Map.Entry<K, V>> entrySet = getMap().entrySet();
+        Map.Entry<K, V> entry = entrySet.iterator().next();
+        HashMap<K, V> temp = new HashMap<K, V>();
+        temp.put(entry.getKey(), (V) "A VERY DIFFERENT VALUE");
+        Map.Entry<K, V> test = temp.entrySet().iterator().next();
         assertEquals(false, entrySet.contains(test));
     }
-    
+
     public void testEntrySetRemove1() {
         if (!isRemoveSupported()) return;
         resetFull();
-        int size = map.size();
-        Set entrySet = map.entrySet();
-        Map.Entry entry = (Map.Entry) entrySet.iterator().next();
-        Object key = entry.getKey();
-        
+        int size = getMap().size();
+        Set<Map.Entry<K, V>> entrySet = getMap().entrySet();
+        Map.Entry<K, V> entry = entrySet.iterator().next();
+        K key = entry.getKey();
+
         assertEquals(true, entrySet.remove(entry));
-        assertEquals(false, map.containsKey(key));
-        assertEquals(size - 1, map.size());
-    }            
+        assertEquals(false, getMap().containsKey(key));
+        assertEquals(size - 1, getMap().size());
+    }
+
     public void testEntrySetRemove2() {
         if (!isRemoveSupported()) return;
         resetFull();
-        int size = map.size();
-        Set entrySet = map.entrySet();
-        Map.Entry entry = (Map.Entry) entrySet.iterator().next();
-        Object key = entry.getKey();
-        Map.Entry test = cloneMapEntry(entry);
-        
+        int size = getMap().size();
+        Set<Map.Entry<K, V>> entrySet = getMap().entrySet();
+        Map.Entry<K, V> entry = entrySet.iterator().next();
+        K key = entry.getKey();
+        Map.Entry<K, V> test = cloneMapEntry(entry);
+
         assertEquals(true, entrySet.remove(test));
-        assertEquals(false, map.containsKey(key));
-        assertEquals(size - 1, map.size());
+        assertEquals(false, getMap().containsKey(key));
+        assertEquals(size - 1, getMap().size());
     }
+
+    @SuppressWarnings("unchecked")
     public void testEntrySetRemove3() {
         if (!isRemoveSupported()) return;
         resetFull();
-        int size = map.size();
-        Set entrySet = map.entrySet();
-        Map.Entry entry = (Map.Entry) entrySet.iterator().next();
-        Object key = entry.getKey();
-        HashMap temp = new HashMap();
-        temp.put(entry.getKey(), "A VERY DIFFERENT VALUE");
-        Map.Entry test = (Map.Entry) temp.entrySet().iterator().next();
-        
+        int size = getMap().size();
+        Set<Map.Entry<K, V>> entrySet = getMap().entrySet();
+        Map.Entry<K, V> entry = entrySet.iterator().next();
+        K key = entry.getKey();
+        HashMap<K, V> temp = new HashMap<K, V>();
+        temp.put(entry.getKey(), (V) "A VERY DIFFERENT VALUE");
+        Map.Entry<K, V> test = temp.entrySet().iterator().next();
+
         assertEquals(false, entrySet.remove(test));
-        assertEquals(true, map.containsKey(key));
-        assertEquals(size, map.size());
+        assertEquals(true, getMap().containsKey(key));
+        assertEquals(size, getMap().size());
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Tests that the {@link Map#values} collection is backed by
@@ -1163,8 +1163,8 @@ public abstract class AbstractTestMap extends AbstractTestObject {
      */
     public void testValuesRemoveChangesMap() {
         resetFull();
-        Object[] sampleValues = getSampleValues();
-        Collection values = map.values();
+        V[] sampleValues = getSampleValues();
+        Collection<V> values = getMap().values();
         for (int i = 0; i < sampleValues.length; i++) {
             if (map.containsValue(sampleValues[i])) {
                 int j = 0;  // loop counter prevents infinite loops when remove is broken
@@ -1180,7 +1180,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
                 assertTrue("values().remove(obj) is broken", j < 10000);
                 assertTrue(
                     "Value should have been removed from the underlying map.",
-                    !map.containsValue(sampleValues[i]));
+                    !getMap().containsValue(sampleValues[i]));
             }
         }
     }
@@ -1192,8 +1192,8 @@ public abstract class AbstractTestMap extends AbstractTestObject {
      */
     public void testKeySetRemoveChangesMap() {
         resetFull();
-        Object[] sampleKeys = getSampleKeys();
-        Set keys = map.keySet();
+        K[] sampleKeys = getSampleKeys();
+        Set<K> keys = getMap().keySet();
         for (int i = 0; i < sampleKeys.length; i++) {
             try {
                 keys.remove(sampleKeys[i]);
@@ -1203,7 +1203,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
             }
             assertTrue(
                 "Key should have been removed from the underlying map.",
-                !map.containsKey(sampleKeys[i]));
+                !getMap().containsKey(sampleKeys[i]));
         }
     }
 
@@ -1221,17 +1221,17 @@ public abstract class AbstractTestMap extends AbstractTestObject {
      * @param values  the array of values
      * @return an array of Map.Entry of those keys to those values
      */
-    private Map.Entry[] makeEntryArray(Object[] keys, Object[] values) {
-        Map.Entry[] result = new Map.Entry[keys.length];
+    @SuppressWarnings("unchecked")
+    private Map.Entry<K, V>[] makeEntryArray(K[] keys, V[] values) {
+        Map.Entry<K, V>[] result = new Map.Entry[keys.length];
         for (int i = 0; i < keys.length; i++) {
-            Map map = makeConfirmedMap();
+            Map<K, V> map = makeConfirmedMap();
             map.put(keys[i], values[i]);
-            result[i] = (Map.Entry) map.entrySet().iterator().next();
+            result[i] = map.entrySet().iterator().next();
         }
         return result;
     }
 
-
     /**
      * Bulk test {@link Map#entrySet()}.  This method runs through all of
      * the tests in {@link AbstractTestSet}.
@@ -1244,95 +1244,110 @@ public abstract class AbstractTestMap extends AbstractTestObject {
         return new TestMapEntrySet();
     }
 
-    public class TestMapEntrySet extends AbstractTestSet {
+    public class TestMapEntrySet extends AbstractTestSet<Map.Entry<K, V>> {
         public TestMapEntrySet() {
             super("MapEntrySet");
         }
 
         // Have to implement manually; entrySet doesn't support addAll
-        public Object[] getFullElements() {
-            Object[] k = getSampleKeys();
-            Object[] v = getSampleValues();
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public Entry<K, V>[] getFullElements() {
+            return getFullNonNullElements();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public Map.Entry<K, V>[] getFullNonNullElements() {
+            K[] k = getSampleKeys();
+            V[] v = getSampleValues();
             return makeEntryArray(k, v);
         }
-        
+
         // Have to implement manually; entrySet doesn't support addAll
-        public Object[] getOtherElements() {
-            Object[] k = getOtherKeys();
-            Object[] v = getOtherValues();
+        public Map.Entry<K, V>[] getOtherElements() {
+            K[] k = getOtherKeys();
+            V[] v = getOtherValues();
             return makeEntryArray(k, v);
         }
-        
-        public Set makeEmptySet() {
-            return makeEmptyMap().entrySet();
+
+        public Set<Map.Entry<K, V>> makeObject() {
+            return AbstractTestMap.this.makeObject().entrySet();
         }
-        
-        public Set makeFullSet() {
+
+        public Set<Map.Entry<K, V>> makeFullCollection() {
             return makeFullMap().entrySet();
         }
-        
+
         public boolean isAddSupported() {
             // Collection views don't support add operations.
             return false;
         }
+
         public boolean isRemoveSupported() {
             // Entry set should only support remove if map does
             return AbstractTestMap.this.isRemoveSupported();
         }
+
         public boolean isGetStructuralModify() {
             return AbstractTestMap.this.isGetStructuralModify();
         }
+        
         public boolean isTestSerialization() {
             return false;
         }
 
         public void resetFull() {
             AbstractTestMap.this.resetFull();
-            collection = map.entrySet();
-            TestMapEntrySet.this.confirmed = AbstractTestMap.this.confirmed.entrySet();
+            setCollection(AbstractTestMap.this.getMap().entrySet());
+            TestMapEntrySet.this.setConfirmed(AbstractTestMap.this.getConfirmed().entrySet());
         }
-        
+
         public void resetEmpty() {
             AbstractTestMap.this.resetEmpty();
-            collection = map.entrySet();
-            TestMapEntrySet.this.confirmed = AbstractTestMap.this.confirmed.entrySet();
+            setCollection(AbstractTestMap.this.getMap().entrySet());
+            TestMapEntrySet.this.setConfirmed(AbstractTestMap.this.getConfirmed().entrySet());
         }
-        
+
         public void testMapEntrySetIteratorEntry() {
             resetFull();
-            Iterator it = collection.iterator();
+            Iterator<Map.Entry<K, V>> it = getCollection().iterator();
             int count = 0;
             while (it.hasNext()) {
-                Map.Entry entry = (Map.Entry) it.next();
-                assertEquals(true, AbstractTestMap.this.map.containsKey(entry.getKey()));
-                assertEquals(true, AbstractTestMap.this.map.containsValue(entry.getValue()));
+                Map.Entry<K, V> entry = it.next();
+                assertEquals(true, AbstractTestMap.this.getMap().containsKey(entry.getKey()));
+                assertEquals(true, AbstractTestMap.this.getMap().containsValue(entry.getValue()));
                 if (isGetStructuralModify() == false) {
-                    assertEquals(AbstractTestMap.this.map.get(entry.getKey()), entry.getValue());
+                    assertEquals(AbstractTestMap.this.getMap().get(entry.getKey()), entry.getValue());
                 }
                 count++;
             }
-            assertEquals(collection.size(), count);
+            assertEquals(getCollection().size(), count);
         }
 
         public void testMapEntrySetIteratorEntrySetValue() {
-            Object key1 = getSampleKeys()[0];
-            Object key2 = (getSampleKeys().length ==1 ? getSampleKeys()[0] : getSampleKeys()[1]);
-            Object newValue1 = getNewSampleValues()[0];
-            Object newValue2 = (getNewSampleValues().length ==1 ? getNewSampleValues()[0] : getNewSampleValues()[1]);
-            
+            K key1 = getSampleKeys()[0];
+            K key2 = (getSampleKeys().length == 1 ? getSampleKeys()[0] : getSampleKeys()[1]);
+            V newValue1 = getNewSampleValues()[0];
+            V newValue2 = (getNewSampleValues().length ==1 ? getNewSampleValues()[0] : getNewSampleValues()[1]);
+
             resetFull();
             // explicitly get entries as sample values/keys are connected for some maps
             // such as BeanMap
-            Iterator it = TestMapEntrySet.this.collection.iterator();
-            Map.Entry entry1 = getEntry(it, key1);
-            it = TestMapEntrySet.this.collection.iterator();
-            Map.Entry entry2 = getEntry(it, key2);
-            Iterator itConfirmed = TestMapEntrySet.this.confirmed.iterator();
-            Map.Entry entryConfirmed1 = getEntry(itConfirmed, key1);
-            itConfirmed = TestMapEntrySet.this.confirmed.iterator();
-            Map.Entry entryConfirmed2 = getEntry(itConfirmed, key2);
+            Iterator<Map.Entry<K, V>> it = TestMapEntrySet.this.getCollection().iterator();
+            Map.Entry<K, V> entry1 = getEntry(it, key1);
+            it = TestMapEntrySet.this.getCollection().iterator();
+            Map.Entry<K, V> entry2 = getEntry(it, key2);
+            Iterator<Map.Entry<K, V>> itConfirmed = TestMapEntrySet.this.getConfirmed().iterator();
+            Map.Entry<K, V> entryConfirmed1 = getEntry(itConfirmed, key1);
+            itConfirmed = TestMapEntrySet.this.getConfirmed().iterator();
+            Map.Entry<K, V> entryConfirmed2 = getEntry(itConfirmed, key2);
             verify();
-            
+
             if (isSetValueSupported() == false) {
                 try {
                     entry1.setValue(newValue1);
@@ -1340,36 +1355,36 @@ public abstract class AbstractTestMap extends AbstractTestObject {
                 }
                 return;
             }
-            
+
             entry1.setValue(newValue1);
             entryConfirmed1.setValue(newValue1);
             assertEquals(newValue1, entry1.getValue());
-            assertEquals(true, AbstractTestMap.this.map.containsKey(entry1.getKey()));
-            assertEquals(true, AbstractTestMap.this.map.containsValue(newValue1));
-            assertEquals(newValue1, AbstractTestMap.this.map.get(entry1.getKey()));
+            assertEquals(true, AbstractTestMap.this.getMap().containsKey(entry1.getKey()));
+            assertEquals(true, AbstractTestMap.this.getMap().containsValue(newValue1));
+            assertEquals(newValue1, AbstractTestMap.this.getMap().get(entry1.getKey()));
             verify();
-            
+
             entry1.setValue(newValue1);
             entryConfirmed1.setValue(newValue1);
             assertEquals(newValue1, entry1.getValue());
-            assertEquals(true, AbstractTestMap.this.map.containsKey(entry1.getKey()));
-            assertEquals(true, AbstractTestMap.this.map.containsValue(newValue1));
-            assertEquals(newValue1, AbstractTestMap.this.map.get(entry1.getKey()));
+            assertEquals(true, AbstractTestMap.this.getMap().containsKey(entry1.getKey()));
+            assertEquals(true, AbstractTestMap.this.getMap().containsValue(newValue1));
+            assertEquals(newValue1, AbstractTestMap.this.getMap().get(entry1.getKey()));
             verify();
-            
+
             entry2.setValue(newValue2);
             entryConfirmed2.setValue(newValue2);
             assertEquals(newValue2, entry2.getValue());
-            assertEquals(true, AbstractTestMap.this.map.containsKey(entry2.getKey()));
-            assertEquals(true, AbstractTestMap.this.map.containsValue(newValue2));
-            assertEquals(newValue2, AbstractTestMap.this.map.get(entry2.getKey()));
+            assertEquals(true, AbstractTestMap.this.getMap().containsKey(entry2.getKey()));
+            assertEquals(true, AbstractTestMap.this.getMap().containsValue(newValue2));
+            assertEquals(newValue2, AbstractTestMap.this.getMap().get(entry2.getKey()));
             verify();
         }
-        
-        public Map.Entry getEntry(Iterator itConfirmed, Object key) {
-            Map.Entry entry = null;
+
+        public Map.Entry<K, V> getEntry(Iterator<Map.Entry<K, V>> itConfirmed, K key) {
+            Map.Entry<K, V> entry = null;
             while (itConfirmed.hasNext()) {
-                Map.Entry temp = (Map.Entry) itConfirmed.next();
+                Map.Entry<K, V> temp = itConfirmed.next();
                 if (temp.getKey() == null) {
                     if (key == null) {
                         entry = temp;
@@ -1387,10 +1402,10 @@ public abstract class AbstractTestMap extends AbstractTestObject {
         public void testMapEntrySetRemoveNonMapEntry() {
             if (isRemoveSupported() == false) return;
             resetFull();
-            assertEquals(false, getSet().remove(null));
-            assertEquals(false, getSet().remove(new Object()));
+            assertEquals(false, getCollection().remove(null));
+            assertEquals(false, getCollection().remove(new Object()));
         }
-        
+
         public void verify() {
             super.verify();
             AbstractTestMap.this.verify();
@@ -1410,58 +1425,61 @@ public abstract class AbstractTestMap extends AbstractTestObject {
         return new TestMapKeySet();
     }
 
-    public class TestMapKeySet extends AbstractTestSet {
+    public class TestMapKeySet extends AbstractTestSet<K> {
         public TestMapKeySet() {
             super("");
         }
-        public Object[] getFullElements() {
+
+        public K[] getFullElements() {
             return getSampleKeys();
         }
-        
-        public Object[] getOtherElements() {
+
+        public K[] getOtherElements() {
             return getOtherKeys();
         }
-        
-        public Set makeEmptySet() {
-            return makeEmptyMap().keySet();
+
+        public Set<K> makeObject() {
+            return AbstractTestMap.this.makeObject().keySet();
         }
-        
-        public Set makeFullSet() {
-            return makeFullMap().keySet();
+
+        public Set<K> makeFullCollection() {
+            return AbstractTestMap.this.makeFullMap().keySet();
         }
-        
+
         public boolean isNullSupported() {
             return AbstractTestMap.this.isAllowNullKey();
         }
+
         public boolean isAddSupported() {
             return false;
         }
+        
         public boolean isRemoveSupported() {
             return AbstractTestMap.this.isRemoveSupported();
         }
+        
         public boolean isTestSerialization() {
             return false;
         }
-        
+
         public void resetEmpty() {
             AbstractTestMap.this.resetEmpty();
-            collection = map.keySet();
-            TestMapKeySet.this.confirmed = AbstractTestMap.this.confirmed.keySet();
+            setCollection(AbstractTestMap.this.getMap().keySet());
+            TestMapKeySet.this.setConfirmed(AbstractTestMap.this.getConfirmed().keySet());
         }
-        
+
         public void resetFull() {
             AbstractTestMap.this.resetFull();
-            collection = map.keySet();
-            TestMapKeySet.this.confirmed = AbstractTestMap.this.confirmed.keySet();
+            setCollection(AbstractTestMap.this.getMap().keySet());
+            TestMapKeySet.this.setConfirmed(AbstractTestMap.this.getConfirmed().keySet());
         }
-        
+
         public void verify() {
             super.verify();
             AbstractTestMap.this.verify();
         }
     }
 
-
     /**
      * Bulk test {@link Map#values()}.  This method runs through all of
      * the tests in {@link AbstractTestCollection}.
@@ -1475,66 +1493,69 @@ public abstract class AbstractTestMap extends AbstractTestObject {
         return new TestMapValues();
     }
 
-    public class TestMapValues extends AbstractTestCollection {
+    public class TestMapValues extends AbstractTestCollection<V> {
         public TestMapValues() {
             super("");
         }
 
-        public Object[] getFullElements() {
+        public V[] getFullElements() {
             return getSampleValues();
         }
-        
-        public Object[] getOtherElements() {
+
+        public V[] getOtherElements() {
             return getOtherValues();
         }
-        
-        public Collection makeCollection() {
-            return makeEmptyMap().values();
+
+        public Collection<V> makeObject() {
+            return AbstractTestMap.this.makeObject().values();
         }
-        
-        public Collection makeFullCollection() {
-            return makeFullMap().values();
+
+        public Collection<V> makeFullCollection() {
+            return AbstractTestMap.this.makeFullMap().values();
         }
-        
+
         public boolean isNullSupported() {
             return AbstractTestMap.this.isAllowNullKey();
         }
+
         public boolean isAddSupported() {
             return false;
         }
+
         public boolean isRemoveSupported() {
             return AbstractTestMap.this.isRemoveSupported();
         }
+        
         public boolean isTestSerialization() {
             return false;
         }
-        
+
         public boolean areEqualElementsDistinguishable() {
             // equal values are associated with different keys, so they are
-            // distinguishable.  
+            // distinguishable.
             return true;
         }
 
-        public Collection makeConfirmedCollection() {
+        public Collection<V> makeConfirmedCollection() {
             // never gets called, reset methods are overridden
             return null;
         }
-        
-        public Collection makeConfirmedFullCollection() {
+
+        public Collection<V> makeConfirmedFullCollection() {
             // never gets called, reset methods are overridden
             return null;
         }
-        
+
         public void resetFull() {
             AbstractTestMap.this.resetFull();
-            collection = map.values();
-            TestMapValues.this.confirmed = AbstractTestMap.this.confirmed.values();
+            setCollection(map.values());
+            TestMapValues.this.setConfirmed(AbstractTestMap.this.getConfirmed().values());
         }
-        
+
         public void resetEmpty() {
             AbstractTestMap.this.resetEmpty();
-            collection = map.values();
-            TestMapValues.this.confirmed = AbstractTestMap.this.confirmed.values();
+            setCollection(map.values());
+            TestMapValues.this.setConfirmed(AbstractTestMap.this.getConfirmed().values());
         }
 
         public void verify() {
@@ -1553,7 +1574,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
      * {@link #values} and {@link #confirmed} fields to empty.
      */
     public void resetEmpty() {
-        this.map = makeEmptyMap();
+        this.map = makeObject();
         views();
         this.confirmed = makeConfirmedMap();
     }
@@ -1566,32 +1587,30 @@ public abstract class AbstractTestMap extends AbstractTestObject {
         this.map = makeFullMap();
         views();
         this.confirmed = makeConfirmedMap();
-        Object[] k = getSampleKeys();
-        Object[] v = getSampleValues();
+        K[] k = getSampleKeys();
+        V[] v = getSampleValues();
         for (int i = 0; i < k.length; i++) {
             confirmed.put(k[i], v[i]);
         }
     }
 
-
     /**
      * Resets the collection view fields.
      */
     private void views() {
-        this.keySet = map.keySet();
-        this.values = map.values();
-        this.entrySet = map.entrySet();
+        this.keySet = getMap().keySet();
+        this.values = getMap().values();
+        this.entrySet = getMap().entrySet();
     }
 
-
     /**
      * Verifies that {@link #map} is still equal to {@link #confirmed}.
-     * This method checks that the map is equal to the HashMap, 
+     * This method checks that the map is equal to the HashMap,
      * <I>and</I> that the map's collection views are still equal to
      * the HashMap's collection views.  An <Code>equals</Code> test
      * is done on the maps and their collection views; their size and
      * <Code>isEmpty</Code> results are compared; their hashCodes are
-     * compared; and <Code>containsAll</Code> tests are run on the 
+     * compared; and <Code>containsAll</Code> tests are run on the
      * collection views.
      */
     public void verify() {
@@ -1602,19 +1621,16 @@ public abstract class AbstractTestMap extends AbstractTestObject {
     }
 
     public void verifyMap() {
-        int size = confirmed.size();
-        boolean empty = confirmed.isEmpty();
-        assertEquals("Map should be same size as HashMap", 
-                     size, map.size());
-        assertEquals("Map should be empty if HashMap is", 
-                     empty, map.isEmpty());
-        assertEquals("hashCodes should be the same",
-                     confirmed.hashCode(), map.hashCode());
+        int size = getConfirmed().size();
+        boolean empty = getConfirmed().isEmpty();
+        assertEquals("Map should be same size as HashMap", size, getMap().size());
+        assertEquals("Map should be empty if HashMap is", empty, getMap().isEmpty());
+        assertEquals("hashCodes should be the same", getConfirmed().hashCode(), getMap().hashCode());
         // this fails for LRUMap because confirmed.equals() somehow modifies
         // map, causing concurrent modification exceptions.
         //assertEquals("Map should still equal HashMap", confirmed, map);
         // this works though and performs the same verification:
-        assertTrue("Map should still equal HashMap", map.equals(confirmed));
+        assertTrue("Map should still equal HashMap", getMap().equals(getConfirmed()));
         // TODO: this should really be reexamined to figure out why LRU map
         // behaves like it does (the equals shouldn't modify since all accesses
         // by the confirmed collection should be through an iterator, thus not
@@ -1622,49 +1638,49 @@ public abstract class AbstractTestMap extends AbstractTestObject {
     }
 
     public void verifyEntrySet() {
-        int size = confirmed.size();
-        boolean empty = confirmed.isEmpty();
+        int size = getConfirmed().size();
+        boolean empty = getConfirmed().isEmpty();
         assertEquals("entrySet should be same size as HashMap's" +
-                     "\nTest: " + entrySet + "\nReal: " + confirmed.entrySet(),
+                     "\nTest: " + entrySet + "\nReal: " + getConfirmed().entrySet(),
                      size, entrySet.size());
         assertEquals("entrySet should be empty if HashMap is" +
-                     "\nTest: " + entrySet + "\nReal: " + confirmed.entrySet(),
+                     "\nTest: " + entrySet + "\nReal: " + getConfirmed().entrySet(),
                      empty, entrySet.isEmpty());
         assertTrue("entrySet should contain all HashMap's elements" +
-                   "\nTest: " + entrySet + "\nReal: " + confirmed.entrySet(),
-                   entrySet.containsAll(confirmed.entrySet()));
+                   "\nTest: " + entrySet + "\nReal: " + getConfirmed().entrySet(),
+                   entrySet.containsAll(getConfirmed().entrySet()));
         assertEquals("entrySet hashCodes should be the same" +
-                     "\nTest: " + entrySet + "\nReal: " + confirmed.entrySet(),
-                     confirmed.entrySet().hashCode(), entrySet.hashCode());
+                     "\nTest: " + entrySet + "\nReal: " + getConfirmed().entrySet(),
+                     getConfirmed().entrySet().hashCode(), entrySet.hashCode());
         assertEquals("Map's entry set should still equal HashMap's",
-                     confirmed.entrySet(), entrySet);
+                     getConfirmed().entrySet(), entrySet);
     }
 
-    public void verifyKeySet() { 
-        int size = confirmed.size();
-        boolean empty = confirmed.isEmpty();
+    public void verifyKeySet() {
+        int size = getConfirmed().size();
+        boolean empty = getConfirmed().isEmpty();
         assertEquals("keySet should be same size as HashMap's" +
-                     "\nTest: " + keySet + "\nReal: " + confirmed.keySet(),
+                     "\nTest: " + keySet + "\nReal: " + getConfirmed().keySet(),
                      size, keySet.size());
         assertEquals("keySet should be empty if HashMap is" +
-                     "\nTest: " + keySet + "\nReal: " + confirmed.keySet(),
+                     "\nTest: " + keySet + "\nReal: " + getConfirmed().keySet(),
                      empty, keySet.isEmpty());
         assertTrue("keySet should contain all HashMap's elements" +
-                   "\nTest: " + keySet + "\nReal: " + confirmed.keySet(),
-                   keySet.containsAll(confirmed.keySet()));
+                   "\nTest: " + keySet + "\nReal: " + getConfirmed().keySet(),
+                   keySet.containsAll(getConfirmed().keySet()));
         assertEquals("keySet hashCodes should be the same" +
-                     "\nTest: " + keySet + "\nReal: " + confirmed.keySet(),
-                     confirmed.keySet().hashCode(), keySet.hashCode());
+                     "\nTest: " + keySet + "\nReal: " + getConfirmed().keySet(),
+                     getConfirmed().keySet().hashCode(), keySet.hashCode());
         assertEquals("Map's key set should still equal HashMap's",
-                     confirmed.keySet(), keySet);
+                getConfirmed().keySet(), keySet);
     }
 
     public void verifyValues() {
-        List known = new ArrayList(confirmed.values());
-        List test = new ArrayList(values);
+        List<V> known = new ArrayList<V>(getConfirmed().values());
+        List<V> test = new ArrayList<V>(values);
 
-        int size = confirmed.size();
-        boolean empty = confirmed.isEmpty();
+        int size = getConfirmed().size();
+        boolean empty = getConfirmed().isEmpty();
         assertEquals("values should be same size as HashMap's" +
                      "\nTest: " + test + "\nReal: " + known,
                      size, values.size());
@@ -1678,7 +1694,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
                    "\nTest: " + test + "\nReal: " + known,
                    known.containsAll(test));
         // originally coded to use a HashBag, but now separate jar so...
-        for (Iterator it = known.iterator(); it.hasNext();) {
+        for (Iterator<V> it = known.iterator(); it.hasNext();) {
             boolean removed = test.remove(it.next());
             assertTrue("Map's values should still equal HashMap's", removed);
         }
@@ -1697,4 +1713,19 @@ public abstract class AbstractTestMap extends AbstractTestObject {
         confirmed = null;
     }
 
+    /**
+     * Get the map.
+     * @return Map<K,V>
+     */
+    public Map<K, V> getMap() {
+        return map;
+    }
+
+    /**
+     * Get the confirmed.
+     * @return Map<K,V>
+     */
+    public Map<K, V> getConfirmed() {
+        return confirmed;
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/AbstractTestOrderedMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/AbstractTestOrderedMap.java b/src/test/org/apache/commons/collections/map/AbstractTestOrderedMap.java
index 96b82f7..8e69a65 100644
--- a/src/test/org/apache/commons/collections/map/AbstractTestOrderedMap.java
+++ b/src/test/org/apache/commons/collections/map/AbstractTestOrderedMap.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.
@@ -26,8 +26,8 @@ import java.util.NoSuchElementException;
 import java.util.TreeMap;
 
 import org.apache.commons.collections.BulkTest;
-import org.apache.commons.collections.MapIterator;
 import org.apache.commons.collections.OrderedMap;
+import org.apache.commons.collections.OrderedMapIterator;
 import org.apache.commons.collections.comparators.NullComparator;
 import org.apache.commons.collections.iterators.AbstractTestOrderedMapIterator;
 
@@ -35,96 +35,111 @@ import org.apache.commons.collections.iterators.AbstractTestOrderedMapIterator;
  * Abstract test class for {@link OrderedMap} methods and contracts.
  *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public abstract class AbstractTestOrderedMap extends AbstractTestIterableMap {
+public abstract class AbstractTestOrderedMap<K, V> extends AbstractTestIterableMap<K, V> {
 
     /**
      * JUnit constructor.
-     * 
+     *
      * @param testName  the test name
      */
     public AbstractTestOrderedMap(String testName) {
         super(testName);
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public abstract OrderedMap<K, V> makeObject();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public OrderedMap<K, V> makeFullMap() {
+        return (OrderedMap<K, V>) super.makeFullMap();
+    }
+
     //-----------------------------------------------------------------------
     /**
      * OrderedMap uses TreeMap as its known comparison.
-     * 
+     *
      * @return a map that is known to be valid
      */
-    public Map makeConfirmedMap() {
-        return new TreeMap(new NullComparator());
+    public Map<K, V> makeConfirmedMap() {
+        return new TreeMap<K, V>(new NullComparator<K>());
     }
-    
+
     /**
      * The only confirmed collection we have that is ordered is the sorted one.
      * Thus, sort the keys.
      */
-    public Object[] getSampleKeys() {
-        List list = new ArrayList(Arrays.asList(super.getSampleKeys()));
-        Collections.sort(list, new NullComparator());
-        return list.toArray();
+    @SuppressWarnings("unchecked")
+    public K[] getSampleKeys() {
+        List<K> list = new ArrayList<K>(Arrays.asList(super.getSampleKeys()));
+        Collections.sort(list, new NullComparator<K>());
+        return (K[]) list.toArray();
     }
 
     //-----------------------------------------------------------------------
     public void testFirstKey() {
         resetEmpty();
-        OrderedMap ordered = (OrderedMap) map;
+        OrderedMap<K, V> ordered = getMap();
         try {
             ordered.firstKey();
             fail();
         } catch (NoSuchElementException ex) {}
-        
+
         resetFull();
-        ordered = (OrderedMap) map;
-        Object confirmedFirst = confirmed.keySet().iterator().next();
+        ordered = getMap();
+        K confirmedFirst = confirmed.keySet().iterator().next();
         assertEquals(confirmedFirst, ordered.firstKey());
     }
-    
+
     public void testLastKey() {
         resetEmpty();
-        OrderedMap ordered = (OrderedMap) map;
+        OrderedMap<K, V> ordered = getMap();
         try {
             ordered.lastKey();
             fail();
         } catch (NoSuchElementException ex) {}
-        
+
         resetFull();
-        ordered = (OrderedMap) map;
-        Object confirmedLast = null;
-        for (Iterator it = confirmed.keySet().iterator(); it.hasNext();) {
+        ordered = getMap();
+        K confirmedLast = null;
+        for (Iterator<K> it = confirmed.keySet().iterator(); it.hasNext();) {
             confirmedLast = it.next();
         }
         assertEquals(confirmedLast, ordered.lastKey());
     }
 
-    //-----------------------------------------------------------------------    
+    //-----------------------------------------------------------------------
     public void testNextKey() {
         resetEmpty();
-        OrderedMap ordered = (OrderedMap) map;
+        OrderedMap<K, V> ordered = getMap();
         assertEquals(null, ordered.nextKey(getOtherKeys()[0]));
-        if (isAllowNullKey() == false) {
+        if (!isAllowNullKey()) {
             try {
                 assertEquals(null, ordered.nextKey(null)); // this is allowed too
             } catch (NullPointerException ex) {}
         } else {
             assertEquals(null, ordered.nextKey(null));
         }
-        
+
         resetFull();
-        ordered = (OrderedMap) map;
-        Iterator it = confirmed.keySet().iterator();
-        Object confirmedLast = it.next();
+        ordered = getMap();
+        Iterator<K> it = confirmed.keySet().iterator();
+        K confirmedLast = it.next();
         while (it.hasNext()) {
-            Object confirmedObject = it.next();
+            K confirmedObject = it.next();
             assertEquals(confirmedObject, ordered.nextKey(confirmedLast));
             confirmedLast = confirmedObject;
         }
         assertEquals(null, ordered.nextKey(confirmedLast));
-        
+
         if (isAllowNullKey() == false) {
             try {
                 ordered.nextKey(null);
@@ -134,10 +149,10 @@ public abstract class AbstractTestOrderedMap extends AbstractTestIterableMap {
             assertEquals(null, ordered.nextKey(null));
         }
     }
-    
+
     public void testPreviousKey() {
         resetEmpty();
-        OrderedMap ordered = (OrderedMap) map;
+        OrderedMap<K, V> ordered = getMap();
         assertEquals(null, ordered.previousKey(getOtherKeys()[0]));
         if (isAllowNullKey() == false) {
             try {
@@ -146,20 +161,20 @@ public abstract class AbstractTestOrderedMap extends AbstractTestIterableMap {
         } else {
             assertEquals(null, ordered.previousKey(null));
         }
-        
+
         resetFull();
-        ordered = (OrderedMap) map;
-        List list = new ArrayList(confirmed.keySet());
+        ordered = getMap();
+        List<K> list = new ArrayList<K>(confirmed.keySet());
         Collections.reverse(list);
-        Iterator it = list.iterator();
-        Object confirmedLast = it.next();
+        Iterator<K> it = list.iterator();
+        K confirmedLast = it.next();
         while (it.hasNext()) {
-            Object confirmedObject = it.next();
+            K confirmedObject = it.next();
             assertEquals(confirmedObject, ordered.previousKey(confirmedLast));
             confirmedLast = confirmedObject;
         }
         assertEquals(null, ordered.previousKey(confirmedLast));
-        
+
         if (isAllowNullKey() == false) {
             try {
                 ordered.previousKey(null);
@@ -171,17 +186,17 @@ public abstract class AbstractTestOrderedMap extends AbstractTestIterableMap {
             }
         }
     }
-    
+
     //-----------------------------------------------------------------------
     public BulkTest bulkTestOrderedMapIterator() {
         return new InnerTestOrderedMapIterator();
     }
-    
-    public class InnerTestOrderedMapIterator extends AbstractTestOrderedMapIterator {
+
+    public class InnerTestOrderedMapIterator extends AbstractTestOrderedMapIterator<K, V> {
         public InnerTestOrderedMapIterator() {
             super("InnerTestOrderedMapIterator");
         }
-        
+
         public boolean supportsRemove() {
             return AbstractTestOrderedMap.this.isRemoveSupported();
         }
@@ -189,35 +204,42 @@ public abstract class AbstractTestOrderedMap extends AbstractTestIterableMap {
         public boolean isGetStructuralModify() {
             return AbstractTestOrderedMap.this.isGetStructuralModify();
         }
-        
+
         public boolean supportsSetValue() {
             return AbstractTestOrderedMap.this.isSetValueSupported();
         }
 
-        public MapIterator makeEmptyMapIterator() {
+        public OrderedMapIterator<K, V> makeEmptyIterator() {
             resetEmpty();
-            return ((OrderedMap) AbstractTestOrderedMap.this.map).orderedMapIterator();
+            return AbstractTestOrderedMap.this.getMap().mapIterator();
         }
 
-        public MapIterator makeFullMapIterator() {
+        public OrderedMapIterator<K, V> makeObject() {
             resetFull();
-            return ((OrderedMap) AbstractTestOrderedMap.this.map).orderedMapIterator();
+            return AbstractTestOrderedMap.this.getMap().mapIterator();
         }
-        
-        public Map getMap() {
+
+        public OrderedMap<K, V> getMap() {
             // assumes makeFullMapIterator() called first
-            return AbstractTestOrderedMap.this.map;
+            return AbstractTestOrderedMap.this.getMap();
         }
-        
-        public Map getConfirmedMap() {
+
+        public Map<K, V> getConfirmedMap() {
             // assumes makeFullMapIterator() called first
-            return AbstractTestOrderedMap.this.confirmed;
+            return AbstractTestOrderedMap.this.getConfirmed();
         }
-        
+
         public void verify() {
             super.verify();
             AbstractTestOrderedMap.this.verify();
         }
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public OrderedMap<K, V> getMap() {
+        return (OrderedMap<K, V>) super.getMap();
+    }
 }


[06/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/list/TestPredicatedList.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/list/TestPredicatedList.java b/src/test/org/apache/commons/collections/list/TestPredicatedList.java
index d6e4259..6a0c09b 100644
--- a/src/test/org/apache/commons/collections/list/TestPredicatedList.java
+++ b/src/test/org/apache/commons/collections/list/TestPredicatedList.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,124 +23,129 @@ import junit.framework.Test;
 import junit.framework.TestSuite;
 
 import org.apache.commons.collections.Predicate;
-import org.apache.commons.collections.PredicateUtils;
+import org.apache.commons.collections.functors.TruePredicate;
 
 /**
- * Extension of {@link TestList} for exercising the 
+ * Extension of {@link TestList} for exercising the
  * {@link PredicatedList} implementation.
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  */
-public class TestPredicatedList extends AbstractTestList {
-    
+public class TestPredicatedList<E> extends AbstractTestList<E> {
+
     public TestPredicatedList(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return new TestSuite(TestPredicatedList.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestPredicatedList.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
-    
+
  //-------------------------------------------------------------------
-    
-    protected Predicate truePredicate = PredicateUtils.truePredicate();
-    
-    protected List decorateList(List list, Predicate predicate) {
+
+    protected Predicate<E> truePredicate = TruePredicate.<E>truePredicate();
+
+    protected List<E> decorateList(List<E> list, Predicate<E> predicate) {
         return PredicatedList.decorate(list, predicate);
     }
-    
-    public List makeEmptyList() {
-        return decorateList(new ArrayList(), truePredicate);
+
+    public List<E> makeObject() {
+        return decorateList(new ArrayList<E>(), truePredicate);
     }
-    
-    public Object[] getFullElements() {
-        return new Object[] {"1", "3", "5", "7", "2", "4", "6"};
+
+    @SuppressWarnings("unchecked")
+    public E[] getFullElements() {
+        return (E[]) new Object[] { "1", "3", "5", "7", "2", "4", "6" };
     }
-    
-//--------------------------------------------------------------------   
-    
-     protected Predicate testPredicate =  
-        new Predicate() {
-            public boolean evaluate(Object o) {
+
+//--------------------------------------------------------------------
+
+    protected Predicate<E> testPredicate =
+        new Predicate<E>() {
+            public boolean evaluate(E o) {
                 return o instanceof String;
             }
-        };      
-    
-    public List makeTestList() {
-        return decorateList(new ArrayList(), testPredicate);
+        };
+
+    public List<E> makeTestList() {
+        return decorateList(new ArrayList<E>(), testPredicate);
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testIllegalAdd() {
-        List list = makeTestList();
+        List<E> list = makeTestList();
         Integer i = new Integer(3);
         try {
-            list.add(i);
+            list.add((E) i);
             fail("Integer should fail string predicate.");
         } catch (IllegalArgumentException e) {
             // expected
         }
-        assertTrue("Collection shouldn't contain illegal element", 
-         !list.contains(i));   
+        assertTrue("Collection shouldn't contain illegal element",
+         !list.contains(i));
     }
 
+    @SuppressWarnings("unchecked")
     public void testIllegalAddAll() {
-        List list = makeTestList();
-        List elements = new ArrayList();
-        elements.add("one");
-        elements.add("two");
-        elements.add(new Integer(3));
-        elements.add("four");
+        List<E> list = makeTestList();
+        List<E> elements = new ArrayList<E>();
+        elements.add((E) "one");
+        elements.add((E) "two");
+        elements.add((E) new Integer(3));
+        elements.add((E) "four");
         try {
-            list.addAll(0,elements);
+            list.addAll(0, elements);
             fail("Integer should fail string predicate.");
         } catch (IllegalArgumentException e) {
             // expected
         }
-        assertTrue("List shouldn't contain illegal element", 
-         !list.contains("one"));   
-        assertTrue("List shouldn't contain illegal element", 
-         !list.contains("two"));   
-        assertTrue("List shouldn't contain illegal element", 
-         !list.contains(new Integer(3)));   
-        assertTrue("List shouldn't contain illegal element", 
-         !list.contains("four"));   
+        assertTrue("List shouldn't contain illegal element",
+         !list.contains("one"));
+        assertTrue("List shouldn't contain illegal element",
+         !list.contains("two"));
+        assertTrue("List shouldn't contain illegal element",
+         !list.contains(new Integer(3)));
+        assertTrue("List shouldn't contain illegal element",
+         !list.contains("four"));
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testIllegalSet() {
-        List list = makeTestList();
+        List<E> list = makeTestList();
         try {
-            list.set(0,new Integer(3));
+            list.set(0, (E) new Integer(3));
             fail("Integer should fail string predicate.");
         } catch (IllegalArgumentException e) {
             // expected
         }
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testLegalAddAll() {
-        List list = makeTestList();
-        list.add("zero");
-        List elements = new ArrayList();
-        elements.add("one");
-        elements.add("two");
-        elements.add("three");
+        List<E> list = makeTestList();
+        list.add((E) "zero");
+        List<E> elements = new ArrayList<E>();
+        elements.add((E) "one");
+        elements.add((E) "two");
+        elements.add((E) "three");
         list.addAll(1,elements);
-        assertTrue("List should contain legal element", 
-         list.contains("zero"));   
-        assertTrue("List should contain legal element", 
-         list.contains("one"));   
-        assertTrue("List should contain legal element", 
-         list.contains("two"));   
-        assertTrue("List should contain legal element", 
-         list.contains("three"));   
-    }       
+        assertTrue("List should contain legal element",
+         list.contains("zero"));
+        assertTrue("List should contain legal element",
+         list.contains("one"));
+        assertTrue("List should contain legal element",
+         list.contains("two"));
+        assertTrue("List should contain legal element",
+         list.contains("three"));
+    }
 
     public String getCompatibilityVersion() {
         return "3.1";

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/list/TestSetUniqueList.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/list/TestSetUniqueList.java b/src/test/org/apache/commons/collections/list/TestSetUniqueList.java
index 6162212..6aa848d 100644
--- a/src/test/org/apache/commons/collections/list/TestSetUniqueList.java
+++ b/src/test/org/apache/commons/collections/list/TestSetUniqueList.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.
@@ -22,6 +22,7 @@ import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.ListIterator;
+import java.util.Set;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -32,11 +33,11 @@ import junit.textui.TestRunner;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Matthew Hawthorne
  * @author Tom Dunham
  */
-public class TestSetUniqueList extends AbstractTestList {
+public class TestSetUniqueList<E> extends AbstractTestList<E> {
 
     public static void main(String[] args) {
         TestRunner.run(suite());
@@ -51,53 +52,54 @@ public class TestSetUniqueList extends AbstractTestList {
     }
 
     //-----------------------------------------------------------------------
-    public List makeEmptyList() {
-        return new SetUniqueList(new ArrayList(), new HashSet());
+    public List<E> makeObject() {
+        return new SetUniqueList<E>(new ArrayList<E>(), new HashSet<E>());
     }
 
     public void testListIteratorSet() {
         // override to block
         resetFull();
-        ListIterator it = getList().listIterator();
+        ListIterator<E> it = getCollection().listIterator();
         it.next();
         try {
             it.set(null);
             fail();
         } catch (UnsupportedOperationException ex) {}
     }
-    
-    public Object[] getFullNonNullElements() {
+
+    @SuppressWarnings("unchecked")
+    public E[] getFullNonNullElements() {
         // override to avoid duplicate "One"
-        return new Object[] {
-            new String(""),
-            new String("One"),
-            new Integer(2),
-            "Three",
-            new Integer(4),
-            new Double(5),
-            new Float(6),
-            "Seven",
-            "Eight",
-            new String("Nine"),
-            new Integer(10),
-            new Short((short)11),
-            new Long(12),
-            "Thirteen",
-            "14",
-            "15",
-            new Byte((byte)16)
+        return (E[]) new Object[] {
+                new String(""),
+                new String("One"),
+                new Integer(2),
+                "Three",
+                new Integer(4),
+                new Double(5),
+                new Float(6),
+                "Seven",
+                "Eight",
+                new String("Nine"),
+                new Integer(10),
+                new Short((short)11),
+                new Long(12),
+                "Thirteen",
+                "14",
+                "15",
+                new Byte((byte)16)
         };
     }
-    
+
     public void testListIteratorAdd() {
         // override to cope with Set behaviour
         resetEmpty();
-        List list1 = getList();
-        List list2 = getConfirmedList();
+        List<E> list1 = getCollection();
+        List<E> list2 = getConfirmed();
 
-        Object[] elements = getOtherElements();  // changed here
-        ListIterator iter1 = list1.listIterator();
-        ListIterator iter2 = list2.listIterator();
+        E[] elements = getOtherElements();  // changed here
+        ListIterator<E> iter1 = list1.listIterator();
+        ListIterator<E> iter2 = list2.listIterator();
 
         for (int i = 0; i < elements.length; i++) {
             iter1.add(elements[i]);
@@ -106,8 +108,8 @@ public class TestSetUniqueList extends AbstractTestList {
         }
 
         resetFull();
-        iter1 = getList().listIterator();
-        iter2 = getConfirmedList().listIterator();
+        iter1 = getCollection().listIterator();
+        iter2 = getConfirmed().listIterator();
         for (int i = 0; i < elements.length; i++) {
             iter1.next();
             iter2.next();
@@ -116,47 +118,48 @@ public class TestSetUniqueList extends AbstractTestList {
             super.verify();  // changed here
         }
     }
-    
+
     public void testCollectionAddAll() {
         // override for set behaviour
         resetEmpty();
-        Object[] elements = getFullElements();
-        boolean r = collection.addAll(Arrays.asList(elements));
-        confirmed.addAll(Arrays.asList(elements));
+        E[] elements = getFullElements();
+        boolean r = getCollection().addAll(Arrays.asList(elements));
+        getConfirmed().addAll(Arrays.asList(elements));
         verify();
         assertTrue("Empty collection should change after addAll", r);
         for (int i = 0; i < elements.length; i++) {
             assertTrue("Collection should contain added element",
-                       collection.contains(elements[i]));
+                    getCollection().contains(elements[i]));
         }
 
         resetFull();
-        int size = collection.size();
+        int size = getCollection().size();
         elements = getOtherElements();
-        r = collection.addAll(Arrays.asList(elements));
-        confirmed.addAll(Arrays.asList(elements));
+        r = getCollection().addAll(Arrays.asList(elements));
+        getConfirmed().addAll(Arrays.asList(elements));
         verify();
         assertTrue("Full collection should change after addAll", r);
         for (int i = 0; i < elements.length; i++) {
             assertTrue("Full collection should contain added element " + i,
-                       collection.contains(elements[i]));
+                    getCollection().contains(elements[i]));
         }
-        assertEquals("Size should increase after addAll", 
-                     size + elements.length, collection.size());
+        assertEquals("Size should increase after addAll",
+                size + elements.length, getCollection().size());
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testListSetByIndex() {
         // override for set behaviour
         resetFull();
-        int size = collection.size();
-        getList().set(0, new Long(1000));
-        assertEquals(size, collection.size());
+        int size = getCollection().size();
+        getCollection().set(0, (E) new Long(1000));
+        assertEquals(size, getCollection().size());
 
-        getList().set(2, new Long(1000));
-        assertEquals(size - 1, collection.size());
-        assertEquals(new Long(1000), getList().get(1));  // set into 2, but shifted down to 1
+        getCollection().set(2, (E) new Long(1000));
+        assertEquals(size - 1, getCollection().size());
+        assertEquals(new Long(1000), getCollection().get(1));  // set into 2, but shifted down to 1
     }
-    
+
     boolean extraVerify = true;
     public void testCollectionIteratorRemove() {
         try {
@@ -166,28 +169,29 @@ public class TestSetUniqueList extends AbstractTestList {
             extraVerify = true;
         }
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void verify() {
         super.verify();
-        
+
         if (extraVerify) {
-            int size = collection.size();
-            getList().add(new Long(1000));
-            assertEquals(size + 1, collection.size());
-
-            getList().add(new Long(1000));
-            assertEquals(size + 1, collection.size());
-            assertEquals(new Long(1000), getList().get(size));
-        
-            getList().remove(size);
+            int size = getCollection().size();
+            getCollection().add((E) new Long(1000));
+            assertEquals(size + 1, getCollection().size());
+
+            getCollection().add((E) new Long(1000));
+            assertEquals(size + 1, getCollection().size());
+            assertEquals(new Long(1000), getCollection().get(size));
+
+            getCollection().remove(size);
         }
     }
-    
+
     //-----------------------------------------------------------------------
     public void testFactory() {
-        Integer[] array = new Integer[] {new Integer(1), new Integer(2), new Integer(1)};
-        ArrayList list = new ArrayList(Arrays.asList(array));
-        final SetUniqueList lset = SetUniqueList.decorate(list);
+        Integer[] array = new Integer[] { new Integer(1), new Integer(2), new Integer(1) };
+        ArrayList<Integer> list = new ArrayList<Integer>(Arrays.asList(array));
+        final SetUniqueList<Integer> lset = SetUniqueList.decorate(list);
 
         assertEquals("Duplicate element was added.", 2, lset.size());
         assertEquals(new Integer(1), lset.get(0));
@@ -196,36 +200,39 @@ public class TestSetUniqueList extends AbstractTestList {
         assertEquals(new Integer(2), list.get(1));
     }
 
+    @SuppressWarnings("unchecked")
     public void testAdd() {
-        final SetUniqueList lset = new SetUniqueList(new ArrayList(), new HashSet());
+        final SetUniqueList<E> lset = new SetUniqueList<E>(new ArrayList<E>(), new HashSet<E>());
 
         // Duplicate element
-        final Object obj = new Integer(1);
+        final E obj = (E) new Integer(1);
         lset.add(obj);
         lset.add(obj);
         assertEquals("Duplicate element was added.", 1, lset.size());
 
         // Unique element
-        lset.add(new Integer(2));
+        lset.add((E) new Integer(2));
         assertEquals("Unique element was not added.", 2, lset.size());
     }
 
+    @SuppressWarnings("unchecked")
     public void testAddAll() {
-        final SetUniqueList lset = new SetUniqueList(new ArrayList(), new HashSet());
+        final SetUniqueList<E> lset = new SetUniqueList<E>(new ArrayList<E>(), new HashSet<E>());
 
         lset.addAll(
-            Arrays.asList(new Integer[] { new Integer(1), new Integer(1)}));
+            Arrays.asList((E[]) new Integer[] { new Integer(1), new Integer(1)}));
 
         assertEquals("Duplicate element was added.", 1, lset.size());
     }
 
+    @SuppressWarnings("unchecked")
     public void testSet() {
-        final SetUniqueList lset = new SetUniqueList(new ArrayList(), new HashSet());
+        final SetUniqueList<E> lset = new SetUniqueList<E>(new ArrayList<E>(), new HashSet<E>());
 
         // Duplicate element
-        final Object obj1 = new Integer(1);
-        final Object obj2 = new Integer(2);
-        final Object obj3 = new Integer(3);
+        final E obj1 = (E) new Integer(1);
+        final E obj2 = (E) new Integer(2);
+        final E obj3 = (E) new Integer(3);
 
         lset.add(obj1);
         lset.add(obj2);
@@ -257,16 +264,17 @@ public class TestSetUniqueList extends AbstractTestList {
         assertSame(obj1, lset.get(0));
     }
 
+    @SuppressWarnings("unchecked")
     public void testListIterator() {
-        final SetUniqueList lset = new SetUniqueList(new ArrayList(), new HashSet());
+        final SetUniqueList<E> lset = new SetUniqueList<E>(new ArrayList<E>(), new HashSet<E>());
 
-        final Object obj1 = new Integer(1);
-        final Object obj2 = new Integer(2);
+        final E obj1 = (E) new Integer(1);
+        final E obj2 = (E) new Integer(2);
         lset.add(obj1);
         lset.add(obj2);
 
         // Attempts to add a duplicate object
-        for (final ListIterator it = lset.listIterator(); it.hasNext();) {
+        for (final ListIterator<E> it = lset.listIterator(); it.hasNext();) {
             it.next();
 
             if (!it.hasNext()) {
@@ -278,36 +286,39 @@ public class TestSetUniqueList extends AbstractTestList {
         assertEquals("Duplicate element was added", 2, lset.size());
     }
 
+    @SuppressWarnings("unchecked")
     public void testUniqueListReInsert() {
-        List l = SetUniqueList.decorate(new LinkedList());
-        l.add(new Object());
-        l.add(new Object());
-        
-        Object a = l.get(0);
-        
+        List<E> l = SetUniqueList.decorate(new LinkedList<E>());
+        l.add((E) new Object());
+        l.add((E) new Object());
+
+        E a = l.get(0);
+
         // duplicate is removed
-        l.set(0, l.get(1)); 
+        l.set(0, l.get(1));
         assertEquals(1, l.size());
-        
-        // old object is added back in 
-        l.add(1, a); 
+
+        // old object is added back in
+        l.add(1, a);
         assertEquals(2, l.size());
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testUniqueListDoubleInsert() {
-        List l = SetUniqueList.decorate(new LinkedList());
-        l.add(new Object());
-        l.add(new Object());
-        
+        List<E> l = SetUniqueList.decorate(new LinkedList<E>());
+        l.add((E) new Object());
+        l.add((E) new Object());
+
         // duplicate is removed
-        l.set(0, l.get(1)); 
+        l.set(0, l.get(1));
         assertEquals(1, l.size());
-        
+
         // duplicate should be removed again
         l.add(1, l.get(0));
         assertEquals(1, l.size());
     }
 
+    @SuppressWarnings("unchecked")
     public void testSetDownwardsInList() {
         /*
          * Checks the following semantics
@@ -315,19 +326,19 @@ public class TestSetUniqueList extends AbstractTestList {
          * set(0,b): [b]->a
          * So UniqList contains [b] and a is returned
          */
-        ArrayList l = new ArrayList();
-        HashSet s = new HashSet();
-        final SetUniqueList ul = new SetUniqueList(l, s);
+        ArrayList<E> l = new ArrayList<E>();
+        HashSet<E> s = new HashSet<E>();
+        final SetUniqueList<E> ul = new SetUniqueList<E>(l, s);
 
-        Object a = new Object();
-        Object b = new Object();
+        E a = (E) new Object();
+        E b = (E) new Object();
         ul.add(a);
         ul.add(b);
         assertEquals(a, l.get(0));
         assertEquals(b, l.get(1));
-        assertTrue(s.contains(a)); 
+        assertTrue(s.contains(a));
         assertTrue(s.contains(b));
-        
+
         assertEquals(a, ul.set(0, b));
         assertEquals(1, s.size());
         assertEquals(1, l.size());
@@ -336,6 +347,7 @@ public class TestSetUniqueList extends AbstractTestList {
         assertFalse(s.contains(a));
     }
 
+    @SuppressWarnings("unchecked")
     public void testSetInBiggerList() {
         /*
          * Checks the following semantics
@@ -343,13 +355,13 @@ public class TestSetUniqueList extends AbstractTestList {
          * set(0,b): [b,c]->a
          * So UniqList contains [b,c] and a is returned
          */
-        ArrayList l = new ArrayList();
-        HashSet s = new HashSet();
-        final SetUniqueList ul = new SetUniqueList(l, s);
+        ArrayList<E> l = new ArrayList<E>();
+        HashSet<E> s = new HashSet<E>();
+        final SetUniqueList<E> ul = new SetUniqueList<E>(l, s);
 
-        Object a = new Object();
-        Object b = new Object();
-        Object c = new Object();
+        E a = (E) new Object();
+        E b = (E) new Object();
+        E c = (E) new Object();
 
         ul.add(a);
         ul.add(b);
@@ -357,10 +369,10 @@ public class TestSetUniqueList extends AbstractTestList {
         assertEquals(a, l.get(0));
         assertEquals(b, l.get(1));
         assertEquals(c, l.get(2));
-        assertTrue(s.contains(a)); 
+        assertTrue(s.contains(a));
         assertTrue(s.contains(b));
         assertTrue(s.contains(c));
-        
+
         assertEquals(a, ul.set(0, b));
         assertEquals(2, s.size());
         assertEquals(2, l.size());
@@ -369,8 +381,9 @@ public class TestSetUniqueList extends AbstractTestList {
         assertFalse(s.contains(a));
         assertTrue(s.contains(b));
         assertTrue(s.contains(c));
-    }    
+    }
 
+    @SuppressWarnings("unchecked")
     public void testSetUpwardsInList() {
         /*
          * Checks the following semantics
@@ -378,13 +391,13 @@ public class TestSetUniqueList extends AbstractTestList {
          * set(1,a): [a,c]->b
          * So UniqList contains [a,c] and b is returned
          */
-        ArrayList l = new ArrayList();
-        HashSet s = new HashSet();
-        final SetUniqueList ul = new SetUniqueList(l, s);
+        ArrayList<E> l = new ArrayList<E>();
+        HashSet<E> s = new HashSet<E>();
+        final SetUniqueList<E> ul = new SetUniqueList<E>(l, s);
 
-        Object a = new String("A");
-        Object b = new String("B");
-        Object c = new String("C");
+        E a = (E) new String("A");
+        E b = (E) new String("B");
+        E c = (E) new String("C");
 
         ul.add(a);
         ul.add(b);
@@ -392,10 +405,10 @@ public class TestSetUniqueList extends AbstractTestList {
         assertEquals(a, l.get(0));
         assertEquals(b, l.get(1));
         assertEquals(c, l.get(2));
-        assertTrue(s.contains(a)); 
+        assertTrue(s.contains(a));
         assertTrue(s.contains(b));
         assertTrue(s.contains(c));
-        
+
         assertEquals(b, ul.set(1, a));
         assertEquals(2, s.size());
         assertEquals(2, l.size());
@@ -418,4 +431,52 @@ public class TestSetUniqueList extends AbstractTestList {
 //        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/SetUniqueList.fullCollection.version3.1.obj");
 //    }
 
+    @SuppressWarnings("unchecked")
+    public void testCollections307() {
+        List<E> list = new ArrayList<E>();
+        List<E> uniqueList = SetUniqueList.decorate(list);
+
+        String hello = "Hello";
+        String world = "World";
+        uniqueList.add((E) hello);
+        uniqueList.add((E) world);
+
+        List<E> subList = list.subList(0, 0);
+        List<E> subUniqueList = uniqueList.subList(0, 0);
+
+        assertFalse(subList.contains(world)); // passes
+        assertFalse(subUniqueList.contains(world)); // fails
+
+        List<E> worldList = new ArrayList<E>();
+        worldList.add((E) world);
+        assertFalse(subList.contains("World")); // passes
+        assertFalse(subUniqueList.contains("World")); // fails
+
+        // repeat the test with a different class than HashSet;
+        // which means subclassing SetUniqueList below
+        list = new ArrayList<E>();
+        uniqueList = new SetUniqueList307(list, new java.util.TreeSet<E>());
+
+        uniqueList.add((E) hello);
+        uniqueList.add((E) world);
+
+        subList = list.subList(0, 0);
+        subUniqueList = uniqueList.subList(0, 0);
+
+        assertFalse(subList.contains(world)); // passes
+        assertFalse(subUniqueList.contains(world)); // fails
+
+        worldList = new ArrayList<E>();
+        worldList.add((E) world);
+        assertFalse(subList.contains("World")); // passes
+        assertFalse(subUniqueList.contains("World")); // fails
+    }
+
+    @SuppressWarnings("serial")
+    class SetUniqueList307 extends SetUniqueList<E> {
+        public SetUniqueList307(List<E> list, Set<E> set) {
+            super(list, set);
+        }
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/list/TestSynchronizedList.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/list/TestSynchronizedList.java b/src/test/org/apache/commons/collections/list/TestSynchronizedList.java
index 9d1006c..bcf71bf 100644
--- a/src/test/org/apache/commons/collections/list/TestSynchronizedList.java
+++ b/src/test/org/apache/commons/collections/list/TestSynchronizedList.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.
@@ -17,7 +17,6 @@
 package org.apache.commons.collections.list;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
 
 import junit.framework.Test;
@@ -29,11 +28,11 @@ import junit.framework.TestSuite;
  *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestSynchronizedList extends AbstractTestList {
-    
+public class TestSynchronizedList<E> extends AbstractTestList<E> {
+
     public TestSynchronizedList(String testName) {
         super(testName);
     }
@@ -47,12 +46,12 @@ public class TestSynchronizedList extends AbstractTestList {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Collection makeConfirmedCollection() {
-        return new ArrayList();
+    public List<E> makeConfirmedCollection() {
+        return new ArrayList<E>();
     }
 
-    public List makeEmptyList() {
-        return SynchronizedList.decorate(new ArrayList());
+    public List<E> makeObject() {
+        return SynchronizedList.decorate(new ArrayList<E>());
     }
 
     public String getCompatibilityVersion() {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/list/TestTransformedList.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/list/TestTransformedList.java b/src/test/org/apache/commons/collections/list/TestTransformedList.java
index 5ef71a7..0346335 100644
--- a/src/test/org/apache/commons/collections/list/TestTransformedList.java
+++ b/src/test/org/apache/commons/collections/list/TestTransformedList.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,13 +18,13 @@ package org.apache.commons.collections.list;
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.List;
 import java.util.ListIterator;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
+import org.apache.commons.collections.Transformer;
 import org.apache.commons.collections.collection.TestTransformedCollection;
 
 /**
@@ -33,11 +33,11 @@ import org.apache.commons.collections.collection.TestTransformedCollection;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestTransformedList extends AbstractTestList {
-    
+public class TestTransformedList<E> extends AbstractTestList<E> {
+
     public TestTransformedList(String testName) {
         super(testName);
     }
@@ -51,67 +51,70 @@ public class TestTransformedList extends AbstractTestList {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Collection makeConfirmedCollection() {
-        return new ArrayList();
+    public List<E> makeConfirmedCollection() {
+        return new ArrayList<E>();
     }
 
-    public Collection makeConfirmedFullCollection() {
-        List list = new ArrayList();
+    public List<E> makeConfirmedFullCollection() {
+        List<E> list = new ArrayList<E>();
         list.addAll(Arrays.asList(getFullElements()));
         return list;
     }
-    
-    public List makeEmptyList() {
-        return TransformedList.decorate(new ArrayList(), TestTransformedCollection.NOOP_TRANSFORMER);
+
+    @SuppressWarnings("unchecked")
+    public List<E> makeObject() {
+        return TransformedList.decorate(new ArrayList<E>(), (Transformer<E, E>) TestTransformedCollection.NOOP_TRANSFORMER);
     }
 
-    public List makeFullList() {
-        List list = new ArrayList();
+    @SuppressWarnings("unchecked")
+    public List<E> makeFullCollection() {
+        List<E> list = new ArrayList<E>();
         list.addAll(Arrays.asList(getFullElements()));
-        return TransformedList.decorate(list, TestTransformedCollection.NOOP_TRANSFORMER);
+        return TransformedList.decorate(list, (Transformer<E, E>) TestTransformedCollection.NOOP_TRANSFORMER);
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testTransformedList() {
-        List list = TransformedList.decorate(new ArrayList(), TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
+        List<E> list = TransformedList.decorate(new ArrayList<E>(), (Transformer<E, E>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(0, list.size());
-        Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
+        E[] els = (E[]) new Object[] {"1", "3", "5", "7", "2", "4", "6"};
         for (int i = 0; i < els.length; i++) {
             list.add(els[i]);
             assertEquals(i + 1, list.size());
             assertEquals(true, list.contains(new Integer((String) els[i])));
             assertEquals(false, list.contains(els[i]));
         }
-        
+
         assertEquals(false, list.remove(els[0]));
         assertEquals(true, list.remove(new Integer((String) els[0])));
-        
+
         list.clear();
         for (int i = 0; i < els.length; i++) {
             list.add(0, els[i]);
             assertEquals(i + 1, list.size());
             assertEquals(new Integer((String) els[i]), list.get(0));
         }
-        
-        list.set(0, "22");
+
+        list.set(0, (E) "22");
         assertEquals(new Integer(22), list.get(0));
-        
-        ListIterator it = list.listIterator();
+
+        ListIterator<E> it = list.listIterator();
         it.next();
-        it.set("33");
+        it.set((E) "33");
         assertEquals(new Integer(33), list.get(0));
-        it.add("44");
+        it.add((E) "44");
         assertEquals(new Integer(44), list.get(1));
-        
-        List adds = new ArrayList();
-        adds.add("1");
-        adds.add("2");
+
+        List<E> adds = new ArrayList<E>();
+        adds.add((E) "1");
+        adds.add((E) "2");
         list.clear();
         list.addAll(adds);
         assertEquals(new Integer(1), list.get(0));
         assertEquals(new Integer(2), list.get(1));
-        
+
         adds.clear();
-        adds.add("3");
+        adds.add((E) "3");
         list.addAll(1, adds);
         assertEquals(new Integer(1), list.get(0));
         assertEquals(new Integer(3), list.get(1));

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/list/TestTreeList.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/list/TestTreeList.java b/src/test/org/apache/commons/collections/list/TestTreeList.java
index c40943e..22381ad 100644
--- a/src/test/org/apache/commons/collections/list/TestTreeList.java
+++ b/src/test/org/apache/commons/collections/list/TestTreeList.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.
@@ -25,14 +25,14 @@ import org.apache.commons.collections.BulkTest;
 
 /**
  * JUnit tests
- * 
+ *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
  *
  * @author Joerg Schmuecker
  */
-public class TestTreeList extends AbstractTestList {
-    
+public class TestTreeList<E> extends AbstractTestList<E> {
+
 	public TestTreeList(String name) {
 		super(name);
 	}
@@ -53,49 +53,49 @@ public class TestTreeList extends AbstractTestList {
         return BulkTest.makeSuite(TestTreeList.class);
     }
 
-    public static void benchmark(List l) {
+    public static void benchmark(List<? super Integer> l) {
         long start = System.currentTimeMillis();
         for (int i = 0; i < 100000; i++) {
             l.add(new Integer(i));
         }
         System.out.print(System.currentTimeMillis() - start + ";");
-        
+
         start = System.currentTimeMillis();
         for (int i = 0; i < 200; i++) {
             l.toArray();
         }
         System.out.print(System.currentTimeMillis() - start + ";");
-        
+
         start = System.currentTimeMillis();
         for (int i = 0; i < 100; i++) {
-            java.util.Iterator it = l.iterator();
+            java.util.Iterator<? super Integer> it = l.iterator();
             while (it.hasNext()) {
                 it.next();
             }
         }
         System.out.print(System.currentTimeMillis() - start + ";");
-        
+
         start = System.currentTimeMillis();
         for (int i = 0; i < 10000; i++) {
             int j = (int) (Math.random() * 100000);
             l.add(j, new Integer(-j));
         }
         System.out.print(System.currentTimeMillis() - start + ";");
-        
+
         start = System.currentTimeMillis();
         for (int i = 0; i < 50000; i++) {
             int j = (int) (Math.random() * 110000);
             l.get(j);
         }
         System.out.print(System.currentTimeMillis() - start + ";");
-        
+
         start = System.currentTimeMillis();
         for (int i = 0; i < 200; i++) {
             int j = (int) (Math.random() * 100000);
             l.indexOf(new Integer(j));
         }
         System.out.print(System.currentTimeMillis() - start + ";");
-        
+
         start = System.currentTimeMillis();
         for (int i = 0; i < 10000; i++) {
             int j = (int) (Math.random() * 100000);
@@ -105,18 +105,19 @@ public class TestTreeList extends AbstractTestList {
     }
 
     //-----------------------------------------------------------------------
-	public List makeEmptyList() {
-		return new TreeList();
+	public TreeList<E> makeObject() {
+		return new TreeList<E>();
 	}
 
     //-----------------------------------------------------------------------
-	public void testAddMultiple() {
-		List l = makeEmptyList();
-		l.add("hugo");
-		l.add("erna");
-		l.add("daniel");
-		l.add("andres");
-		l.add("harald");
+	@SuppressWarnings("unchecked")
+    public void testAddMultiple() {
+		List<E> l = makeObject();
+		l.add((E) "hugo");
+		l.add((E) "erna");
+		l.add((E) "daniel");
+		l.add((E) "andres");
+		l.add((E) "harald");
 		l.add(0, null);
 		assertEquals(null, l.get(0));
 		assertEquals("hugo", l.get(1));
@@ -126,14 +127,15 @@ public class TestTreeList extends AbstractTestList {
 		assertEquals("harald", l.get(5));
 	}
 
-	public void testRemove() {
-		List l = makeEmptyList();
-		l.add("hugo");
-		l.add("erna");
-		l.add("daniel");
-		l.add("andres");
-		l.add("harald");
-		l.add(0, null);
+	@SuppressWarnings("unchecked")
+    public void testRemove() {
+        List<E> l = makeObject();
+        l.add((E) "hugo");
+        l.add((E) "erna");
+        l.add((E) "daniel");
+        l.add((E) "andres");
+        l.add((E) "harald");
+        l.add(0, null);
 		int i = 0;
 		assertEquals(null, l.get(i++));
 		assertEquals("hugo", l.get(i++));
@@ -164,23 +166,25 @@ public class TestTreeList extends AbstractTestList {
 		assertEquals("harald", l.get(i++));
 	}
 
-	public void testInsertBefore() {
-		List l = makeEmptyList();
-		l.add("erna");
-		l.add(0, "hugo");
+	@SuppressWarnings("unchecked")
+    public void testInsertBefore() {
+        List<E> l = makeObject();
+        l.add((E) "erna");
+        l.add(0, (E) "hugo");
 		assertEquals("hugo", l.get(0));
 		assertEquals("erna", l.get(1));
 	}
 
+    @SuppressWarnings("unchecked")
     public void testIndexOf() {
-        List l = makeEmptyList();
-        l.add("0");
-        l.add("1");
-        l.add("2");
-        l.add("3");
-        l.add("4");
-        l.add("5");
-        l.add("6");
+        List<E> l = makeObject();
+        l.add((E) "0");
+        l.add((E) "1");
+        l.add((E) "2");
+        l.add((E) "3");
+        l.add((E) "4");
+        l.add((E) "5");
+        l.add((E) "6");
         assertEquals(0, l.indexOf("0"));
         assertEquals(1, l.indexOf("1"));
         assertEquals(2, l.indexOf("2"));
@@ -188,17 +192,17 @@ public class TestTreeList extends AbstractTestList {
         assertEquals(4, l.indexOf("4"));
         assertEquals(5, l.indexOf("5"));
         assertEquals(6, l.indexOf("6"));
-        
-        l.set(1, "0");
+
+        l.set(1, (E) "0");
         assertEquals(0, l.indexOf("0"));
-        
-        l.set(3, "3");
+
+        l.set(3, (E) "3");
         assertEquals(3, l.indexOf("3"));
-        l.set(2, "3");
+        l.set(2, (E) "3");
         assertEquals(2, l.indexOf("3"));
-        l.set(1, "3");
+        l.set(1, (E) "3");
         assertEquals(1, l.indexOf("3"));
-        l.set(0, "3");
+        l.set(0, (E) "3");
         assertEquals(0, l.indexOf("3"));
     }
 
@@ -214,18 +218,18 @@ public class TestTreeList extends AbstractTestList {
 
     public void testBug35258() {
         Object objectToRemove = new Integer(3);
-        
-        List treelist = new TreeList();
+
+        List<Integer> treelist = new TreeList<Integer>();
         treelist.add(new Integer(0));
         treelist.add(new Integer(1));
         treelist.add(new Integer(2));
         treelist.add(new Integer(3));
         treelist.add(new Integer(4));
-        
+
         // this cause inconsistence of ListIterator()
         treelist.remove(objectToRemove);
-        
-        ListIterator li = treelist.listIterator();
+
+        ListIterator<Integer> li = treelist.listIterator();
         assertEquals(new Integer(0), li.next());
         assertEquals(new Integer(0), li.previous());
         assertEquals(new Integer(0), li.next());

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/list/TestUnmodifiableList.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/list/TestUnmodifiableList.java b/src/test/org/apache/commons/collections/list/TestUnmodifiableList.java
index b4863b9..3ef9a46 100644
--- a/src/test/org/apache/commons/collections/list/TestUnmodifiableList.java
+++ b/src/test/org/apache/commons/collections/list/TestUnmodifiableList.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.
@@ -25,80 +25,82 @@ import junit.framework.Test;
 import junit.framework.TestSuite;
 
 /**
- * Extension of {@link AbstractTestList} for exercising the 
+ * Extension of {@link AbstractTestList} for exercising the
  * {@link UnmodifiableList} implementation.
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  */
-public class TestUnmodifiableList extends AbstractTestList {
-    
+public class TestUnmodifiableList<E> extends AbstractTestList<E> {
+
     public TestUnmodifiableList(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return new TestSuite(TestUnmodifiableList.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestUnmodifiableList.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    //-----------------------------------------------------------------------    
-    public List makeEmptyList() {
-        return UnmodifiableList.decorate(new ArrayList());
+    //-----------------------------------------------------------------------
+    public UnmodifiableList<E> makeObject() {
+        return new UnmodifiableList<E>(new ArrayList<E>());
     }
-    
-    public List makeFullList() {
-        ArrayList list = new ArrayList();
+
+    public UnmodifiableList<E> makeFullCollection() {
+        ArrayList<E> list = new ArrayList<E>();
         list.addAll(Arrays.asList(getFullElements()));
-        return UnmodifiableList.decorate(list);
+        return new UnmodifiableList<E>(list);
     }
-    
+
     public boolean isSetSupported() {
         return false;
     }
-    
+
     public boolean isAddSupported() {
         return false;
     }
-    
+
     public boolean isRemoveSupported() {
         return false;
     }
-    
-    //-----------------------------------------------------------------------    
-    protected UnmodifiableList list = null;
-    protected ArrayList array = null;
-    
+
+    //-----------------------------------------------------------------------
+    protected UnmodifiableList<E> list;
+    protected ArrayList<E> array;
+
+    @SuppressWarnings("unchecked")
     protected void setupList() {
-        list = (UnmodifiableList) makeFullList();
-        array = new ArrayList();
-        array.add(new Integer(1));
+        list = makeFullCollection();
+        array = new ArrayList<E>();
+        array.add((E) new Integer(1));
     }
-    
-    /** 
+
+    /**
      * Verify that base list and sublists are not modifiable
      */
     public void testUnmodifiable() {
         setupList();
-        verifyUnmodifiable(list); 
+        verifyUnmodifiable(list);
         verifyUnmodifiable(list.subList(0, 2));
-    } 
-        
-    protected void verifyUnmodifiable(List list) {
+    }
+
+    @SuppressWarnings("unchecked")
+    protected void verifyUnmodifiable(List<E> list) {
         try {
-            list.add(0, new Integer(0));
+            list.add(0, (E) new Integer(0));
             fail("Expecting UnsupportedOperationException.");
         } catch (UnsupportedOperationException e) {
             // expected
-        } 
+        }
         try {
-            list.add(new Integer(0));
+            list.add((E) new Integer(0));
              fail("Expecting UnsupportedOperationException.");
         } catch (UnsupportedOperationException e) {
             // expected
@@ -146,21 +148,21 @@ public class TestUnmodifiableList extends AbstractTestList {
             // expected
         }
         try {
-            list.set(0, new Integer(0));
+            list.set(0, (E) new Integer(0));
              fail("Expecting UnsupportedOperationException.");
         } catch (UnsupportedOperationException e) {
             // expected
         }
     }
-    
+
     /**
      * Verify that iterator is not modifiable
      */
     public void testUnmodifiableIterator() {
         setupList();
-        Iterator iterator = list.iterator();
+        Iterator<E> iterator = list.iterator();
         try {
-            Object obj = iterator.next();
+            iterator.next();
             iterator.remove();
             fail("Expecting UnsupportedOperationException.");
         } catch (UnsupportedOperationException e) {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/AbstractTestIterableMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/AbstractTestIterableMap.java b/src/test/org/apache/commons/collections/map/AbstractTestIterableMap.java
index 44977ad..0e7b3e1 100644
--- a/src/test/org/apache/commons/collections/map/AbstractTestIterableMap.java
+++ b/src/test/org/apache/commons/collections/map/AbstractTestIterableMap.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,102 +29,116 @@ import org.apache.commons.collections.iterators.AbstractTestMapIterator;
  * Abstract test class for {@link IterableMap} methods and contracts.
  *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public abstract class AbstractTestIterableMap extends AbstractTestMap {
+public abstract class AbstractTestIterableMap<K, V> extends AbstractTestMap<K, V> {
 
     /**
      * JUnit constructor.
-     * 
+     *
      * @param testName  the test name
      */
     public AbstractTestIterableMap(String testName) {
         super(testName);
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public abstract IterableMap<K, V> makeObject();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public IterableMap<K, V> makeFullMap() {
+        return (IterableMap<K, V>) super.makeFullMap();
+    }
+
     //-----------------------------------------------------------------------
     public void testFailFastEntrySet() {
         if (isRemoveSupported() == false) return;
         resetFull();
-        Iterator it = map.entrySet().iterator();
-        Map.Entry val = (Map.Entry) it.next();
-        map.remove(val.getKey());
+        Iterator<Map.Entry<K, V>> it = getMap().entrySet().iterator();
+        Map.Entry<K, V> val = it.next();
+        getMap().remove(val.getKey());
         try {
             it.next();
             fail();
         } catch (ConcurrentModificationException ex) {}
-        
+
         resetFull();
-        it = map.entrySet().iterator();
+        it = getMap().entrySet().iterator();
         it.next();
-        map.clear();
+        getMap().clear();
         try {
             it.next();
             fail();
         } catch (ConcurrentModificationException ex) {}
     }
-    
+
     public void testFailFastKeySet() {
         if (isRemoveSupported() == false) return;
         resetFull();
-        Iterator it = map.keySet().iterator();
-        Object val = it.next();
-        map.remove(val);
+        Iterator<K> it = getMap().keySet().iterator();
+        K val = it.next();
+        getMap().remove(val);
         try {
             it.next();
             fail();
         } catch (ConcurrentModificationException ex) {}
-        
+
         resetFull();
-        it = map.keySet().iterator();
+        it = getMap().keySet().iterator();
         it.next();
-        map.clear();
+        getMap().clear();
         try {
             it.next();
             fail();
         } catch (ConcurrentModificationException ex) {}
     }
-    
+
     public void testFailFastValues() {
         if (isRemoveSupported() == false) return;
         resetFull();
-        Iterator it = map.values().iterator();
+        Iterator<V> it = getMap().values().iterator();
         it.next();
-        map.remove(map.keySet().iterator().next());
+        getMap().remove(getMap().keySet().iterator().next());
         try {
             it.next();
             fail();
         } catch (ConcurrentModificationException ex) {}
-        
+
         resetFull();
-        it = map.values().iterator();
+        it = getMap().values().iterator();
         it.next();
-        map.clear();
+        getMap().clear();
         try {
             it.next();
             fail();
         } catch (ConcurrentModificationException ex) {}
     }
-    
+
     //-----------------------------------------------------------------------
     public BulkTest bulkTestMapIterator() {
         return new InnerTestMapIterator();
     }
-    
-    public class InnerTestMapIterator extends AbstractTestMapIterator {
+
+    public class InnerTestMapIterator extends AbstractTestMapIterator<K, V> {
         public InnerTestMapIterator() {
             super("InnerTestMapIterator");
         }
-        
-        public Object[] addSetValues() {
+
+        public V[] addSetValues() {
             return AbstractTestIterableMap.this.getNewSampleValues();
         }
-        
+
         public boolean supportsRemove() {
             return AbstractTestIterableMap.this.isRemoveSupported();
         }
-        
+
         public boolean isGetStructuralModify() {
             return AbstractTestIterableMap.this.isGetStructuralModify();
         }
@@ -133,36 +147,44 @@ public abstract class AbstractTestIterableMap extends AbstractTestMap {
             return AbstractTestIterableMap.this.isSetValueSupported();
         }
 
-        public MapIterator makeEmptyMapIterator() {
+        public MapIterator<K, V> makeEmptyIterator() {
             resetEmpty();
-            return ((IterableMap) AbstractTestIterableMap.this.map).mapIterator();
+            return AbstractTestIterableMap.this.getMap().mapIterator();
         }
 
-        public MapIterator makeFullMapIterator() {
+        public MapIterator<K, V> makeObject() {
             resetFull();
-            return ((IterableMap) AbstractTestIterableMap.this.map).mapIterator();
+            return AbstractTestIterableMap.this.getMap().mapIterator();
         }
-        
-        public Map getMap() {
+
+        public Map<K, V> getMap() {
             // assumes makeFullMapIterator() called first
-            return AbstractTestIterableMap.this.map;
+            return AbstractTestIterableMap.this.getMap();
         }
-        
-        public Map getConfirmedMap() {
+
+        public Map<K, V> getConfirmedMap() {
             // assumes makeFullMapIterator() called first
-            return AbstractTestIterableMap.this.confirmed;
+            return AbstractTestIterableMap.this.getConfirmed();
         }
-        
+
         public void verify() {
             super.verify();
             AbstractTestIterableMap.this.verify();
         }
     }
-    
+
 //  public void testCreate() throws Exception {
 //      resetEmpty();
 //      writeExternalFormToDisk((Serializable) map, "D:/dev/collections/data/test/HashedMap.emptyCollection.version3.obj");
 //      resetFull();
 //      writeExternalFormToDisk((Serializable) map, "D:/dev/collections/data/test/HashedMap.fullCollection.version3.obj");
 //  }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public IterableMap<K, V> getMap() {
+        return (IterableMap<K, V>) super.getMap();
+    }
 }


[54/77] [abbrv] commons-collections git commit: extract Put, Get, and IterableGet interfaces from IterableMap such that our Maps, which all implement IterableMap, can have their read/write functionality exposed separately.

Posted by ch...@apache.org.
extract Put, Get, and IterableGet interfaces from IterableMap such that our Maps, which all implement IterableMap, can have their read/write functionality exposed separately.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@751890 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/86b30a0e
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/86b30a0e
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/86b30a0e

Branch: refs/heads/collections_jdk5_branch
Commit: 86b30a0eff32757a52b7ea7cf1c58dab92566289
Parents: 7cb8edc
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Mon Mar 9 22:45:37 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Mon Mar 9 22:45:37 2009 +0000

----------------------------------------------------------------------
 .../org/apache/commons/collections/Get.java     | 77 ++++++++++++++++++++
 .../apache/commons/collections/IterableGet.java | 49 +++++++++++++
 .../apache/commons/collections/IterableMap.java | 22 +-----
 .../org/apache/commons/collections/Put.java     | 46 ++++++++++++
 4 files changed, 173 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/86b30a0e/src/java/org/apache/commons/collections/Get.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/Get.java b/src/java/org/apache/commons/collections/Get.java
new file mode 100644
index 0000000..8447076
--- /dev/null
+++ b/src/java/org/apache/commons/collections/Get.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * The "read" subset of the {@link Map} interface.
+ * @since Commons Collections 5
+ * @TODO fix version
+ * @version $Revision$ $Date$
+ * @see Put
+ * @author Matt Benson
+ */
+public interface Get<K, V> {
+
+    /**
+     * @see Map#containsKey(Object)
+     */
+    public boolean containsKey(Object key);
+
+    /**
+     * @see Map#containsValue(Object)
+     */
+    public boolean containsValue(Object value);
+
+    /**
+     * @see Map#entrySet()
+     */
+    public Set<java.util.Map.Entry<K, V>> entrySet();
+
+    /**
+     * @see Map#get(Object)
+     */
+    public V get(Object key);
+
+    /**
+     * @see Map#remove(Object)
+     */
+    public V remove(Object key);
+
+    /**
+     * @see Map#isEmpty()
+     */
+    public boolean isEmpty();
+
+    /**
+     * @see Map#keySet()
+     */
+    public Set<K> keySet();
+
+    /**
+     * @see Map#size()
+     */
+    public int size();
+
+    /**
+     * @see Map#values()
+     */
+    public Collection<V> values();
+}

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/86b30a0e/src/java/org/apache/commons/collections/IterableGet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/IterableGet.java b/src/java/org/apache/commons/collections/IterableGet.java
new file mode 100644
index 0000000..0d10d7b
--- /dev/null
+++ b/src/java/org/apache/commons/collections/IterableGet.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections;
+
+import java.util.Map;
+
+/**
+ * The "read" subset of the {@link Map} interface.
+ * @since Commons Collections 5
+ * @TODO fix version
+ * @version $Revision$ $Date$
+ * @see Put
+ * @author Matt Benson
+ */
+public interface IterableGet<K, V> extends Get<K, V> {
+    /**
+     * Obtains a <code>MapIterator</code> over the map.
+     * <p>
+     * A map iterator is an efficient way of iterating over maps.
+     * There is no need to access the entry set or use Map Entry objects.
+     * <pre>
+     * IterableMap<String,Integer> map = new HashedMap<String,Integer>();
+     * MapIterator<String,Integer> it = map.mapIterator();
+     * while (it.hasNext()) {
+     *   String key = it.next();
+     *   Integer value = it.getValue();
+     *   it.setValue(value + 1);
+     * }
+     * </pre>
+     * 
+     * @return a map iterator
+     */
+    MapIterator<K, V> mapIterator();
+
+}

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/86b30a0e/src/java/org/apache/commons/collections/IterableMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/IterableMap.java b/src/java/org/apache/commons/collections/IterableMap.java
index b4b92e7..91e6256 100644
--- a/src/java/org/apache/commons/collections/IterableMap.java
+++ b/src/java/org/apache/commons/collections/IterableMap.java
@@ -40,25 +40,5 @@ import java.util.Map;
  *
  * @author Stephen Colebourne
  */
-public interface IterableMap<K, V> extends Map<K, V> {
-
-    /**
-     * Obtains a <code>MapIterator</code> over the map.
-     * <p>
-     * A map iterator is an efficient way of iterating over maps.
-     * There is no need to access the entry set or use Map Entry objects.
-     * <pre>
-     * IterableMap<String,Integer> map = new HashedMap<String,Integer>();
-     * MapIterator<String,Integer> it = map.mapIterator();
-     * while (it.hasNext()) {
-     *   String key = it.next();
-     *   Integer value = it.getValue();
-     *   it.setValue(value + 1);
-     * }
-     * </pre>
-     * 
-     * @return a map iterator
-     */
-    MapIterator<K, V> mapIterator();
-
+public interface IterableMap<K, V> extends Map<K, V>, Put<K, V>, IterableGet<K, V> {
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/86b30a0e/src/java/org/apache/commons/collections/Put.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/Put.java b/src/java/org/apache/commons/collections/Put.java
new file mode 100644
index 0000000..ee55a28
--- /dev/null
+++ b/src/java/org/apache/commons/collections/Put.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections;
+
+import java.util.Map;
+
+/**
+ * The "write" subset of the {@link Map} interface.
+ * @since Commons Collections 5
+ * @TODO fix version
+ * @version $Revision$ $Date$
+ * @see Get
+ * @author Matt Benson
+ */
+public interface Put<K, V> {
+
+    /**
+     * @see Map#clear()
+     */
+    public void clear();
+
+    /**
+     * @see Map#put(Object, Object)
+     */
+    public Object put(K key, V value);
+
+    /**
+     * @see Map#putAll(Map)
+     */
+    public void putAll(Map<? extends K, ? extends V> t);
+
+}


[08/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/keyvalue/TestMultiKey.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/keyvalue/TestMultiKey.java b/src/test/org/apache/commons/collections/keyvalue/TestMultiKey.java
index 4ebef26..6202632 100644
--- a/src/test/org/apache/commons/collections/keyvalue/TestMultiKey.java
+++ b/src/test/org/apache/commons/collections/keyvalue/TestMultiKey.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.
@@ -25,9 +25,9 @@ import junit.framework.TestSuite;
 
 /**
  * Unit tests for {@link org.apache.commons.collections.MultiKey}.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TestMultiKey extends TestCase {
@@ -37,7 +37,7 @@ public class TestMultiKey extends TestCase {
     Integer THREE = new Integer(3);
     Integer FOUR = new Integer(4);
     Integer FIVE = new Integer(5);
-    
+
     public TestMultiKey(String name) {
         super(name);
     }
@@ -58,87 +58,87 @@ public class TestMultiKey extends TestCase {
     protected void tearDown() throws Exception {
         super.tearDown();
     }
-    
+
     //-----------------------------------------------------------------------
     public void testConstructors() throws Exception {
-        MultiKey mk = null;
-        mk = new MultiKey(ONE, TWO);
-        Assert.assertTrue(Arrays.equals(new Object[] {ONE, TWO}, mk.getKeys()));
+        MultiKey<Integer> mk = null;
+        mk = new MultiKey<Integer>(ONE, TWO);
+        Assert.assertTrue(Arrays.equals(new Object[] { ONE, TWO }, mk.getKeys()));
 
-        mk = new MultiKey(ONE, TWO, THREE);
-        Assert.assertTrue(Arrays.equals(new Object[] {ONE, TWO, THREE}, mk.getKeys()));
+        mk = new MultiKey<Integer>(ONE, TWO, THREE);
+        Assert.assertTrue(Arrays.equals(new Object[] { ONE, TWO, THREE }, mk.getKeys()));
 
-        mk = new MultiKey(ONE, TWO, THREE, FOUR);
-        Assert.assertTrue(Arrays.equals(new Object[] {ONE, TWO, THREE, FOUR}, mk.getKeys()));
+        mk = new MultiKey<Integer>(ONE, TWO, THREE, FOUR);
+        Assert.assertTrue(Arrays.equals(new Object[] { ONE, TWO, THREE, FOUR }, mk.getKeys()));
 
-        mk = new MultiKey(ONE, TWO, THREE, FOUR, FIVE);
-        Assert.assertTrue(Arrays.equals(new Object[] {ONE, TWO, THREE, FOUR, FIVE}, mk.getKeys()));
+        mk = new MultiKey<Integer>(ONE, TWO, THREE, FOUR, FIVE);
+        Assert.assertTrue(Arrays.equals(new Object[] { ONE, TWO, THREE, FOUR, FIVE }, mk.getKeys()));
 
-        mk = new MultiKey(new Object[] {THREE, FOUR, ONE, TWO}, false);
-        Assert.assertTrue(Arrays.equals(new Object[] {THREE, FOUR, ONE, TWO}, mk.getKeys()));
+        mk = new MultiKey<Integer>(new Integer[] { THREE, FOUR, ONE, TWO }, false);
+        Assert.assertTrue(Arrays.equals(new Object[] { THREE, FOUR, ONE, TWO }, mk.getKeys()));
     }
-    
+
     public void testConstructorsByArray() throws Exception {
-        MultiKey mk = null;
-        Object[] keys = new Object[] {THREE, FOUR, ONE, TWO};
-        mk = new MultiKey(keys);
-        Assert.assertTrue(Arrays.equals(new Object[] {THREE, FOUR, ONE, TWO}, mk.getKeys()));
+        MultiKey<Integer> mk = null;
+        Integer[] keys = new Integer[] { THREE, FOUR, ONE, TWO };
+        mk = new MultiKey<Integer>(keys);
+        Assert.assertTrue(Arrays.equals(new Object[] { THREE, FOUR, ONE, TWO }, mk.getKeys()));
         keys[3] = FIVE;  // no effect
-        Assert.assertTrue(Arrays.equals(new Object[] {THREE, FOUR, ONE, TWO}, mk.getKeys()));
+        Assert.assertTrue(Arrays.equals(new Object[] { THREE, FOUR, ONE, TWO }, mk.getKeys()));
 
-        keys = new Object[] {};
-        mk = new MultiKey(keys);
+        keys = new Integer[] {};
+        mk = new MultiKey<Integer>(keys);
         Assert.assertTrue(Arrays.equals(new Object[] {}, mk.getKeys()));
 
-        keys = new Object[] {THREE, FOUR, ONE, TWO};
-        mk = new MultiKey(keys, true);
-        Assert.assertTrue(Arrays.equals(new Object[] {THREE, FOUR, ONE, TWO}, mk.getKeys()));
+        keys = new Integer[] { THREE, FOUR, ONE, TWO };
+        mk = new MultiKey<Integer>(keys, true);
+        Assert.assertTrue(Arrays.equals(new Object[] { THREE, FOUR, ONE, TWO }, mk.getKeys()));
         keys[3] = FIVE;  // no effect
-        Assert.assertTrue(Arrays.equals(new Object[] {THREE, FOUR, ONE, TWO}, mk.getKeys()));
+        Assert.assertTrue(Arrays.equals(new Object[] { THREE, FOUR, ONE, TWO }, mk.getKeys()));
 
-        keys = new Object[] {THREE, FOUR, ONE, TWO};
-        mk = new MultiKey(keys, false);
-        Assert.assertTrue(Arrays.equals(new Object[] {THREE, FOUR, ONE, TWO}, mk.getKeys()));
+        keys = new Integer[] { THREE, FOUR, ONE, TWO };
+        mk = new MultiKey<Integer>(keys, false);
+        Assert.assertTrue(Arrays.equals(new Object[] { THREE, FOUR, ONE, TWO }, mk.getKeys()));
         // change key - don't do this!
         // the hashcode of the MultiKey is now broken
         keys[3] = FIVE;
-        Assert.assertTrue(Arrays.equals(new Object[] {THREE, FOUR, ONE, FIVE}, mk.getKeys()));
-    }        
-    
+        Assert.assertTrue(Arrays.equals(new Object[] { THREE, FOUR, ONE, FIVE }, mk.getKeys()));
+    }
+
     public void testConstructorsByArrayNull() throws Exception {
-        Object[] keys = null;
+        Integer[] keys = null;
         try {
-            new MultiKey(keys);
+            new MultiKey<Integer>(keys);
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            new MultiKey(keys, true);
+            new MultiKey<Integer>(keys, true);
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            new MultiKey(keys, false);
+            new MultiKey<Integer>(keys, false);
             fail();
         } catch (IllegalArgumentException ex) {}
     }
-    
+
     public void testSize() {
-        Assert.assertEquals(2, new MultiKey(ONE, TWO).size());
-        Assert.assertEquals(2, new MultiKey(null, null).size());
-        Assert.assertEquals(3, new MultiKey(ONE, TWO, THREE).size());
-        Assert.assertEquals(3, new MultiKey(null, null, null).size());
-        Assert.assertEquals(4, new MultiKey(ONE, TWO, THREE, FOUR).size());
-        Assert.assertEquals(4, new MultiKey(null, null, null, null).size());
-        Assert.assertEquals(5, new MultiKey(ONE, TWO, THREE, FOUR, FIVE).size());
-        Assert.assertEquals(5, new MultiKey(null, null, null, null, null).size());
-        
-        Assert.assertEquals(0, new MultiKey(new Object[] {}).size());
-        Assert.assertEquals(1, new MultiKey(new Object[] {ONE}).size());
-        Assert.assertEquals(2, new MultiKey(new Object[] {ONE, TWO}).size());
-        Assert.assertEquals(7, new MultiKey(new Object[] {ONE, TWO, ONE, TWO, ONE, TWO, ONE}).size());
+        Assert.assertEquals(2, new MultiKey<Integer>(ONE, TWO).size());
+        Assert.assertEquals(2, new MultiKey<Object>(null, null).size());
+        Assert.assertEquals(3, new MultiKey<Integer>(ONE, TWO, THREE).size());
+        Assert.assertEquals(3, new MultiKey<Object>(null, null, null).size());
+        Assert.assertEquals(4, new MultiKey<Integer>(ONE, TWO, THREE, FOUR).size());
+        Assert.assertEquals(4, new MultiKey<Object>(null, null, null, null).size());
+        Assert.assertEquals(5, new MultiKey<Integer>(ONE, TWO, THREE, FOUR, FIVE).size());
+        Assert.assertEquals(5, new MultiKey<Object>(null, null, null, null, null).size());
+
+        Assert.assertEquals(0, new MultiKey<Object>(new Object[] {}).size());
+        Assert.assertEquals(1, new MultiKey<Integer>(new Integer[] { ONE }).size());
+        Assert.assertEquals(2, new MultiKey<Integer>(new Integer[] { ONE, TWO }).size());
+        Assert.assertEquals(7, new MultiKey<Integer>(new Integer[] { ONE, TWO, ONE, TWO, ONE, TWO, ONE }).size());
     }
-    
+
     public void testGetIndexed() {
-        MultiKey mk = new MultiKey(ONE, TWO);
+        MultiKey<Integer> mk = new MultiKey<Integer>(ONE, TWO);
         Assert.assertSame(ONE, mk.getKey(0));
         Assert.assertSame(TWO, mk.getKey(1));
         try {
@@ -150,18 +150,18 @@ public class TestMultiKey extends TestCase {
             fail();
         } catch (IndexOutOfBoundsException ex) {}
     }
-    
+
     public void testGetKeysSimpleConstructor() {
-        MultiKey mk = new MultiKey(ONE, TWO);
+        MultiKey<Integer> mk = new MultiKey<Integer>(ONE, TWO);
         Object[] array = mk.getKeys();
         Assert.assertSame(ONE, array[0]);
         Assert.assertSame(TWO, array[1]);
         Assert.assertEquals(2, array.length);
     }
-    
+
     public void testGetKeysArrayConstructorCloned() {
-        Object[] keys = new Object[] {ONE, TWO};
-        MultiKey mk = new MultiKey(keys, true);
+        Integer[] keys = new Integer[] { ONE, TWO };
+        MultiKey<Integer> mk = new MultiKey<Integer>(keys, true);
         Object[] array = mk.getKeys();
         Assert.assertTrue(array != keys);
         Assert.assertTrue(Arrays.equals(array, keys));
@@ -169,10 +169,10 @@ public class TestMultiKey extends TestCase {
         Assert.assertSame(TWO, array[1]);
         Assert.assertEquals(2, array.length);
     }
-    
+
     public void testGetKeysArrayConstructorNonCloned() {
-        Object[] keys = new Object[] {ONE, TWO};
-        MultiKey mk = new MultiKey(keys, false);
+        Integer[] keys = new Integer[] { ONE, TWO };
+        MultiKey<Integer> mk = new MultiKey<Integer>(keys, false);
         Object[] array = mk.getKeys();
         Assert.assertTrue(array != keys);  // still not equal
         Assert.assertTrue(Arrays.equals(array, keys));
@@ -180,30 +180,30 @@ public class TestMultiKey extends TestCase {
         Assert.assertSame(TWO, array[1]);
         Assert.assertEquals(2, array.length);
     }
-    
+
     public void testHashCode() {
-        MultiKey mk1 = new MultiKey(ONE, TWO);
-        MultiKey mk2 = new MultiKey(ONE, TWO);
-        MultiKey mk3 = new MultiKey(ONE, "TWO");
-        
+        MultiKey<Integer> mk1 = new MultiKey<Integer>(ONE, TWO);
+        MultiKey<Integer> mk2 = new MultiKey<Integer>(ONE, TWO);
+        MultiKey<Object> mk3 = new MultiKey<Object>(ONE, "TWO");
+
         Assert.assertTrue(mk1.hashCode() == mk1.hashCode());
         Assert.assertTrue(mk1.hashCode() == mk2.hashCode());
         Assert.assertTrue(mk1.hashCode() != mk3.hashCode());
-        
+
         int total = (0 ^ ONE.hashCode()) ^ TWO.hashCode();
         Assert.assertEquals(total, mk1.hashCode());
     }
-    
+
     public void testEquals() {
-        MultiKey mk1 = new MultiKey(ONE, TWO);
-        MultiKey mk2 = new MultiKey(ONE, TWO);
-        MultiKey mk3 = new MultiKey(ONE, "TWO");
-        
+        MultiKey<Integer> mk1 = new MultiKey<Integer>(ONE, TWO);
+        MultiKey<Integer> mk2 = new MultiKey<Integer>(ONE, TWO);
+        MultiKey<Object> mk3 = new MultiKey<Object>(ONE, "TWO");
+
         Assert.assertEquals(mk1, mk1);
         Assert.assertEquals(mk1, mk2);
         Assert.assertTrue(mk1.equals(mk3) == false);
         Assert.assertTrue(mk1.equals("") == false);
         Assert.assertTrue(mk1.equals(null) == false);
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/keyvalue/TestTiedMapEntry.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/keyvalue/TestTiedMapEntry.java b/src/test/org/apache/commons/collections/keyvalue/TestTiedMapEntry.java
index 9a2ec72..d3b812a 100644
--- a/src/test/org/apache/commons/collections/keyvalue/TestTiedMapEntry.java
+++ b/src/test/org/apache/commons/collections/keyvalue/TestTiedMapEntry.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,17 +24,16 @@ import junit.framework.TestSuite;
 
 /**
  * Test the TiedMapEntry class.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestTiedMapEntry extends AbstractTestMapEntry {
+public class TestTiedMapEntry<K, V> extends AbstractTestMapEntry<K, V> {
 
     public TestTiedMapEntry(String testName) {
         super(testName);
-
     }
 
     public static void main(String[] args) {
@@ -49,10 +48,10 @@ public class TestTiedMapEntry extends AbstractTestMapEntry {
     /**
      * Gets the instance to test
      */
-    public Map.Entry makeMapEntry(Object key, Object value) {
-        Map map = new HashMap();
+    public Map.Entry<K, V> makeMapEntry(K key, V value) {
+        Map<K, V> map = new HashMap<K, V>();
         map.put(key, value);
-        return new TiedMapEntry(map, key);
+        return new TiedMapEntry<K, V>(map, key);
     }
 
     //-----------------------------------------------------------------------
@@ -66,29 +65,30 @@ public class TestTiedMapEntry extends AbstractTestMapEntry {
     /**
      * Tests the constructors.
      */
+    @SuppressWarnings("unchecked")
     public void testSetValue() {
-        Map map = new HashMap();
-        map.put("A", "a");
-        map.put("B", "b");
-        map.put("C", "c");
-        Map.Entry entry = new TiedMapEntry(map, "A");
+        Map<K, V> map = new HashMap<K, V>();
+        map.put((K) "A", (V) "a");
+        map.put((K) "B", (V) "b");
+        map.put((K) "C", (V) "c");
+        Map.Entry<K, V> entry = new TiedMapEntry<K, V>(map, (K) "A");
         assertSame("A", entry.getKey());
         assertSame("a", entry.getValue());
-        assertSame("a", entry.setValue("x"));
+        assertSame("a", entry.setValue((V) "x"));
         assertSame("A", entry.getKey());
         assertSame("x", entry.getValue());
-        
-        entry = new TiedMapEntry(map, "B");
+
+        entry = new TiedMapEntry<K, V>(map, (K) "B");
         assertSame("B", entry.getKey());
         assertSame("b", entry.getValue());
-        assertSame("b", entry.setValue("y"));
+        assertSame("b", entry.setValue((V) "y"));
         assertSame("B", entry.getKey());
         assertSame("y", entry.getValue());
-        
-        entry = new TiedMapEntry(map, "C");
+
+        entry = new TiedMapEntry<K, V>(map, (K) "C");
         assertSame("C", entry.getKey());
         assertSame("c", entry.getValue());
-        assertSame("c", entry.setValue("z"));
+        assertSame("c", entry.setValue((V) "z"));
         assertSame("C", entry.getKey());
         assertSame("z", entry.getValue());
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/keyvalue/TestUnmodifiableMapEntry.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/keyvalue/TestUnmodifiableMapEntry.java b/src/test/org/apache/commons/collections/keyvalue/TestUnmodifiableMapEntry.java
index 27711d9..9c3398f 100644
--- a/src/test/org/apache/commons/collections/keyvalue/TestUnmodifiableMapEntry.java
+++ b/src/test/org/apache/commons/collections/keyvalue/TestUnmodifiableMapEntry.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.
@@ -26,17 +26,16 @@ import org.apache.commons.collections.Unmodifiable;
 
 /**
  * Test the UnmodifiableMapEntry class.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Neil O'Toole
  */
-public class TestUnmodifiableMapEntry extends AbstractTestMapEntry {
+public class TestUnmodifiableMapEntry<K, V> extends AbstractTestMapEntry<K, V> {
 
     public TestUnmodifiableMapEntry(String testName) {
         super(testName);
-
     }
 
     public static void main(String[] args) {
@@ -53,8 +52,8 @@ public class TestUnmodifiableMapEntry extends AbstractTestMapEntry {
      * Subclasses should override this method to return a Map.Entry
      * of the type being tested.
      */
-    public Map.Entry makeMapEntry() {
-        return new UnmodifiableMapEntry(null, null);
+    public Map.Entry<K, V> makeMapEntry() {
+        return new UnmodifiableMapEntry<K, V>(null, null);
     }
 
     /**
@@ -62,8 +61,8 @@ public class TestUnmodifiableMapEntry 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 UnmodifiableMapEntry(key, value);
+    public Map.Entry<K, V> makeMapEntry(K key, V value) {
+        return new UnmodifiableMapEntry<K, V>(key, value);
     }
 
     //-----------------------------------------------------------------------
@@ -71,28 +70,30 @@ public class TestUnmodifiableMapEntry extends AbstractTestMapEntry {
      * Subclasses should override this method.
      *
      */
+    @SuppressWarnings("unchecked")
     public void testConstructors() {
         // 1. test key-value constructor
-        Map.Entry entry = new UnmodifiableMapEntry(key, value);
+        Map.Entry<K, V> entry = new UnmodifiableMapEntry<K, V>((K) key, (V) value);
         assertSame(key, entry.getKey());
         assertSame(value, entry.getValue());
 
         // 2. test pair constructor
-        KeyValue pair = new DefaultKeyValue(key, value);
-        entry = new UnmodifiableMapEntry(pair);
+        KeyValue<K, V> pair = new DefaultKeyValue<K, V>((K) key, (V) value);
+        entry = new UnmodifiableMapEntry<K, V>(pair);
         assertSame(key, entry.getKey());
         assertSame(value, entry.getValue());
 
         // 3. test copy constructor
-        Map.Entry entry2 = new UnmodifiableMapEntry(entry);
+        Map.Entry<K, V> entry2 = new UnmodifiableMapEntry<K, V>(entry);
         assertSame(key, entry2.getKey());
         assertSame(value, entry2.getValue());
 
         assertTrue(entry instanceof Unmodifiable);
     }
 
+    @SuppressWarnings("unchecked")
     public void testAccessorsAndMutators() {
-        Map.Entry entry = makeMapEntry(key, value);
+        Map.Entry<K, V> entry = makeMapEntry((K) key, (V) value);
 
         assertSame(key, entry.getKey());
         assertSame(value, entry.getValue());
@@ -108,11 +109,10 @@ public class TestUnmodifiableMapEntry extends AbstractTestMapEntry {
     }
 
     public void testUnmodifiable() {
-        Map.Entry entry = makeMapEntry();
+        Map.Entry<K, V> entry = makeMapEntry();
         try {
             entry.setValue(null);
             fail();
-
         } catch (UnsupportedOperationException ex) {}
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/list/AbstractTestList.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/list/AbstractTestList.java b/src/test/org/apache/commons/collections/list/AbstractTestList.java
index ee1a912..c3f654a 100644
--- a/src/test/org/apache/commons/collections/list/AbstractTestList.java
+++ b/src/test/org/apache/commons/collections/list/AbstractTestList.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.
@@ -47,17 +47,17 @@ import org.apache.commons.collections.iterators.AbstractTestListIterator;
  * protected methods from AbstractTestCollection.
  *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Rodney Waldhoff
  * @author Paul Jack
  * @author Stephen Colebourne
  * @author Neil O'Toole
  */
-public abstract class AbstractTestList extends AbstractTestCollection {
+public abstract class AbstractTestList<E> extends AbstractTestCollection<E> {
 
     /**
      * JUnit constructor.
-     * 
+     *
      * @param testName  the test class name
      */
     public AbstractTestList(String testName) {
@@ -66,7 +66,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
 
     //-----------------------------------------------------------------------
     /**
-     *  Returns true if the collections produced by 
+     *  Returns true if the collections produced by
      *  {@link #makeCollection()} and {@link #makeFullCollection()}
      *  support the <code>set operation.<p>
      *  Default implementation returns true.  Override if your collection
@@ -81,11 +81,12 @@ public abstract class AbstractTestList extends AbstractTestCollection {
      *  Verifies that the test list implementation matches the confirmed list
      *  implementation.
      */
+    @SuppressWarnings("unchecked")
     public void verify() {
         super.verify();
 
-        List list1 = getList();
-        List list2 = getConfirmedList();
+        List<E> list1 = getCollection();
+        List<E> list2 = getConfirmed();
 
         assertEquals("List should equal confirmed", list1, list2);
         assertEquals("Confirmed should equal list", list2, list1);
@@ -93,9 +94,9 @@ public abstract class AbstractTestList extends AbstractTestCollection {
         assertEquals("Hash codes should be equal", list1.hashCode(), list2.hashCode());
 
         int i = 0;
-        Iterator iterator1 = list1.iterator();
-        Iterator iterator2 = list2.iterator();
-        Object[] array = list1.toArray();
+        Iterator<E> iterator1 = list1.iterator();
+        Iterator<E> iterator2 = list2.iterator();
+        E[] array = (E[]) list1.toArray();
         while (iterator2.hasNext()) {
             assertTrue("List iterator should have next", iterator1.hasNext());
             Object o1 = iterator1.next();
@@ -120,35 +121,16 @@ public abstract class AbstractTestList extends AbstractTestCollection {
     /**
      * Returns an empty {@link ArrayList}.
      */
-    public Collection makeConfirmedCollection() {
-        ArrayList list = new ArrayList();
+    public Collection<E> makeConfirmedCollection() {
+        ArrayList<E> list = new ArrayList<E>();
         return list;
     }
 
     /**
      * Returns a full {@link ArrayList}.
      */
-    public Collection makeConfirmedFullCollection() {
-        ArrayList list = new ArrayList();
-        list.addAll(Arrays.asList(getFullElements()));
-        return list;
-    }
-
-    /**
-     * Return a new, empty {@link List} to be used for testing.
-     *
-     * @return an empty list for testing.
-     */
-    public abstract List makeEmptyList();
-
-    /**
-     * Return a new, full {@link List} to be used for testing.
-     *
-     * @return a full list for testing
-     */
-    public List makeFullList() {
-        // only works if list supports optional "addAll(Collection)" 
-        List list = makeEmptyList();
+    public Collection<E> makeConfirmedFullCollection() {
+        ArrayList<E> list = new ArrayList<E>();
         list.addAll(Arrays.asList(getFullElements()));
         return list;
     }
@@ -158,17 +140,16 @@ public abstract class AbstractTestList extends AbstractTestCollection {
      *
      * @return an empty list to be used for testing
      */
-    public final Collection makeCollection() {
-        return makeEmptyList();
-    }
+    public abstract List<E> makeObject();
 
     /**
-     * Returns {@link #makeFullList()}.
-     *
-     * @return a full list to be used for testing
+     * {@inheritDoc}
      */
-    public final Collection makeFullCollection() {
-        return makeFullList();
+    public List<E> makeFullCollection() {
+        // only works if list supports optional "addAll(Collection)"
+        List<E> list = makeObject();
+        list.addAll(Arrays.asList(getFullElements()));
+        return list;
     }
 
     //-----------------------------------------------------------------------
@@ -177,8 +158,9 @@ public abstract class AbstractTestList extends AbstractTestCollection {
      *
      * @return the collection field as a List
      */
-    public List getList() {
-        return (List) collection;
+    @Override
+    public List<E> getCollection() {
+        return (List<E>) super.getCollection();
     }
 
     /**
@@ -186,8 +168,8 @@ public abstract class AbstractTestList extends AbstractTestCollection {
      *
      * @return the confirmed field as a List
      */
-    public List getConfirmedList() {
-        return (List) confirmed;
+    public List<E> getConfirmed() {
+        return (List<E>) super.getConfirmed();
     }
 
     //-----------------------------------------------------------------------
@@ -200,11 +182,11 @@ public abstract class AbstractTestList extends AbstractTestCollection {
             return;
         }
 
-        List list;
-        Object element = getOtherElements()[0];
+        List<E> list;
+        E element = getOtherElements()[0];
 
         try {
-            list = makeEmptyList();
+            list = makeObject();
             list.add(Integer.MIN_VALUE, element);
             fail("List.add should throw IndexOutOfBoundsException [Integer.MIN_VALUE]");
         } catch (IndexOutOfBoundsException e) {
@@ -212,7 +194,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
         }
 
         try {
-            list = makeEmptyList();
+            list = makeObject();
             list.add(-1, element);
             fail("List.add should throw IndexOutOfBoundsException [-1]");
         } catch (IndexOutOfBoundsException e) {
@@ -220,7 +202,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
         }
 
         try {
-            list = makeEmptyList();
+            list = makeObject();
             list.add(1, element);
             fail("List.add should throw IndexOutOfBoundsException [1]");
         } catch (IndexOutOfBoundsException e) {
@@ -228,7 +210,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
         }
 
         try {
-            list = makeEmptyList();
+            list = makeObject();
             list.add(Integer.MAX_VALUE, element);
             fail("List.add should throw IndexOutOfBoundsException [Integer.MAX_VALUE]");
         } catch (IndexOutOfBoundsException e) {
@@ -245,11 +227,11 @@ public abstract class AbstractTestList extends AbstractTestCollection {
             return;
         }
 
-        List list;
-        Object element = getOtherElements()[0];
+        List<E> list;
+        E element = getOtherElements()[0];
 
         try {
-            list = makeFullList();
+            list = makeFullCollection();
             list.add(Integer.MIN_VALUE, element);
             fail("List.add should throw IndexOutOfBoundsException [Integer.MIN_VALUE]");
         } catch (IndexOutOfBoundsException e) {
@@ -257,7 +239,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
         }
 
         try {
-            list = makeFullList();
+            list = makeFullCollection();
             list.add(-1, element);
             fail("List.add should throw IndexOutOfBoundsException [-1]");
         } catch (IndexOutOfBoundsException e) {
@@ -265,7 +247,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
         }
 
         try {
-            list = makeFullList();
+            list = makeFullCollection();
             list.add(list.size() + 1, element);
             fail("List.add should throw IndexOutOfBoundsException [size + 1]");
         } catch (IndexOutOfBoundsException e) {
@@ -273,7 +255,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
         }
 
         try {
-            list = makeFullList();
+            list = makeFullCollection();
             list.add(Integer.MAX_VALUE, element);
             fail("List.add should throw IndexOutOfBoundsException [Integer.MAX_VALUE]");
         } catch (IndexOutOfBoundsException e) {
@@ -289,13 +271,13 @@ public abstract class AbstractTestList extends AbstractTestCollection {
             return;
         }
 
-        Object element = getOtherElements()[0];
+        E element = getOtherElements()[0];
         int max = getFullElements().length;
 
         for (int i = 0; i <= max; i++) {
             resetFull();
-            ((List) collection).add(i, element);
-            ((List) confirmed).add(i, element);
+            ((List<E>) getCollection()).add(i, element);
+            ((List<E>) getConfirmed()).add(i, element);
             verify();
         }
     }
@@ -305,13 +287,13 @@ public abstract class AbstractTestList extends AbstractTestCollection {
      */
     public void testListEquals() {
         resetEmpty();
-        List list = getList();
-        assertEquals("Empty lists should be equal", true, list.equals(confirmed));
+        List<E> list = getCollection();
+        assertEquals("Empty lists should be equal", true, list.equals(getConfirmed()));
         verify();
         assertEquals("Empty list should equal self", true, list.equals(list));
         verify();
 
-        List list2 = Arrays.asList(getFullElements());
+        List<E> list2 = Arrays.asList(getFullElements());
         assertEquals("Empty list shouldn't equal full", false, list.equals(list2));
         verify();
 
@@ -320,13 +302,13 @@ public abstract class AbstractTestList extends AbstractTestCollection {
         verify();
 
         resetFull();
-        list = getList();
-        assertEquals("Full lists should be equal", true, list.equals(confirmed));
+        list = getCollection();
+        assertEquals("Full lists should be equal", true, list.equals(getConfirmed()));
         verify();
         assertEquals("Full list should equal self", true, list.equals(list));
         verify();
 
-        list2 = makeEmptyList();
+        list2 = makeObject();
         assertEquals("Full list shouldn't equal empty", false, list.equals(list2));
         verify();
 
@@ -338,8 +320,8 @@ public abstract class AbstractTestList extends AbstractTestCollection {
         if (list2.size() < 2 && isAddSupported()) {
             // main list is only size 1, so lets add other elements to get a better list
             list.addAll(Arrays.asList(getOtherElements()));
-            confirmed.addAll(Arrays.asList(getOtherElements()));
-            list2 = new ArrayList(list2);
+            getConfirmed().addAll(Arrays.asList(getOtherElements()));
+            list2 = new ArrayList<E>(list2);
             list2.addAll(Arrays.asList(getOtherElements()));
         }
         if (list2.size() > 1) {
@@ -351,17 +333,17 @@ public abstract class AbstractTestList extends AbstractTestCollection {
         }
 
         resetFull();
-        list = getList();
+        list = getCollection();
         assertEquals("List shouldn't equal String", false, list.equals(""));
         verify();
 
-        final List listForC = Arrays.asList(getFullElements());
-        Collection c = new AbstractCollection() {
+        final List<E> listForC = Arrays.asList(getFullElements());
+        Collection<E> c = new AbstractCollection<E>() {
             public int size() {
                 return listForC.size();
             }
 
-            public Iterator iterator() {
+            public Iterator<E> iterator() {
                 return listForC.iterator();
             }
         };
@@ -375,14 +357,14 @@ public abstract class AbstractTestList extends AbstractTestCollection {
      */
     public void testListHashCode() {
         resetEmpty();
-        int hash1 = collection.hashCode();
-        int hash2 = confirmed.hashCode();
+        int hash1 = getCollection().hashCode();
+        int hash2 = getConfirmed().hashCode();
         assertEquals("Empty lists should have equal hashCodes", hash1, hash2);
         verify();
 
         resetFull();
-        hash1 = collection.hashCode();
-        hash2 = confirmed.hashCode();
+        hash1 = getCollection().hashCode();
+        hash2 = getConfirmed().hashCode();
         assertEquals("Full lists should have equal hashCodes", hash1, hash2);
         verify();
     }
@@ -392,8 +374,8 @@ public abstract class AbstractTestList extends AbstractTestCollection {
      */
     public void testListGetByIndex() {
         resetFull();
-        List list = getList();
-        Object[] elements = getFullElements();
+        List<E> list = getCollection();
+        E[] elements = getFullElements();
         for (int i = 0; i < elements.length; i++) {
             assertEquals("List should contain correct elements", elements[i], list.get(i));
             verify();
@@ -405,7 +387,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
      *  empty list.
      */
     public void testListGetByIndexBoundsChecking() {
-        List list = makeEmptyList();
+        List<E> list = makeObject();
 
         try {
             list.get(Integer.MIN_VALUE);
@@ -448,7 +430,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
      *  full list.
      */
     public void testListGetByIndexBoundsChecking2() {
-        List list = makeFullList();
+        List<E> list = makeFullCollection();
 
         try {
             list.get(Integer.MIN_VALUE);
@@ -484,10 +466,10 @@ public abstract class AbstractTestList extends AbstractTestCollection {
      */
     public void testListIndexOf() {
         resetFull();
-        List list1 = getList();
-        List list2 = getConfirmedList();
+        List<E> list1 = getCollection();
+        List<E> list2 = getConfirmed();
 
-        Iterator iterator = list2.iterator();
+        Iterator<E> iterator = list2.iterator();
         while (iterator.hasNext()) {
             Object element = iterator.next();
             assertEquals("indexOf should return correct result",
@@ -495,7 +477,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
             verify();
         }
 
-        Object[] other = getOtherElements();
+        E[] other = getOtherElements();
         for (int i = 0; i < other.length; i++) {
             assertEquals("indexOf should return -1 for nonexistent element",
                 list1.indexOf(other[i]), -1);
@@ -508,18 +490,18 @@ public abstract class AbstractTestList extends AbstractTestCollection {
      */
     public void testListLastIndexOf() {
         resetFull();
-        List list1 = getList();
-        List list2 = getConfirmedList();
+        List<E> list1 = getCollection();
+        List<E> list2 = getConfirmed();
 
-        Iterator iterator = list2.iterator();
+        Iterator<E> iterator = list2.iterator();
         while (iterator.hasNext()) {
-            Object element = iterator.next();
+            E element = iterator.next();
             assertEquals("lastIndexOf should return correct result",
               list1.lastIndexOf(element), list2.lastIndexOf(element));
             verify();
         }
 
-        Object[] other = getOtherElements();
+        E[] other = getOtherElements();
         for (int i = 0; i < other.length; i++) {
             assertEquals("lastIndexOf should return -1 for nonexistent " +
               "element", list1.lastIndexOf(other[i]), -1);
@@ -536,8 +518,8 @@ public abstract class AbstractTestList extends AbstractTestCollection {
             return;
         }
 
-        List list = makeEmptyList();
-        Object element = getOtherElements()[0];
+        List<E> list = makeObject();
+        E element = getOtherElements()[0];
 
         try {
             list.set(Integer.MIN_VALUE, element);
@@ -583,8 +565,8 @@ public abstract class AbstractTestList extends AbstractTestCollection {
     public void testListSetByIndexBoundsChecking2() {
         if (!isSetSupported()) return;
 
-        List list = makeFullList();
-        Object element = getOtherElements()[0];
+        List<E> list = makeFullCollection();
+        E element = getOtherElements()[0];
 
         try {
             list.set(Integer.MIN_VALUE, element);
@@ -592,21 +574,21 @@ public abstract class AbstractTestList extends AbstractTestCollection {
               "[Integer.MIN_VALUE]");
         } catch(IndexOutOfBoundsException e) {
             // expected
-        } 
+        }
 
         try {
             list.set(-1, element);
             fail("List.set should throw IndexOutOfBoundsException [-1]");
         } catch(IndexOutOfBoundsException e) {
             // expected
-        } 
+        }
 
         try {
             list.set(getFullElements().length, element);
             fail("List.set should throw IndexOutOfBoundsException [size]");
         } catch(IndexOutOfBoundsException e) {
             // expected
-        } 
+        }
 
         try {
             list.set(Integer.MAX_VALUE, element);
@@ -614,7 +596,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
               "[Integer.MAX_VALUE]");
         } catch(IndexOutOfBoundsException e) {
             // expected
-        } 
+        }
     }
 
 
@@ -625,29 +607,28 @@ public abstract class AbstractTestList extends AbstractTestCollection {
         if (!isSetSupported()) return;
 
         resetFull();
-        Object[] elements = getFullElements();
-        Object[] other = getOtherElements();
+        E[] elements = getFullElements();
+        E[] other = getOtherElements();
 
         for (int i = 0; i < elements.length; i++) {
-            Object n = other[i % other.length];
-            Object v = ((List)collection).set(i, n);
+            E n = other[i % other.length];
+            E v = ((List<E>) getCollection()).set(i, n);
             assertEquals("Set should return correct element", elements[i], v);
-            ((List)confirmed).set(i, n);
+            ((List<E>) getConfirmed()).set(i, n);
             verify();
         }
     }
 
-
     /**
      *  If {@link #isSetSupported()} returns false, tests that set operation
      *  raises <Code>UnsupportedOperationException.
      */
     public void testUnsupportedSet() {
         if (isSetSupported()) return;
-        
+
         resetFull();
         try {
-            ((List) collection).set(0, new Object());
+            ((List<E>) getCollection()).set(0, getFullElements()[0]);
             fail("Emtpy collection should not support set.");
         } catch (UnsupportedOperationException e) {
             // expected
@@ -656,7 +637,6 @@ public abstract class AbstractTestList extends AbstractTestCollection {
         // thrown.
         verify();
     }
-    
 
     /**
      *  Tests bounds checking for {@link List#remove(int)} on an
@@ -665,47 +645,44 @@ public abstract class AbstractTestList extends AbstractTestCollection {
     public void testListRemoveByIndexBoundsChecking() {
         if (!isRemoveSupported()) return;
 
-        List list = makeEmptyList();
+        List<E> list = makeObject();
 
         try {
             list.remove(Integer.MIN_VALUE);
-            fail("List.remove should throw IndexOutOfBoundsException " +
-              "[Integer.MIN_VALUE]");
+            fail("List.remove should throw IndexOutOfBoundsException [Integer.MIN_VALUE]");
         } catch(IndexOutOfBoundsException e) {
             // expected
-        } 
+        }
 
         try {
             list.remove(-1);
             fail("List.remove should throw IndexOutOfBoundsException [-1]");
         } catch(IndexOutOfBoundsException e) {
             // expected
-        } 
+        }
 
         try {
             list.remove(0);
             fail("List.remove should throw IndexOutOfBoundsException [0]");
         } catch(IndexOutOfBoundsException e) {
             // expected
-        } 
+        }
 
         try {
             list.remove(1);
             fail("List.remove should throw IndexOutOfBoundsException [1]");
         } catch(IndexOutOfBoundsException e) {
             // expected
-        } 
+        }
 
         try {
             list.remove(Integer.MAX_VALUE);
-            fail("List.remove should throw IndexOutOfBoundsException " +
-              "[Integer.MAX_VALUE]");
+            fail("List.remove should throw IndexOutOfBoundsException [Integer.MAX_VALUE]");
         } catch(IndexOutOfBoundsException e) {
             // expected
         }
     }
 
-
     /**
      *  Tests bounds checking for {@link List#remove(int)} on a
      *  full list.
@@ -713,7 +690,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
     public void testListRemoveByIndexBoundsChecking2() {
         if (!isRemoveSupported()) return;
 
-        List list = makeFullList();
+        List<E> list = makeFullCollection();
 
         try {
             list.remove(Integer.MIN_VALUE);
@@ -721,21 +698,21 @@ public abstract class AbstractTestList extends AbstractTestCollection {
               "[Integer.MIN_VALUE]");
         } catch(IndexOutOfBoundsException e) {
             // expected
-        } 
+        }
 
         try {
             list.remove(-1);
             fail("List.remove should throw IndexOutOfBoundsException [-1]");
         } catch(IndexOutOfBoundsException e) {
             // expected
-        } 
+        }
 
         try {
             list.remove(getFullElements().length);
             fail("List.remove should throw IndexOutOfBoundsException [size]");
         } catch(IndexOutOfBoundsException e) {
             // expected
-        } 
+        }
 
         try {
             list.remove(Integer.MAX_VALUE);
@@ -743,7 +720,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
               "[Integer.MAX_VALUE]");
         } catch(IndexOutOfBoundsException e) {
             // expected
-        } 
+        }
     }
 
 
@@ -756,44 +733,42 @@ public abstract class AbstractTestList extends AbstractTestCollection {
         int max = getFullElements().length;
         for (int i = 0; i < max; i++) {
             resetFull();
-            Object o1 = ((List)collection).remove(i);
-            Object o2 = ((List)confirmed).remove(i);
+            E o1 = ((List<E>) getCollection()).remove(i);
+            E o2 = ((List<E>) getConfirmed()).remove(i);
             assertEquals("remove should return correct element", o1, o2);
             verify();
         }
     }
 
-
     /**
      *  Tests the read-only bits of {@link List#listIterator()}.
      */
     public void testListListIterator() {
         resetFull();
-        forwardTest(getList().listIterator(), 0);
-        backwardTest(getList().listIterator(), 0);
+        forwardTest(getCollection().listIterator(), 0);
+        backwardTest(getCollection().listIterator(), 0);
     }
 
-
     /**
      *  Tests the read-only bits of {@link List#listIterator(int)}.
      */
     public void testListListIteratorByIndex() {
         resetFull();
         try {
-            getList().listIterator(-1);
+            getCollection().listIterator(-1);
         } catch (IndexOutOfBoundsException ex) {}
         resetFull();
         try {
-            getList().listIterator(getList().size() + 1);
+            getCollection().listIterator(getCollection().size() + 1);
         } catch (IndexOutOfBoundsException ex) {}
         resetFull();
-        for (int i = 0; i <= confirmed.size(); i++) {
-            forwardTest(getList().listIterator(i), i);
-            backwardTest(getList().listIterator(i), i);
+        for (int i = 0; i <= getConfirmed().size(); i++) {
+            forwardTest(getCollection().listIterator(i), i);
+            backwardTest(getCollection().listIterator(i), i);
         }
         resetFull();
-        for (int i = 0; i <= confirmed.size(); i++) {
-            backwardTest(getList().listIterator(i), i);
+        for (int i = 0; i <= getConfirmed().size(); i++) {
+            backwardTest(getCollection().listIterator(i), i);
         }
     }
 
@@ -804,25 +779,25 @@ public abstract class AbstractTestList extends AbstractTestCollection {
     public void testListListIteratorPreviousRemoveNext() {
         if (isRemoveSupported() == false) return;
         resetFull();
-        if (collection.size() < 4) return;
-        ListIterator it = getList().listIterator();
-        Object zero = it.next();
-        Object one = it.next();
-        Object two = it.next();
-        Object two2 = it.previous();
-        Object one2 = it.previous();
+        if (getCollection().size() < 4) return;
+        ListIterator<E> it = getCollection().listIterator();
+        E zero = it.next();
+        E one = it.next();
+        E two = it.next();
+        E two2 = it.previous();
+        E one2 = it.previous();
         assertEquals(one, one2);
         assertEquals(two, two2);
-        assertEquals(zero, getList().get(0));
-        assertEquals(one, getList().get(1));
-        assertEquals(two, getList().get(2));
-        
+        assertEquals(zero, getCollection().get(0));
+        assertEquals(one, getCollection().get(1));
+        assertEquals(two, getCollection().get(2));
+
         it.remove(); // removed element at index 1 (one)
-        assertEquals(zero, getList().get(0));
-        assertEquals(two, getList().get(1));
-        Object two3 = it.next();  // do next after remove
+        assertEquals(zero, getCollection().get(0));
+        assertEquals(two, getCollection().get(1));
+        E two3 = it.next();  // do next after remove
         assertEquals(two, two3);
-        assertEquals(collection.size() > 2, it.hasNext());
+        assertEquals(getCollection().size() > 2, it.hasNext());
         assertEquals(true, it.hasPrevious());
     }
 
@@ -832,26 +807,26 @@ public abstract class AbstractTestList extends AbstractTestCollection {
     public void testListListIteratorPreviousRemovePrevious() {
         if (isRemoveSupported() == false) return;
         resetFull();
-        if (collection.size() < 4) return;
-        ListIterator it = getList().listIterator();
-        Object zero = it.next();
-        Object one = it.next();
-        Object two = it.next();
-        Object two2 = it.previous();
-        Object one2 = it.previous();
+        if (getCollection().size() < 4) return;
+        ListIterator<E> it = getCollection().listIterator();
+        E zero = it.next();
+        E one = it.next();
+        E two = it.next();
+        E two2 = it.previous();
+        E one2 = it.previous();
         assertEquals(one, one2);
         assertEquals(two, two2);
-        assertEquals(zero, getList().get(0));
-        assertEquals(one, getList().get(1));
-        assertEquals(two, getList().get(2));
-        
+        assertEquals(zero, getCollection().get(0));
+        assertEquals(one, getCollection().get(1));
+        assertEquals(two, getCollection().get(2));
+
         it.remove(); // removed element at index 1 (one)
-        assertEquals(zero, getList().get(0));
-        assertEquals(two, getList().get(1));
-        Object zero3 = it.previous();  // do previous after remove
+        assertEquals(zero, getCollection().get(0));
+        assertEquals(two, getCollection().get(1));
+        E zero3 = it.previous();  // do previous after remove
         assertEquals(zero, zero3);
         assertEquals(false, it.hasPrevious());
-        assertEquals(collection.size() > 2, it.hasNext());
+        assertEquals(getCollection().size() > 2, it.hasNext());
     }
 
     /**
@@ -860,22 +835,22 @@ public abstract class AbstractTestList extends AbstractTestCollection {
     public void testListListIteratorNextRemoveNext() {
         if (isRemoveSupported() == false) return;
         resetFull();
-        if (collection.size() < 4) return;
-        ListIterator it = getList().listIterator();
-        Object zero = it.next();
-        Object one = it.next();
-        Object two = it.next();
-        assertEquals(zero, getList().get(0));
-        assertEquals(one, getList().get(1));
-        assertEquals(two, getList().get(2));
-        Object three = getList().get(3);
-        
+        if (getCollection().size() < 4) return;
+        ListIterator<E> it = getCollection().listIterator();
+        E zero = it.next();
+        E one = it.next();
+        E two = it.next();
+        assertEquals(zero, getCollection().get(0));
+        assertEquals(one, getCollection().get(1));
+        assertEquals(two, getCollection().get(2));
+        E three = getCollection().get(3);
+
         it.remove(); // removed element at index 2 (two)
-        assertEquals(zero, getList().get(0));
-        assertEquals(one, getList().get(1));
-        Object three2 = it.next();  // do next after remove
+        assertEquals(zero, getCollection().get(0));
+        assertEquals(one, getCollection().get(1));
+        E three2 = it.next();  // do next after remove
         assertEquals(three, three2);
-        assertEquals(collection.size() > 3, it.hasNext());
+        assertEquals(getCollection().size() > 3, it.hasNext());
         assertEquals(true, it.hasPrevious());
     }
 
@@ -885,19 +860,19 @@ public abstract class AbstractTestList extends AbstractTestCollection {
     public void testListListIteratorNextRemovePrevious() {
         if (isRemoveSupported() == false) return;
         resetFull();
-        if (collection.size() < 4) return;
-        ListIterator it = getList().listIterator();
-        Object zero = it.next();
-        Object one = it.next();
-        Object two = it.next();
-        assertEquals(zero, getList().get(0));
-        assertEquals(one, getList().get(1));
-        assertEquals(two, getList().get(2));
-        
+        if (getCollection().size() < 4) return;
+        ListIterator<E> it = getCollection().listIterator();
+        E zero = it.next();
+        E one = it.next();
+        E two = it.next();
+        assertEquals(zero, getCollection().get(0));
+        assertEquals(one, getCollection().get(1));
+        assertEquals(two, getCollection().get(2));
+
         it.remove(); // removed element at index 2 (two)
-        assertEquals(zero, getList().get(0));
-        assertEquals(one, getList().get(1));
-        Object one2 = it.previous();  // do previous after remove
+        assertEquals(zero, getCollection().get(0));
+        assertEquals(one, getCollection().get(1));
+        E one2 = it.previous();  // do previous after remove
         assertEquals(one, one2);
         assertEquals(true, it.hasNext());
         assertEquals(true, it.hasPrevious());
@@ -910,13 +885,13 @@ public abstract class AbstractTestList extends AbstractTestCollection {
      *  @param iter  the iterator to traverse
      *  @param i     the starting index
      */
-    private void forwardTest(ListIterator iter, int i) {
-        List list = getList();
+    private void forwardTest(ListIterator<E> iter, int i) {
+        List<E> list = getCollection();
         int max = getFullElements().length;
 
         while (i < max) {
             assertTrue("Iterator should have next", iter.hasNext());
-            assertEquals("Iterator.nextIndex should work", 
+            assertEquals("Iterator.nextIndex should work",
               iter.nextIndex(), i);
             assertEquals("Iterator.previousIndex should work",
               iter.previousIndex(), i - 1);
@@ -927,8 +902,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
 
         assertTrue("Iterator shouldn't have next", !iter.hasNext());
         assertEquals("nextIndex should be size", iter.nextIndex(), max);
-        assertEquals("previousIndex should be size - 1", 
-          iter.previousIndex(), max - 1);
+        assertEquals("previousIndex should be size - 1", iter.previousIndex(), max - 1);
 
         try {
             iter.next();
@@ -938,21 +912,20 @@ public abstract class AbstractTestList extends AbstractTestCollection {
         }
     }
 
-
     /**
      *  Traverses to the beginning of the given iterator.
      *
      *  @param iter  the iterator to traverse
      *  @param i     the starting index
      */
-    private void backwardTest(ListIterator iter, int i) {
-        List list = getList();
+    private void backwardTest(ListIterator<E> iter, int i) {
+        List<E> list = getCollection();
 
         while (i > 0) {
             assertTrue("Iterator should have previous, i:" + i, iter.hasPrevious());
             assertEquals("Iterator.nextIndex should work, i:" + i, iter.nextIndex(), i);
             assertEquals("Iterator.previousIndex should work, i:" + i, iter.previousIndex(), i - 1);
-            Object o = iter.previous();
+            E o = iter.previous();
             assertEquals("Iterator returned correct element", list.get(i - 1), o);
             i--;
         }
@@ -981,12 +954,12 @@ public abstract class AbstractTestList extends AbstractTestCollection {
         if (!isAddSupported()) return;
 
         resetEmpty();
-        List list1 = getList();
-        List list2 = getConfirmedList();
+        List<E> list1 = getCollection();
+        List<E> list2 = getConfirmed();
 
-        Object[] elements = getFullElements();
-        ListIterator iter1 = list1.listIterator();
-        ListIterator iter2 = list2.listIterator();
+        E[] elements = getFullElements();
+        ListIterator<E> iter1 = list1.listIterator();
+        ListIterator<E> iter2 = list2.listIterator();
 
         for (int i = 0; i < elements.length; i++) {
             iter1.add(elements[i]);
@@ -995,8 +968,8 @@ public abstract class AbstractTestList extends AbstractTestCollection {
         }
 
         resetFull();
-        iter1 = getList().listIterator();
-        iter2 = getConfirmedList().listIterator();
+        iter1 = getCollection().listIterator();
+        iter2 = getConfirmed().listIterator();
         for (int i = 0; i < elements.length; i++) {
             iter1.next();
             iter2.next();
@@ -1006,7 +979,6 @@ public abstract class AbstractTestList extends AbstractTestCollection {
         }
     }
 
-
     /**
      *  Tests the {@link ListIterator#set(Object)} method of the list
      *  iterator.
@@ -1014,11 +986,11 @@ public abstract class AbstractTestList extends AbstractTestCollection {
     public void testListIteratorSet() {
         if (!isSetSupported()) return;
 
-        Object[] elements = getFullElements();
+        E[] elements = getFullElements();
 
         resetFull();
-        ListIterator iter1 = getList().listIterator();
-        ListIterator iter2 = getConfirmedList().listIterator();
+        ListIterator<E> iter1 = getCollection().listIterator();
+        ListIterator<E> iter2 = getConfirmed().listIterator();
         for (int i = 0; i < elements.length; i++) {
             iter1.next();
             iter2.next();
@@ -1028,27 +1000,26 @@ public abstract class AbstractTestList extends AbstractTestCollection {
         }
     }
 
-
-    public void testEmptyListSerialization() 
-    throws IOException, ClassNotFoundException {
-        List list = makeEmptyList();
+    @SuppressWarnings("unchecked")
+    public void testEmptyListSerialization() throws IOException, ClassNotFoundException {
+        List<E> list = makeObject();
         if (!(list instanceof Serializable && isTestSerialization())) return;
-        
+
         byte[] objekt = writeExternalFormToBytes((Serializable) list);
-        List list2 = (List) readExternalFormFromBytes(objekt);
+        List<E> list2 = (List<E>) readExternalFormFromBytes(objekt);
 
         assertTrue("Both lists are empty",list.size()  == 0);
         assertTrue("Both lists are empty",list2.size() == 0);
     }
 
-    public void testFullListSerialization() 
-    throws IOException, ClassNotFoundException {
-        List list = makeFullList();
+    @SuppressWarnings("unchecked")
+    public void testFullListSerialization() throws IOException, ClassNotFoundException {
+        List<E> list = makeFullCollection();
         int size = getFullElements().length;
         if (!(list instanceof Serializable && isTestSerialization())) return;
-        
+
         byte[] objekt = writeExternalFormToBytes((Serializable) list);
-        List list2 = (List) readExternalFormFromBytes(objekt);
+        List<E> list2 = (List<E>) readExternalFormFromBytes(objekt);
 
         assertEquals("Both lists are same size",list.size(), size);
         assertEquals("Both lists are same size",list2.size(), size);
@@ -1069,19 +1040,21 @@ public abstract class AbstractTestList extends AbstractTestCollection {
      * Compare the current serialized form of the List
      * against the canonical version in CVS.
      */
+    @SuppressWarnings("unchecked")
     public void testEmptyListCompatibility() throws IOException, ClassNotFoundException {
         /**
          * Create canonical objects with this code
         List list = makeEmptyList();
         if (!(list instanceof Serializable)) return;
-        
+
         writeExternalFormToDisk((Serializable) list, getCanonicalEmptyCollectionName(list));
         */
 
         // test to make sure the canonical form has been preserved
-        List list = makeEmptyList();
-        if(list instanceof Serializable && !skipSerializedCanonicalTests() && isTestSerialization()) {
-            List list2 = (List) readExternalFormFromDisk(getCanonicalEmptyCollectionName(list));
+        List<E> list = makeObject();
+        if (list instanceof Serializable && !skipSerializedCanonicalTests()
+                && isTestSerialization()) {
+            List<E> list2 = (List<E>) readExternalFormFromDisk(getCanonicalEmptyCollectionName(list));
             assertTrue("List is empty",list2.size()  == 0);
             assertEquals(list, list2);
         }
@@ -1091,19 +1064,20 @@ public abstract class AbstractTestList extends AbstractTestCollection {
      * Compare the current serialized form of the List
      * against the canonical version in CVS.
      */
+    @SuppressWarnings("unchecked")
     public void testFullListCompatibility() throws IOException, ClassNotFoundException {
         /**
          * Create canonical objects with this code
         List list = makeFullList();
         if (!(list instanceof Serializable)) return;
-        
+
         writeExternalFormToDisk((Serializable) list, getCanonicalFullCollectionName(list));
         */
 
         // test to make sure the canonical form has been preserved
-        List list = makeFullList();
+        List<E> list = makeFullCollection();
         if(list instanceof Serializable && !skipSerializedCanonicalTests() && isTestSerialization()) {
-            List list2 = (List) readExternalFormFromDisk(getCanonicalFullCollectionName(list));
+            List<E> list2 = (List<E>) readExternalFormFromDisk(getCanonicalFullCollectionName(list));
             if (list2.size() == 4) {
                 // old serialized tests
                 return;
@@ -1126,32 +1100,28 @@ public abstract class AbstractTestList extends AbstractTestCollection {
      */
     public BulkTest bulkTestSubList() {
         if (getFullElements().length - 6 < 10) return null;
-        return new BulkTestSubList(this);
+        return new BulkTestSubList<E>(this);
     }
 
+   public static class BulkTestSubList<E> extends AbstractTestList<E> {
 
-   public static class BulkTestSubList extends AbstractTestList {
-
-       private AbstractTestList outer;
+       private AbstractTestList<E> outer;
 
-
-       public BulkTestSubList(AbstractTestList outer) {
+       public BulkTestSubList(AbstractTestList<E> outer) {
            super("");
            this.outer = outer;
        }
 
-
-       public Object[] getFullElements() {
-           List l = Arrays.asList(outer.getFullElements());
-           return l.subList(3, l.size() - 3).toArray();
+       @SuppressWarnings("unchecked")
+       public E[] getFullElements() {
+           List<E> l = Arrays.asList(outer.getFullElements());
+           return (E[]) l.subList(3, l.size() - 3).toArray();
        }
 
-
-       public Object[] getOtherElements() {
+       public E[] getOtherElements() {
            return outer.getOtherElements();
        }
 
-
        public boolean isAddSupported() {
            return outer.isAddSupported();
        }
@@ -1164,32 +1134,28 @@ public abstract class AbstractTestList extends AbstractTestCollection {
            return outer.isRemoveSupported();
        }
 
-
-       public List makeEmptyList() { 
-           return outer.makeFullList().subList(4, 4); 
+       public List<E> makeObject() {
+           return outer.makeFullCollection().subList(4, 4);
        }
 
-
-       public List makeFullList() {
+       public List<E> makeFullCollection() {
            int size = getFullElements().length;
-           return outer.makeFullList().subList(3, size - 3);
+           return outer.makeFullCollection().subList(3, size - 3);
        }
 
-
        public void resetEmpty() {
            outer.resetFull();
-           this.collection = outer.getList().subList(4, 4);
-           this.confirmed = outer.getConfirmedList().subList(4, 4);
+           this.setCollection(outer.getCollection().subList(4, 4));
+           this.setConfirmed(outer.getConfirmed().subList(4, 4));
        }
 
        public void resetFull() {
            outer.resetFull();
-           int size = outer.confirmed.size();
-           this.collection = outer.getList().subList(3, size - 3);
-           this.confirmed = outer.getConfirmedList().subList(3, size - 3);
+           int size = outer.getConfirmed().size();
+           this.setCollection(outer.getCollection().subList(3, size - 3));
+           this.setConfirmed(outer.getConfirmed().subList(3, size - 3));
        }
 
-
        public void verify() {
            super.verify();
            outer.verify();
@@ -1200,7 +1166,6 @@ public abstract class AbstractTestList extends AbstractTestCollection {
        }
    }
 
-
    /**
     *  Tests that a sublist raises a {@link java.util.ConcurrentModificationException ConcurrentModificationException}
     *  if elements are added to the original list.
@@ -1210,29 +1175,27 @@ public abstract class AbstractTestList extends AbstractTestCollection {
        if (!isAddSupported()) return;
 
        resetFull();
-       int size = collection.size();
-       List sub = getList().subList(1, size);
-       getList().add(getOtherElements()[0]);
+       int size = getCollection().size();
+       List<E> sub = getCollection().subList(1, size);
+       getCollection().add(getOtherElements()[0]);
        failFastAll(sub);
 
        resetFull();
-       sub = getList().subList(1, size);
-       getList().add(0, getOtherElements()[0]);
+       sub = getCollection().subList(1, size);
+       getCollection().add(0, getOtherElements()[0]);
        failFastAll(sub);
 
        resetFull();
-       sub = getList().subList(1, size);
-       getList().addAll(Arrays.asList(getOtherElements()));
+       sub = getCollection().subList(1, size);
+       getCollection().addAll(Arrays.asList(getOtherElements()));
        failFastAll(sub);
 
        resetFull();
-       sub = getList().subList(1, size);
-       getList().addAll(0, Arrays.asList(getOtherElements()));
+       sub = getCollection().subList(1, size);
+       getCollection().addAll(0, Arrays.asList(getOtherElements()));
        failFastAll(sub);
-
    }
 
-
    /**
     *  Tests that a sublist raises a {@link java.util.ConcurrentModificationException ConcurrentModificationException}
     *  if elements are removed from the original list.
@@ -1242,45 +1205,43 @@ public abstract class AbstractTestList extends AbstractTestCollection {
        if (!isRemoveSupported()) return;
 
        resetFull();
-       int size = collection.size();
-       List sub = getList().subList(1, size);
-       getList().remove(0);
+       int size = getCollection().size();
+       List<E> sub = getCollection().subList(1, size);
+       getCollection().remove(0);
        failFastAll(sub);
 
        resetFull();
-       sub = getList().subList(1, size);
-       getList().remove(getFullElements()[2]);
+       sub = getCollection().subList(1, size);
+       getCollection().remove(getFullElements()[2]);
        failFastAll(sub);
 
        resetFull();
-       sub = getList().subList(1, size);
-       getList().removeAll(Arrays.asList(getFullElements()));
+       sub = getCollection().subList(1, size);
+       getCollection().removeAll(Arrays.asList(getFullElements()));
        failFastAll(sub);
 
        resetFull();
-       sub = getList().subList(1, size);
-       getList().retainAll(Arrays.asList(getOtherElements()));
+       sub = getCollection().subList(1, size);
+       getCollection().retainAll(Arrays.asList(getOtherElements()));
        failFastAll(sub);
 
        resetFull();
-       sub = getList().subList(1, size);
-       getList().clear();
+       sub = getCollection().subList(1, size);
+       getCollection().clear();
        failFastAll(sub);
    }
 
-
    /**
     *  Invokes all the methods on the given sublist to make sure they raise
     *  a {@link java.util.ConcurrentModificationException ConcurrentModificationException}.
     */
-   protected void failFastAll(List list) {
+   protected void failFastAll(List<E> list) {
        Method[] methods = List.class.getMethods();
        for (int i = 0; i < methods.length; i++) {
            failFastMethod(list, methods[i]);
        }
    }
 
-
    /**
     *  Invokes the given method on the given sublist to make sure it raises
     *  a {@link java.util.ConcurrentModificationException ConcurrentModificationException}.
@@ -1293,13 +1254,13 @@ public abstract class AbstractTestList extends AbstractTestCollection {
     *  @param list  the sublist to test
     *  @param m     the method to invoke
     */
-   protected void failFastMethod(List list, Method m) {
+   protected void failFastMethod(List<E> list, Method m) {
        if (m.getName().equals("equals")) return;
 
-       Object element = getOtherElements()[0];
-       Collection c = Collections.singleton(element);
+       E element = getOtherElements()[0];
+       Collection<E> c = Collections.singleton(element);
 
-       Class[] types = m.getParameterTypes();
+       Class<?>[] types = m.getParameterTypes();
        Object[] params = new Object[types.length];
        for (int i = 0; i < params.length; i++) {
            if (types[i] == Integer.TYPE) params[i] = new Integer(0);
@@ -1328,16 +1289,16 @@ public abstract class AbstractTestList extends AbstractTestCollection {
    public BulkTest bulkTestListIterator() {
        return new TestListIterator();
    }
-    
-   public class TestListIterator extends AbstractTestListIterator {
+
+   public class TestListIterator extends AbstractTestListIterator<E> {
        public TestListIterator() {
            super("TestListIterator");
        }
-        
-       public Object addSetValue() {
+
+       public E addSetValue() {
            return AbstractTestList.this.getOtherElements()[0];
        }
-        
+
        public boolean supportsRemove() {
            return AbstractTestList.this.isRemoveSupported();
        }
@@ -1350,15 +1311,15 @@ public abstract class AbstractTestList extends AbstractTestCollection {
            return AbstractTestList.this.isSetSupported();
        }
 
-       public ListIterator makeEmptyListIterator() {
+       public ListIterator<E> makeEmptyIterator() {
            resetEmpty();
-           return ((List) AbstractTestList.this.collection).listIterator();
+           return AbstractTestList.this.getCollection().listIterator();
        }
 
-       public ListIterator makeFullListIterator() {
+       public ListIterator<E> makeObject() {
            resetFull();
-           return ((List) AbstractTestList.this.collection).listIterator();
+           return AbstractTestList.this.getCollection().listIterator();
        }
    }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/list/TestAbstractLinkedList.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/list/TestAbstractLinkedList.java b/src/test/org/apache/commons/collections/list/TestAbstractLinkedList.java
index 9943676..ee12658 100644
--- a/src/test/org/apache/commons/collections/list/TestAbstractLinkedList.java
+++ b/src/test/org/apache/commons/collections/list/TestAbstractLinkedList.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.
@@ -20,107 +20,111 @@ import java.util.Arrays;
 
 /**
  * Test case for {@link AbstractLinkedList}.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Rich Dougherty
  * @author David Hay
  * @author Phil Steitz
  */
-public abstract class TestAbstractLinkedList extends AbstractTestList {
-    
+public abstract class TestAbstractLinkedList<E> extends AbstractTestList<E> {
+
     public TestAbstractLinkedList(String testName) {
         super(testName);
     }
 
-    //-----------------------------------------------------------------------    
+    //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testRemoveFirst() {
         resetEmpty();
-        AbstractLinkedList list = (AbstractLinkedList) collection;
+        AbstractLinkedList<E> list = getCollection();
         if (isRemoveSupported() == false) {
             try {
                 list.removeFirst();
             } catch (UnsupportedOperationException ex) {}
-        } 
-        
-        list.addAll( Arrays.asList( new String[]{"value1", "value2"}));
-        assertEquals( "value1", list.removeFirst() );
+        }
+
+        list.addAll(Arrays.asList((E[]) new String[] { "value1", "value2" }));
+        assertEquals("value1", list.removeFirst());
         checkNodes();
-        list.addLast( "value3");
+        list.addLast((E) "value3");
         checkNodes();
-        assertEquals( "value2", list.removeFirst() );
-        assertEquals( "value3", list.removeFirst() );
+        assertEquals("value2", list.removeFirst());
+        assertEquals("value3", list.removeFirst());
         checkNodes();
-        list.addLast( "value4" );
+        list.addLast((E) "value4");
         checkNodes();
-        assertEquals( "value4", list.removeFirst() );
+        assertEquals("value4", list.removeFirst());
         checkNodes();
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testRemoveLast() {
         resetEmpty();
-        AbstractLinkedList list = (AbstractLinkedList) collection;
+        AbstractLinkedList<E> list = getCollection();
         if (isRemoveSupported() == false) {
             try {
                 list.removeLast();
             } catch (UnsupportedOperationException ex) {}
-        } 
-        
-        list.addAll( Arrays.asList( new String[]{"value1", "value2"}));
-        assertEquals( "value2", list.removeLast() );
-        list.addFirst( "value3");
+        }
+
+        list.addAll(Arrays.asList((E[]) new String[] { "value1", "value2" }));
+        assertEquals("value2", list.removeLast());
+        list.addFirst((E) "value3");
         checkNodes();
-        assertEquals( "value1", list.removeLast() );
-        assertEquals( "value3", list.removeLast() );
-        list.addFirst( "value4" );
+        assertEquals("value1", list.removeLast());
+        assertEquals("value3", list.removeLast());
+        list.addFirst((E) "value4");
         checkNodes();
-        assertEquals( "value4", list.removeFirst() );
+        assertEquals("value4", list.removeFirst());
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testAddNodeAfter() {
         resetEmpty();
-        AbstractLinkedList list = (AbstractLinkedList) collection;
+        AbstractLinkedList<E> list = getCollection();
         if (isAddSupported() == false) {
             try {
                 list.addFirst(null);
             } catch (UnsupportedOperationException ex) {}
-        } 
-        
-        list.addFirst("value1");
-        list.addNodeAfter(list.getNode(0,false),"value2");
+        }
+
+        list.addFirst((E) "value1");
+        list.addNodeAfter(list.getNode(0, false), (E) "value2");
         assertEquals("value1", list.getFirst());
         assertEquals("value2", list.getLast());
         list.removeFirst();
         checkNodes();
-        list.addNodeAfter(list.getNode(0,false),"value3");
+        list.addNodeAfter(list.getNode(0, false), (E) "value3");
         checkNodes();
         assertEquals("value2", list.getFirst());
         assertEquals("value3", list.getLast());
-        list.addNodeAfter(list.getNode(0, false),"value4");
+        list.addNodeAfter(list.getNode(0, false), (E) "value4");
         checkNodes();
         assertEquals("value2", list.getFirst());
         assertEquals("value3", list.getLast());
         assertEquals("value4", list.get(1));
-        list.addNodeAfter(list.getNode(2, false), "value5");
+        list.addNodeAfter(list.getNode(2, false), (E) "value5");
         checkNodes();
         assertEquals("value2", list.getFirst());
         assertEquals("value4", list.get(1));
         assertEquals("value3", list.get(2));
         assertEquals("value5", list.getLast());
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testRemoveNode() {
         resetEmpty();
         if (isAddSupported() == false || isRemoveSupported() == false) return;
-        AbstractLinkedList list = (AbstractLinkedList) collection;
-        
-        list.addAll( Arrays.asList( new String[]{"value1", "value2"}));
+        AbstractLinkedList<E> list = getCollection();
+
+        list.addAll(Arrays.asList((E[]) new String[] { "value1", "value2" }));
         list.removeNode(list.getNode(0, false));
         checkNodes();
         assertEquals("value2", list.getFirst());
         assertEquals("value2", list.getLast());
-        list.addFirst("value1");
-        list.addFirst("value0");
+        list.addFirst((E) "value1");
+        list.addFirst((E) "value0");
         checkNodes();
         list.removeNode(list.getNode(1, false));
         assertEquals("value0", list.getFirst());
@@ -131,53 +135,61 @@ public abstract class TestAbstractLinkedList extends AbstractTestList {
         assertEquals("value0", list.getLast());
         checkNodes();
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testGetNode() {
         resetEmpty();
-        AbstractLinkedList list = (AbstractLinkedList) collection;
+        AbstractLinkedList<E> list = getCollection();
         // get marker
         assertEquals(list.getNode(0, true).previous, list.getNode(0, true).next);
         try {
-            Object obj = list.getNode(0, false);
+            list.getNode(0, false);
             fail("Expecting IndexOutOfBoundsException.");
         } catch (IndexOutOfBoundsException ex) {
             // expected
         }
-        list.addAll( Arrays.asList( new String[]{"value1", "value2"}));
+        list.addAll( Arrays.asList((E[]) new String[]{"value1", "value2"}));
         checkNodes();
-        list.addFirst("value0");
+        list.addFirst((E) "value0");
         checkNodes();
         list.removeNode(list.getNode(1, false));
         checkNodes();
         try {
-            Object obj = list.getNode(2, false);
+            list.getNode(2, false);
             fail("Expecting IndexOutOfBoundsException.");
         } catch (IndexOutOfBoundsException ex) {
             // expected
         }
         try {
-            Object obj = list.getNode(-1, false);
+            list.getNode(-1, false);
             fail("Expecting IndexOutOfBoundsException.");
         } catch (IndexOutOfBoundsException ex) {
             // expected
         }
          try {
-            Object obj = list.getNode(3, true);
+            list.getNode(3, true);
             fail("Expecting IndexOutOfBoundsException.");
         } catch (IndexOutOfBoundsException ex) {
             // expected
-        }       
+        }
     }
-    
+
     protected void checkNodes() {
-        AbstractLinkedList list = (AbstractLinkedList) collection;
+        AbstractLinkedList<E> list = getCollection();
         for (int i = 0; i < list.size; i++) {
             assertEquals(list.getNode(i, false).next, list.getNode(i + 1, true));
             if (i < list.size - 1) {
-                assertEquals(list.getNode(i + 1, false).previous, 
-                    list.getNode(i, false));  
+                assertEquals(list.getNode(i + 1, false).previous,
+                    list.getNode(i, false));
             }
         }
     }
-        
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public AbstractLinkedList<E> getCollection() {
+        return (AbstractLinkedList<E>) super.getCollection();
+    }
 }


[15/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/bag/AbstractTestBag.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bag/AbstractTestBag.java b/src/test/org/apache/commons/collections/bag/AbstractTestBag.java
index ee6db91..2ec00a0 100644
--- a/src/test/org/apache/commons/collections/bag/AbstractTestBag.java
+++ b/src/test/org/apache/commons/collections/bag/AbstractTestBag.java
@@ -42,7 +42,7 @@ import org.apache.commons.collections.Bag;
  * @author Chuck Burdick
  * @author Stephen Colebourne
  */
-public abstract class AbstractTestBag extends AbstractTestObject {
+public abstract class AbstractTestBag<T> extends AbstractTestObject {
 //  TODO: this class should really extend from TestCollection, but the bag
 //  implementations currently do not conform to the Collection interface.  Once
 //  those are fixed or at least a strategy is made for resolving the issue, this
@@ -63,52 +63,46 @@ public abstract class AbstractTestBag extends AbstractTestObject {
      * 
      * @return the bag to be tested
      */
-    public abstract Bag makeBag();
-
-    /**
-     * Implements the superclass method to return the Bag.
-     * 
-     * @return the bag to be tested
-     */
-    public Object makeObject() {
-        return makeBag();
-    }
+    public abstract Bag<T> makeObject();
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testBagAdd() {
-        Bag bag = makeBag();
-        bag.add("A");
+        Bag<T> bag = makeObject();
+        bag.add((T) "A");
         assertTrue("Should contain 'A'", bag.contains("A"));
         assertEquals("Should have count of 1", 1, bag.getCount("A"));
-        bag.add("A");
+        bag.add((T) "A");
         assertTrue("Should contain 'A'", bag.contains("A"));
         assertEquals("Should have count of 2", 2, bag.getCount("A"));
-        bag.add("B");
+        bag.add((T) "B");
         assertTrue(bag.contains("A"));
         assertTrue(bag.contains("B"));
     }
 
+    @SuppressWarnings("unchecked")
     public void testBagEqualsSelf() {
-        Bag bag = makeBag();
+        Bag<T> bag = makeObject();
         assertTrue(bag.equals(bag));
-        bag.add("elt");
+        bag.add((T) "elt");
         assertTrue(bag.equals(bag));
-        bag.add("elt"); // again
+        bag.add((T) "elt"); // again
         assertTrue(bag.equals(bag));
-        bag.add("elt2");
+        bag.add((T) "elt2");
         assertTrue(bag.equals(bag));
     }
 
+    @SuppressWarnings("unchecked")
     public void testRemove() {
-        Bag bag = makeBag();
-        bag.add("A");
+        Bag<T> bag = makeObject();
+        bag.add((T) "A");
         assertEquals("Should have count of 1", 1, bag.getCount("A"));
         bag.remove("A");
         assertEquals("Should have count of 0", 0, bag.getCount("A"));
-        bag.add("A");
-        bag.add("A");
-        bag.add("A");
-        bag.add("A");
+        bag.add((T) "A");
+        bag.add((T) "A");
+        bag.add((T) "A");
+        bag.add((T) "A");
         assertEquals("Should have count of 4", 4, bag.getCount("A"));
         bag.remove("A", 0);
         assertEquals("Should have count of 4", 4, bag.getCount("A"));
@@ -118,14 +112,15 @@ public abstract class AbstractTestBag extends AbstractTestObject {
         assertEquals("Should have count of 0", 0, bag.getCount("A"));
     }
 
+    @SuppressWarnings("unchecked")
     public void testRemoveAll() {
-        Bag bag = makeBag();
-        bag.add("A", 2);
+        Bag<T> bag = makeObject();
+        bag.add((T) "A", 2);
         assertEquals("Should have count of 2", 2, bag.getCount("A"));
-        bag.add("B");
-        bag.add("C");
+        bag.add((T) "B");
+        bag.add((T) "C");
         assertEquals("Should have count of 4", 4, bag.size());
-        List delete = new ArrayList();
+        List<String> delete = new ArrayList<String>();
         delete.add("A");
         delete.add("B");
         bag.removeAll(delete);
@@ -135,36 +130,38 @@ public abstract class AbstractTestBag extends AbstractTestObject {
         assertEquals("Should have count of 2", 2, bag.size());
     }
     
+    @SuppressWarnings("unchecked")
     public void testContains() {
-        Bag bag = makeBag();
+        Bag<T> bag = makeObject();
         
         assertEquals("Bag does not have at least 1 'A'", false, bag.contains("A"));
         assertEquals("Bag does not have at least 1 'B'", false, bag.contains("B"));
         
-        bag.add("A");  // bag 1A
+        bag.add((T) "A");  // bag 1A
         assertEquals("Bag has at least 1 'A'", true, bag.contains("A"));
         assertEquals("Bag does not have at least 1 'B'", false, bag.contains("B"));
         
-        bag.add("A");  // bag 2A
+        bag.add((T) "A");  // bag 2A
         assertEquals("Bag has at least 1 'A'", true, bag.contains("A"));
         assertEquals("Bag does not have at least 1 'B'", false, bag.contains("B"));
         
-        bag.add("B");  // bag 2A,1B
+        bag.add((T) "B");  // bag 2A,1B
         assertEquals("Bag has at least 1 'A'", true, bag.contains("A"));
         assertEquals("Bag has at least 1 'B'", true, bag.contains("B"));
     }
 
+    @SuppressWarnings("unchecked")
     public void testContainsAll() {
-        Bag bag = makeBag();
-        List known = new ArrayList();
-        List known1A = new ArrayList();
+        Bag<T> bag = makeObject();
+        List<String> known = new ArrayList<String>();
+        List<String> known1A = new ArrayList<String>();
         known1A.add("A");
-        List known2A = new ArrayList();
+        List<String> known2A = new ArrayList<String>();
         known2A.add("A");
         known2A.add("A");
-        List known1B = new ArrayList();
+        List<String> known1B = new ArrayList<String>();
         known1B.add("B");
-        List known1A1B = new ArrayList();
+        List<String> known1A1B = new ArrayList<String>();
         known1A1B.add("A");
         known1A1B.add("B");
         
@@ -174,28 +171,28 @@ public abstract class AbstractTestBag extends AbstractTestObject {
         assertEquals("Bag does not containsAll of 1 'B'", false, bag.containsAll(known1B));
         assertEquals("Bag does not containsAll of 1 'A' 1 'B'", false, bag.containsAll(known1A1B));
         
-        bag.add("A");  // bag 1A
+        bag.add((T) "A");  // bag 1A
         assertEquals("Bag containsAll of empty", true, bag.containsAll(known));
         assertEquals("Bag containsAll of 1 'A'", true, bag.containsAll(known1A));
         assertEquals("Bag does not containsAll of 2 'A'", false, bag.containsAll(known2A));
         assertEquals("Bag does not containsAll of 1 'B'", false, bag.containsAll(known1B));
         assertEquals("Bag does not containsAll of 1 'A' 1 'B'", false, bag.containsAll(known1A1B));
         
-        bag.add("A");  // bag 2A
+        bag.add((T) "A");  // bag 2A
         assertEquals("Bag containsAll of empty", true, bag.containsAll(known));
         assertEquals("Bag containsAll of 1 'A'", true, bag.containsAll(known1A));
         assertEquals("Bag containsAll of 2 'A'", true, bag.containsAll(known2A));
         assertEquals("Bag does not containsAll of 1 'B'", false, bag.containsAll(known1B));
         assertEquals("Bag does not containsAll of 1 'A' 1 'B'", false, bag.containsAll(known1A1B));
         
-        bag.add("A");  // bag 3A
+        bag.add((T) "A");  // bag 3A
         assertEquals("Bag containsAll of empty", true, bag.containsAll(known));
         assertEquals("Bag containsAll of 1 'A'", true, bag.containsAll(known1A));
         assertEquals("Bag containsAll of 2 'A'", true, bag.containsAll(known2A));
         assertEquals("Bag does not containsAll of 1 'B'", false, bag.containsAll(known1B));
         assertEquals("Bag does not containsAll of 1 'A' 1 'B'", false, bag.containsAll(known1A1B));
         
-        bag.add("B");  // bag 3A1B
+        bag.add((T) "B");  // bag 3A1B
         assertEquals("Bag containsAll of empty", true, bag.containsAll(known));
         assertEquals("Bag containsAll of 1 'A'", true, bag.containsAll(known1A));
         assertEquals("Bag containsAll of 2 'A'", true, bag.containsAll(known2A));
@@ -203,18 +200,19 @@ public abstract class AbstractTestBag extends AbstractTestObject {
         assertEquals("Bag containsAll of 1 'A' 1 'B'", true, bag.containsAll(known1A1B));
     }
 
+    @SuppressWarnings("unchecked")
     public void testSize() {
-        Bag bag = makeBag();
+        Bag<T> bag = makeObject();
         assertEquals("Should have 0 total items", 0, bag.size());
-        bag.add("A");
+        bag.add((T) "A");
         assertEquals("Should have 1 total items", 1, bag.size());
-        bag.add("A");
+        bag.add((T) "A");
         assertEquals("Should have 2 total items", 2, bag.size());
-        bag.add("A");
+        bag.add((T) "A");
         assertEquals("Should have 3 total items", 3, bag.size());
-        bag.add("B");
+        bag.add((T) "B");
         assertEquals("Should have 4 total items", 4, bag.size());
-        bag.add("B");
+        bag.add((T) "B");
         assertEquals("Should have 5 total items", 5, bag.size());
         bag.remove("A", 2);
         assertEquals("Should have 1 'A'", 1, bag.getCount("A"));
@@ -223,28 +221,30 @@ public abstract class AbstractTestBag extends AbstractTestObject {
         assertEquals("Should have 1 total item", 1, bag.size());
     }
     
+    @SuppressWarnings("unchecked")
     public void testRetainAll() {
-        Bag bag = makeBag();
-        bag.add("A");
-        bag.add("A");
-        bag.add("A");
-        bag.add("B");
-        bag.add("B");
-        bag.add("C");
-        List retains = new ArrayList();
+        Bag<T> bag = makeObject();
+        bag.add((T) "A");
+        bag.add((T) "A");
+        bag.add((T) "A");
+        bag.add((T) "B");
+        bag.add((T) "B");
+        bag.add((T) "C");
+        List<String> retains = new ArrayList<String>();
         retains.add("B");
         retains.add("C");
         bag.retainAll(retains);
         assertEquals("Should have 2 total items", 2, bag.size());
     }
 
+    @SuppressWarnings("unchecked")
     public void testIterator() {
-        Bag bag = makeBag();
-        bag.add("A");
-        bag.add("A");
-        bag.add("B");
+        Bag<T> bag = makeObject();
+        bag.add((T) "A");
+        bag.add((T) "A");
+        bag.add((T) "B");
         assertEquals("Bag should have 3 items", 3, bag.size());
-        Iterator i = bag.iterator();
+        Iterator<T> i = bag.iterator();
     
         boolean foundA = false;
         while (i.hasNext()) {
@@ -264,12 +264,13 @@ public abstract class AbstractTestBag extends AbstractTestObject {
         assertEquals("Bag should have 1 'A'", 1, bag.getCount("A"));
     }
 
+    @SuppressWarnings("unchecked")
     public void testIteratorFail() {
-        Bag bag = makeBag();
-        bag.add("A");
-        bag.add("A");
-        bag.add("B");
-        Iterator it = bag.iterator();
+        Bag<T> bag = makeObject();
+        bag.add((T) "A");
+        bag.add((T) "A");
+        bag.add((T) "B");
+        Iterator<T> it = bag.iterator();
         it.next();
         bag.remove("A");
         try {
@@ -280,12 +281,13 @@ public abstract class AbstractTestBag extends AbstractTestObject {
         }
     }
     
+    @SuppressWarnings("unchecked")
     public void testIteratorFailNoMore() {
-        Bag bag = makeBag();
-        bag.add("A");
-        bag.add("A");
-        bag.add("B");
-        Iterator it = bag.iterator();
+        Bag<T> bag = makeObject();
+        bag.add((T) "A");
+        bag.add((T) "A");
+        bag.add((T) "B");
+        Iterator<T> it = bag.iterator();
         it.next();
         it.next();
         it.next();
@@ -297,12 +299,13 @@ public abstract class AbstractTestBag extends AbstractTestObject {
         }
     }
     
+    @SuppressWarnings("unchecked")
     public void testIteratorFailDoubleRemove() {
-        Bag bag = makeBag();
-        bag.add("A");
-        bag.add("A");
-        bag.add("B");
-        Iterator it = bag.iterator();
+        Bag<T> bag = makeObject();
+        bag.add((T) "A");
+        bag.add((T) "A");
+        bag.add((T) "B");
+        Iterator<T> it = bag.iterator();
         it.next();
         it.next();
         assertEquals(3, bag.size());
@@ -320,12 +323,13 @@ public abstract class AbstractTestBag extends AbstractTestObject {
         assertEquals(1, bag.size());
     }
     
+    @SuppressWarnings("unchecked")
     public void testIteratorRemoveProtectsInvariants() {
-        Bag bag = makeBag();
-        bag.add("A");
-        bag.add("A");
+        Bag<T> bag = makeObject();
+        bag.add((T) "A");
+        bag.add((T) "A");
         assertEquals(2, bag.size());
-        Iterator it = bag.iterator();
+        Iterator<T> it = bag.iterator();
         assertEquals("A", it.next());
         assertEquals(true, it.hasNext());
         it.remove();
@@ -337,17 +341,18 @@ public abstract class AbstractTestBag extends AbstractTestObject {
         assertEquals(0, bag.size());
         assertEquals(false, it.hasNext());
         
-        Iterator it2 = bag.iterator();
+        Iterator<T> it2 = bag.iterator();
         assertEquals(false, it2.hasNext());
     }
     
+    @SuppressWarnings("unchecked")
     public void testToArray() {
-        Bag bag = makeBag();
-        bag.add("A");
-        bag.add("A");
-        bag.add("B");
-        bag.add("B");
-        bag.add("C");
+        Bag<T> bag = makeObject();
+        bag.add((T) "A");
+        bag.add((T) "A");
+        bag.add((T) "B");
+        bag.add((T) "B");
+        bag.add((T) "C");
         Object[] array = bag.toArray();
         int a = 0, b = 0, c = 0;
         for (int i = 0; i < array.length; i++) {
@@ -360,13 +365,14 @@ public abstract class AbstractTestBag extends AbstractTestObject {
         assertEquals(1, c);
     }
 
+    @SuppressWarnings("unchecked")
     public void testToArrayPopulate() {
-        Bag bag = makeBag();
-        bag.add("A");
-        bag.add("A");
-        bag.add("B");
-        bag.add("B");
-        bag.add("C");
+        Bag<T> bag = makeObject();
+        bag.add((T) "A");
+        bag.add((T) "A");
+        bag.add((T) "B");
+        bag.add((T) "B");
+        bag.add((T) "C");
         String[] array = (String[]) bag.toArray(new String[0]);
         int a = 0, b = 0, c = 0;
         for (int i = 0; i < array.length; i++) {
@@ -380,60 +386,63 @@ public abstract class AbstractTestBag extends AbstractTestObject {
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testEquals() {
-        Bag bag = makeBag();
-        Bag bag2 = makeBag();
+        Bag<T> bag = makeObject();
+        Bag<T> bag2 = makeObject();
         assertEquals(true, bag.equals(bag2));
-        bag.add("A");
+        bag.add((T) "A");
         assertEquals(false, bag.equals(bag2));
-        bag2.add("A");
+        bag2.add((T) "A");
         assertEquals(true, bag.equals(bag2));
-        bag.add("A");
-        bag.add("B");
-        bag.add("B");
-        bag.add("C");
-        bag2.add("A");
-        bag2.add("B");
-        bag2.add("B");
-        bag2.add("C");
+        bag.add((T) "A");
+        bag.add((T) "B");
+        bag.add((T) "B");
+        bag.add((T) "C");
+        bag2.add((T) "A");
+        bag2.add((T) "B");
+        bag2.add((T) "B");
+        bag2.add((T) "C");
         assertEquals(true, bag.equals(bag2));
     }
 
+    @SuppressWarnings("unchecked")
     public void testEqualsHashBag() {
-        Bag bag = makeBag();
-        Bag bag2 = new HashBag();
+        Bag<T> bag = makeObject();
+        Bag<T> bag2 = new HashBag<T>();
         assertEquals(true, bag.equals(bag2));
-        bag.add("A");
+        bag.add((T) "A");
         assertEquals(false, bag.equals(bag2));
-        bag2.add("A");
+        bag2.add((T) "A");
         assertEquals(true, bag.equals(bag2));
-        bag.add("A");
-        bag.add("B");
-        bag.add("B");
-        bag.add("C");
-        bag2.add("A");
-        bag2.add("B");
-        bag2.add("B");
-        bag2.add("C");
+        bag.add((T) "A");
+        bag.add((T) "B");
+        bag.add((T) "B");
+        bag.add((T) "C");
+        bag2.add((T) "A");
+        bag2.add((T) "B");
+        bag2.add((T) "B");
+        bag2.add((T) "C");
         assertEquals(true, bag.equals(bag2));
     }
 
+    @SuppressWarnings("unchecked")
     public void testHashCode() {
-        Bag bag = makeBag();
-        Bag bag2 = makeBag();
+        Bag<T> bag = makeObject();
+        Bag<T> bag2 = makeObject();
         assertEquals(0, bag.hashCode());
         assertEquals(0, bag2.hashCode());
         assertEquals(bag.hashCode(), bag2.hashCode());
-        bag.add("A");
-        bag.add("A");
-        bag.add("B");
-        bag.add("B");
-        bag.add("C");
-        bag2.add("A");
-        bag2.add("A");
-        bag2.add("B");
-        bag2.add("B");
-        bag2.add("C");
+        bag.add((T) "A");
+        bag.add((T) "A");
+        bag.add((T) "B");
+        bag.add((T) "B");
+        bag.add((T) "C");
+        bag2.add((T) "A");
+        bag2.add((T) "A");
+        bag2.add((T) "B");
+        bag2.add((T) "B");
+        bag2.add((T) "C");
         assertEquals(bag.hashCode(), bag2.hashCode());
         
         int total = 0;
@@ -445,8 +454,9 @@ public abstract class AbstractTestBag extends AbstractTestObject {
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testEmptyBagSerialization() throws IOException, ClassNotFoundException {
-        Bag bag = makeBag();
+        Bag<T> bag = makeObject();
         if (!(bag instanceof Serializable && isTestSerialization())) return;
         
         byte[] objekt = writeExternalFormToBytes((Serializable) bag);
@@ -456,13 +466,14 @@ public abstract class AbstractTestBag extends AbstractTestObject {
         assertEquals("Bag should be empty",0, bag2.size());
     }
 
+    @SuppressWarnings("unchecked")
     public void testFullBagSerialization() throws IOException, ClassNotFoundException {
-        Bag bag = makeBag();
-        bag.add("A");
-        bag.add("A");
-        bag.add("B");
-        bag.add("B");
-        bag.add("C");
+        Bag<T> bag = makeObject();
+        bag.add((T) "A");
+        bag.add((T) "A");
+        bag.add((T) "B");
+        bag.add((T) "B");
+        bag.add((T) "C");
         int size = bag.size();
         if (!(bag instanceof Serializable && isTestSerialization())) return;
         
@@ -488,10 +499,11 @@ public abstract class AbstractTestBag extends AbstractTestObject {
      * Compare the current serialized form of the Bag
      * against the canonical version in CVS.
      */
+    @SuppressWarnings("unchecked")
     public void testEmptyBagCompatibility() throws IOException, ClassNotFoundException {
         // test to make sure the canonical form has been preserved
-        Bag bag = makeBag();
-        if(bag instanceof Serializable && !skipSerializedCanonicalTests() && isTestSerialization()) {
+        Bag<T> bag = makeObject();
+        if (bag instanceof Serializable && !skipSerializedCanonicalTests() && isTestSerialization()) {
             Bag bag2 = (Bag) readExternalFormFromDisk(getCanonicalEmptyCollectionName(bag));
             assertTrue("Bag is empty",bag2.size()  == 0);
             assertEquals(bag, bag2);
@@ -502,15 +514,16 @@ public abstract class AbstractTestBag extends AbstractTestObject {
      * Compare the current serialized form of the Bag
      * against the canonical version in CVS.
      */
+    @SuppressWarnings("unchecked")
     public void testFullBagCompatibility() throws IOException, ClassNotFoundException {
         // test to make sure the canonical form has been preserved
-        Bag bag = makeBag();
-        bag.add("A");
-        bag.add("A");
-        bag.add("B");
-        bag.add("B");
-        bag.add("C");
-        if(bag instanceof Serializable && !skipSerializedCanonicalTests() && isTestSerialization()) {
+        Bag<T> bag = makeObject();
+        bag.add((T) "A");
+        bag.add((T) "A");
+        bag.add((T) "B");
+        bag.add((T) "B");
+        bag.add((T) "C");
+        if (bag instanceof Serializable && !skipSerializedCanonicalTests() && isTestSerialization()) {
             Bag bag2 = (Bag) readExternalFormFromDisk(getCanonicalFullCollectionName(bag));
             assertEquals("Bag is the right size",bag.size(), bag2.size());
             assertEquals(bag, bag2);

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/bag/AbstractTestSortedBag.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bag/AbstractTestSortedBag.java b/src/test/org/apache/commons/collections/bag/AbstractTestSortedBag.java
index 0327eba..739d701 100644
--- a/src/test/org/apache/commons/collections/bag/AbstractTestSortedBag.java
+++ b/src/test/org/apache/commons/collections/bag/AbstractTestSortedBag.java
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.collections.bag;
 
+import org.apache.commons.collections.SortedBag;
+
 /**
  * Abstract test class for
  * {@link org.apache.commons.collections.SortedBag SortedBag}
@@ -26,11 +28,17 @@ package org.apache.commons.collections.bag;
  * 
  * @author Stephen Colebourne
  */
-public abstract class AbstractTestSortedBag extends AbstractTestBag {
+public abstract class AbstractTestSortedBag<T> extends AbstractTestBag<T> {
 
     public AbstractTestSortedBag(String testName) {
         super(testName);
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public abstract SortedBag<T> makeObject();
+
     // TODO: Add the SortedBag tests!
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/bag/TestHashBag.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bag/TestHashBag.java b/src/test/org/apache/commons/collections/bag/TestHashBag.java
index 39d4ede..1e2b500 100644
--- a/src/test/org/apache/commons/collections/bag/TestHashBag.java
+++ b/src/test/org/apache/commons/collections/bag/TestHashBag.java
@@ -29,7 +29,7 @@ import org.apache.commons.collections.Bag;
  *
  * @author Chuck Burdick
  */
-public class TestHashBag extends AbstractTestBag {
+public class TestHashBag<T> extends AbstractTestBag<T> {
     
     public TestHashBag(String testName) {
         super(testName);
@@ -44,8 +44,8 @@ public class TestHashBag extends AbstractTestBag {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Bag makeBag() {
-        return new HashBag();
+    public Bag<T> makeObject() {
+        return new HashBag<T>();
     }
     
     public String getCompatibilityVersion() {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/bag/TestPredicatedBag.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bag/TestPredicatedBag.java b/src/test/org/apache/commons/collections/bag/TestPredicatedBag.java
index db25fd2..3799dad 100644
--- a/src/test/org/apache/commons/collections/bag/TestPredicatedBag.java
+++ b/src/test/org/apache/commons/collections/bag/TestPredicatedBag.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,7 @@ import junit.framework.TestSuite;
 
 import org.apache.commons.collections.Bag;
 import org.apache.commons.collections.Predicate;
-import org.apache.commons.collections.PredicateUtils;
+import org.apache.commons.collections.functors.TruePredicate;
 
 /**
  * Extension of {@link TestBag} for exercising the {@link PredicatedBag}
@@ -31,11 +31,11 @@ import org.apache.commons.collections.PredicateUtils;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  */
-public class TestPredicatedBag extends AbstractTestBag {
-    
+public class TestPredicatedBag<T> extends AbstractTestBag<T> {
+
     public TestPredicatedBag(String testName) {
         super(testName);
     }
@@ -48,81 +48,84 @@ public class TestPredicatedBag extends AbstractTestBag {
         String[] testCaseName = { TestPredicatedBag.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
-    
+
     //--------------------------------------------------------------------------
 
-    protected Predicate stringPredicate() {
-        return new Predicate() {
-            public boolean evaluate(Object o) {
+    protected Predicate<T> stringPredicate() {
+        return new Predicate<T>() {
+            public boolean evaluate(T o) {
                 return o instanceof String;
             }
         };
-    }   
-    
-    protected Predicate truePredicate = PredicateUtils.truePredicate();
-    
-    protected Bag decorateBag(HashBag bag, Predicate predicate) {
+    }
+
+    protected Predicate<T> truePredicate = TruePredicate.<T>truePredicate();
+
+    protected Bag<T> decorateBag(HashBag<T> bag, Predicate<T> predicate) {
         return PredicatedBag.decorate(bag, predicate);
     }
 
-    public Bag makeBag() {
-        return decorateBag(new HashBag(), truePredicate);
+    public Bag<T> makeObject() {
+        return decorateBag(new HashBag<T>(), truePredicate);
     }
-    
-    protected Bag makeTestBag() {
-        return decorateBag(new HashBag(), stringPredicate());
+
+    protected Bag<T> makeTestBag() {
+        return decorateBag(new HashBag<T>(), stringPredicate());
     }
-    
+
     //--------------------------------------------------------------------------
 
+    @SuppressWarnings("unchecked")
     public void testlegalAddRemove() {
-        Bag bag = makeTestBag();
+        Bag<T> bag = makeTestBag();
         assertEquals(0, bag.size());
-        Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "1"};
+        T[] els = (T[]) new Object[] { "1", "3", "5", "7", "2", "4", "1" };
         for (int i = 0; i < els.length; i++) {
             bag.add(els[i]);
             assertEquals(i + 1, bag.size());
             assertEquals(true, bag.contains(els[i]));
         }
-        Set set = ((PredicatedBag) bag).uniqueSet();
+        Set<T> set = ((PredicatedBag<T>) bag).uniqueSet();
         assertTrue("Unique set contains the first element",set.contains(els[0]));
-        assertEquals(true, bag.remove(els[0])); 
-        set = ((PredicatedBag) bag).uniqueSet();
+        assertEquals(true, bag.remove(els[0]));
+        set = ((PredicatedBag<T>) bag).uniqueSet();
         assertTrue("Unique set now does not contain the first element",
-            !set.contains(els[0])); 
+            !set.contains(els[0]));
     }
- 
+
+    @SuppressWarnings("unchecked")
     public void testIllegalAdd() {
-        Bag bag = makeTestBag();
+        Bag<T> bag = makeTestBag();
         Integer i = new Integer(3);
         try {
-            bag.add(i);
+            bag.add((T) i);
             fail("Integer should fail string predicate.");
         } catch (IllegalArgumentException e) {
             // expected
         }
-        assertTrue("Collection shouldn't contain illegal element", 
-         !bag.contains(i));   
+        assertTrue("Collection shouldn't contain illegal element",
+         !bag.contains(i));
     }
 
+    @SuppressWarnings("unchecked")
     public void testIllegalDecorate() {
-        HashBag elements = new HashBag();
+        HashBag<Object> elements = new HashBag<Object>();
         elements.add("one");
         elements.add("two");
         elements.add(new Integer(3));
         elements.add("four");
         try {
-            Bag bag = decorateBag(elements, stringPredicate());
+            decorateBag((HashBag<T>) elements, stringPredicate());
             fail("Bag contains an element that should fail the predicate.");
         } catch (IllegalArgumentException e) {
             // expected
         }
         try {
-            Bag bag = decorateBag(new HashBag(), null);
+            decorateBag(new HashBag<T>(), null);
             fail("Expectiing IllegalArgumentException for null predicate.");
         } catch (IllegalArgumentException e) {
             // expected
-        }              
+        }
     }
 
     public String getCompatibilityVersion() {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/bag/TestPredicatedSortedBag.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bag/TestPredicatedSortedBag.java b/src/test/org/apache/commons/collections/bag/TestPredicatedSortedBag.java
index 98a2d26..89d5e15 100644
--- a/src/test/org/apache/commons/collections/bag/TestPredicatedSortedBag.java
+++ b/src/test/org/apache/commons/collections/bag/TestPredicatedSortedBag.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.
@@ -21,10 +21,9 @@ import java.util.Comparator;
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-import org.apache.commons.collections.Bag;
 import org.apache.commons.collections.Predicate;
-import org.apache.commons.collections.PredicateUtils;
 import org.apache.commons.collections.SortedBag;
+import org.apache.commons.collections.functors.TruePredicate;
 
 /**
  * Extension of {@link TestBag} for exercising the {@link PredicatedSortedBag}
@@ -32,76 +31,77 @@ import org.apache.commons.collections.SortedBag;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  */
-public class TestPredicatedSortedBag extends AbstractTestSortedBag {
-    
-    private SortedBag nullBag = null;
-    
+public class TestPredicatedSortedBag<T> extends AbstractTestSortedBag<T> {
+
+    private SortedBag<T> nullBag = null;
+
     public TestPredicatedSortedBag(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return new TestSuite(TestPredicatedSortedBag.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestPredicatedSortedBag.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
-    
+
     //--------------------------------------------------------------------------
-    
-    protected Predicate stringPredicate() {
-        return new Predicate() {
-            public boolean evaluate(Object o) {
+
+    protected Predicate<T> stringPredicate() {
+        return new Predicate<T>() {
+            public boolean evaluate(T o) {
                 return o instanceof String;
             }
         };
-    }   
-    
-    protected Predicate truePredicate = PredicateUtils.truePredicate();
-    
-    protected SortedBag decorateBag(SortedBag bag, Predicate predicate) {
+    }
+
+    protected Predicate<T> truePredicate = TruePredicate.<T>truePredicate();
+
+    protected SortedBag<T> decorateBag(SortedBag<T> bag, Predicate<T> predicate) {
         return PredicatedSortedBag.decorate(bag, predicate);
     }
-    
-    public Bag makeBag() {
-        return decorateBag(new TreeBag(), truePredicate);
+
+    public SortedBag<T> makeObject() {
+        return decorateBag(new TreeBag<T>(), truePredicate);
     }
-    
-    protected Bag makeTestBag() {
-        return decorateBag(new TreeBag(), stringPredicate());
+
+    protected SortedBag<T> makeTestBag() {
+        return decorateBag(new TreeBag<T>(), stringPredicate());
     }
-    
+
     //--------------------------------------------------------------------------
-    
+
     public void testDecorate() {
-        SortedBag bag = decorateBag(new TreeBag(), stringPredicate());
-        SortedBag bag2 = ((PredicatedSortedBag) bag).decorated();
+        SortedBag<T> bag = decorateBag(new TreeBag<T>(), stringPredicate());
+        ((PredicatedSortedBag<T>) bag).decorated();
         try {
-            SortedBag bag3 = decorateBag(new TreeBag(), null);
+            decorateBag(new TreeBag<T>(), null);
             fail("Expecting IllegalArgumentException for null predicate");
         } catch (IllegalArgumentException e) {}
         try {
-            SortedBag bag4 = decorateBag(nullBag, stringPredicate());
+            decorateBag(nullBag, stringPredicate());
             fail("Expecting IllegalArgumentException for null bag");
         } catch (IllegalArgumentException e) {}
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testSortOrder() {
-        SortedBag bag = decorateBag(new TreeBag(), stringPredicate());
+        SortedBag<T> bag = decorateBag(new TreeBag<T>(), stringPredicate());
         String one = "one";
         String two = "two";
         String three = "three";
-        bag.add(one);
-        bag.add(two);
-        bag.add(three);
+        bag.add((T) one);
+        bag.add((T) two);
+        bag.add((T) three);
         assertEquals("first element", bag.first(), one);
-        assertEquals("last element", bag.last(), two); 
-        Comparator c = bag.comparator();
+        assertEquals("last element", bag.last(), two);
+        Comparator<? super T> c = bag.comparator();
         assertTrue("natural order, so comparator should be null", c == null);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/bag/TestTransformedBag.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bag/TestTransformedBag.java b/src/test/org/apache/commons/collections/bag/TestTransformedBag.java
index b7c1f68..78e73a5 100644
--- a/src/test/org/apache/commons/collections/bag/TestTransformedBag.java
+++ b/src/test/org/apache/commons/collections/bag/TestTransformedBag.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.
@@ -20,6 +20,7 @@ import junit.framework.Test;
 import junit.framework.TestSuite;
 
 import org.apache.commons.collections.Bag;
+import org.apache.commons.collections.Transformer;
 import org.apache.commons.collections.collection.TestTransformedCollection;
 
 /**
@@ -28,11 +29,11 @@ import org.apache.commons.collections.collection.TestTransformedCollection;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestTransformedBag extends AbstractTestBag {
-    
+public class TestTransformedBag<T> extends AbstractTestBag<T> {
+
     public TestTransformedBag(String testName) {
         super(testName);
     }
@@ -46,24 +47,26 @@ public class TestTransformedBag extends AbstractTestBag {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Bag makeBag() {
-        return TransformedBag.decorate(new HashBag(), TestTransformedCollection.NOOP_TRANSFORMER);
+    @SuppressWarnings("unchecked")
+    public Bag<T> makeObject() {
+        return TransformedBag.decorate(new HashBag<T>(), (Transformer<T, T>) TestTransformedCollection.NOOP_TRANSFORMER);
     }
 
+    @SuppressWarnings("unchecked")
     public void testTransformedBag() {
-        Bag bag = TransformedBag.decorate(new HashBag(), TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
+        //T had better be Object!
+        Bag<T> bag = TransformedBag.decorate(new HashBag<T>(), (Transformer<T, T>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(0, bag.size());
         Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
         for (int i = 0; i < els.length; i++) {
-            bag.add(els[i]);
+            bag.add((T) els[i]);
             assertEquals(i + 1, bag.size());
             assertEquals(true, bag.contains(new Integer((String) els[i])));
             assertEquals(false, bag.contains(els[i]));
         }
-        
+
         assertEquals(false, bag.remove(els[0]));
         assertEquals(true, bag.remove(new Integer((String) els[0])));
-        
     }
 
     public String getCompatibilityVersion() {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/bag/TestTransformedSortedBag.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bag/TestTransformedSortedBag.java b/src/test/org/apache/commons/collections/bag/TestTransformedSortedBag.java
index 8ed906a..f840aa4 100644
--- a/src/test/org/apache/commons/collections/bag/TestTransformedSortedBag.java
+++ b/src/test/org/apache/commons/collections/bag/TestTransformedSortedBag.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.
@@ -19,7 +19,8 @@ package org.apache.commons.collections.bag;
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-import org.apache.commons.collections.Bag;
+import org.apache.commons.collections.SortedBag;
+import org.apache.commons.collections.Transformer;
 import org.apache.commons.collections.collection.TestTransformedCollection;
 
 /**
@@ -28,11 +29,11 @@ import org.apache.commons.collections.collection.TestTransformedCollection;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestTransformedSortedBag extends AbstractTestSortedBag {
-    
+public class TestTransformedSortedBag<T> extends AbstractTestSortedBag<T> {
+
     public TestTransformedSortedBag(String testName) {
         super(testName);
     }
@@ -46,22 +47,24 @@ public class TestTransformedSortedBag extends AbstractTestSortedBag {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Bag makeBag() {
-        return TransformedSortedBag.decorate(new TreeBag(), TestTransformedCollection.NOOP_TRANSFORMER);
+    @SuppressWarnings("unchecked")
+    public SortedBag<T> makeObject() {
+        return TransformedSortedBag.decorate(new TreeBag<T>(), (Transformer<T, T>) TestTransformedCollection.NOOP_TRANSFORMER);
     }
 
+    @SuppressWarnings("unchecked")
     public void testTransformedBag() {
-        Bag bag = TransformedSortedBag.decorate(new TreeBag(), TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
+        SortedBag<T> bag = TransformedSortedBag.decorate(new TreeBag<T>(), (Transformer<T, T>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(0, bag.size());
         Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
         for (int i = 0; i < els.length; i++) {
-            bag.add(els[i]);
+            bag.add((T) els[i]);
             assertEquals(i + 1, bag.size());
             assertEquals(true, bag.contains(new Integer((String) els[i])));
         }
-        
+
         assertEquals(true, bag.remove(new Integer((String) els[0])));
-        
+
     }
 
     public String getCompatibilityVersion() {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/bag/TestTreeBag.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bag/TestTreeBag.java b/src/test/org/apache/commons/collections/bag/TestTreeBag.java
index df0f2cd..ce4f250 100644
--- a/src/test/org/apache/commons/collections/bag/TestTreeBag.java
+++ b/src/test/org/apache/commons/collections/bag/TestTreeBag.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.
@@ -26,65 +26,62 @@ import org.apache.commons.collections.SortedBag;
  * Extension of {@link TestBag} for exercising the {@link TreeBag}
  * implementation.
  * 
- * @version $Revision$ $Date$
- *
+ * @version $Revision$ $Date: 2006-10-27 19:52:37 -0500 (Fri, 27 Oct
+ * 2006) $
+ * 
  * @author Chuck Burdick
  */
-public class TestTreeBag extends AbstractTestBag {
-    
-   public TestTreeBag(String testName) {
-      super(testName);
-   }
+public class TestTreeBag<T> extends AbstractTestSortedBag<T> {
+
+    public TestTreeBag(String testName) {
+        super(testName);
+    }
+
+    public static Test suite() {
+        return new TestSuite(TestTreeBag.class);
+    }
+
+    public static void main(String args[]) {
+        String[] testCaseName = { TestTreeBag.class.getName() };
+        junit.textui.TestRunner.main(testCaseName);
+    }
 
-   public static Test suite() {
-      return new TestSuite(TestTreeBag.class);
-   }
+    public SortedBag<T> makeObject() {
+        return new TreeBag<T>();
+    }
 
-   public static void main(String args[]) {
-      String[] testCaseName = { TestTreeBag.class.getName() };
-      junit.textui.TestRunner.main(testCaseName);
-   }
+    @SuppressWarnings("unchecked")
+    public SortedBag<T> setupBag() {
+        SortedBag<T> bag = makeObject();
+        bag.add((T) "C");
+        bag.add((T) "A");
+        bag.add((T) "B");
+        bag.add((T) "D");
+        return bag;
+    }
 
-   public Bag makeBag() {
-      return new TreeBag();
-   }
+    public void testOrdering() {
+        Bag<T> bag = setupBag();
+        assertEquals("Should get elements in correct order", "A", bag.toArray()[0]);
+        assertEquals("Should get elements in correct order", "B", bag.toArray()[1]);
+        assertEquals("Should get elements in correct order", "C", bag.toArray()[2]);
+        assertEquals("Should get first key", "A", ((SortedBag<T>) bag).first());
+        assertEquals("Should get last key", "D", ((SortedBag<T>) bag).last());
+    }
 
-   public SortedBag setupBag() {
-      SortedBag bag = (SortedBag)makeBag();
-      bag.add("C");
-      bag.add("A");
-      bag.add("B");
-      bag.add("D");
-      return bag;
-   }
+    public String getCompatibilityVersion() {
+        return "3";
+    }
 
-   public void testOrdering() {
-      Bag bag = setupBag();
-      assertEquals("Should get elements in correct order",
-                   "A", bag.toArray()[0]);
-      assertEquals("Should get elements in correct order",
-                   "B", bag.toArray()[1]);
-      assertEquals("Should get elements in correct order",
-                   "C", bag.toArray()[2]);
-      assertEquals("Should get first key",
-                   "A", ((SortedBag)bag).first());
-      assertEquals("Should get last key",
-                   "D", ((SortedBag)bag).last());
-   }
-   
-   public String getCompatibilityVersion() {
-       return "3";
-   }
-    
-//   public void testCreate() throws Exception {
-//       Bag bag = makeBag();
-//       writeExternalFormToDisk((Serializable) bag, "D:/dev/collections/data/test/TreeBag.emptyCollection.version3.obj");
-//       bag = makeBag();
-//       bag.add("A");
-//       bag.add("A");
-//       bag.add("B");
-//       bag.add("B");
-//       bag.add("C");
-//       writeExternalFormToDisk((Serializable) bag, "D:/dev/collections/data/test/TreeBag.fullCollection.version3.obj");
-//   }
+    //   public void testCreate() throws Exception {
+    //       Bag bag = makeBag();
+    //       writeExternalFormToDisk((Serializable) bag, "D:/dev/collections/data/test/TreeBag.emptyCollection.version3.obj");
+    //       bag = makeBag();
+    //       bag.add("A");
+    //       bag.add("A");
+    //       bag.add("B");
+    //       bag.add("B");
+    //       bag.add("C");
+    //       writeExternalFormToDisk((Serializable) bag, "D:/dev/collections/data/test/TreeBag.fullCollection.version3.obj");
+    //   }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/bidimap/AbstractTestBidiMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bidimap/AbstractTestBidiMap.java b/src/test/org/apache/commons/collections/bidimap/AbstractTestBidiMap.java
index d84ca70..7f026db 100644
--- a/src/test/org/apache/commons/collections/bidimap/AbstractTestBidiMap.java
+++ b/src/test/org/apache/commons/collections/bidimap/AbstractTestBidiMap.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,66 +30,37 @@ import org.apache.commons.collections.map.AbstractTestMap;
 
 /**
  * Abstract test class for {@link BidiMap} methods and contracts.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Matthew Hawthorne
  * @author Stephen Colebourne
  */
-public abstract class AbstractTestBidiMap extends AbstractTestMap {
-
-    // Test data.
-    private static final Object[][] entriesKV =
-        new Object[][] {
-            new Object[] { "key1", "value1" },
-            new Object[] { "key2", "value2" },
-            new Object[] { "key3", "value3" }
-    };
-    private static final Object[][] entriesVK =
-        new Object[][] {
-            new Object[] { "value1", "key1" },
-            new Object[] { "value2", "key2" },
-            new Object[] { "value3", "key3" }
-    };
-    protected final Object[][] entries;
+public abstract class AbstractTestBidiMap<K, V> extends AbstractTestMap<K, V> {
 
     public AbstractTestBidiMap(String testName) {
         super(testName);
-        entries = entriesKV;
     }
 
     public AbstractTestBidiMap() {
         super("Inverse");
-        entries = entriesVK;
     }
 
     //-----------------------------------------------------------------------
     /**
-     * Implement to create an empty <code>BidiMap</code>.
-     * 
-     * @return an empty <code>BidiMap</code> implementation.
-     */
-    public abstract BidiMap makeEmptyBidiMap();
-
-    /**
      * Override to create a full <code>BidiMap</code> other than the default.
-     * 
+     *
      * @return a full <code>BidiMap</code> implementation.
      */
-    public BidiMap makeFullBidiMap() {
-        final BidiMap map = makeEmptyBidiMap();
-        for (int i = 0; i < entries.length; i++) {
-            map.put(entries[i][0], entries[i][1]);
-        }
-        return map;
+    @Override
+    public BidiMap<K, V> makeFullMap() {
+        return (BidiMap<K, V>) super.makeFullMap();
     }
 
     /**
      * Override to return the empty BidiMap.
      */
-    public final  Map makeEmptyMap() {
-        return makeEmptyBidiMap();
-    }
+    public abstract BidiMap<K, V> makeObject();
 
     /**
      * Override to indicate to AbstractTestMap this is a BidiMap.
@@ -97,7 +68,7 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
     public boolean isAllowDuplicateValues() {
         return false;
     }
-    
+
     /**
      * Override as DualHashBidiMap didn't exist until version 3.
      */
@@ -107,33 +78,34 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
 
     // BidiPut
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testBidiPut() {
         if (isPutAddSupported() == false || isPutChangeSupported() == false) return;
 
-        BidiMap map = makeEmptyBidiMap();
-        BidiMap inverse = map.inverseBidiMap();
+        BidiMap<K, V> map = makeObject();
+        BidiMap<V, K> inverse = map.inverseBidiMap();
         assertEquals(0, map.size());
         assertEquals(map.size(), inverse.size());
-        
-        map.put("A", "B");
+
+        map.put((K) "A", (V) "B");
         assertEquals(1, map.size());
         assertEquals(map.size(), inverse.size());
         assertEquals("B", map.get("A"));
         assertEquals("A", inverse.get("B"));
-        
-        map.put("A", "C");
+
+        map.put((K) "A", (V) "C");
         assertEquals(1, map.size());
         assertEquals(map.size(), inverse.size());
         assertEquals("C", map.get("A"));
         assertEquals("A", inverse.get("C"));
-        
-        map.put("B", "C");
+
+        map.put((K) "B", (V) "C");
         assertEquals(1, map.size());
         assertEquals(map.size(), inverse.size());
         assertEquals("C", map.get("B"));
         assertEquals("B", inverse.get("C"));
-        
-        map.put("E", "F");
+
+        map.put((K) "E", (V) "F");
         assertEquals(2, map.size());
         assertEquals(map.size(), inverse.size());
         assertEquals("F", map.get("E"));
@@ -151,33 +123,33 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
     }
 
     public void verifyInverse() {
-        assertEquals(map.size(), ((BidiMap) map).inverseBidiMap().size());
-        Map map1 = new HashMap(map);
-        Map map2 = new HashMap(((BidiMap) map).inverseBidiMap());
-        Set keys1 = map1.keySet();
-        Set keys2 = map2.keySet();
-        Collection values1 = map1.values();
-        Collection values2 = map2.values();
+        assertEquals(map.size(), ((BidiMap<K, V>) map).inverseBidiMap().size());
+        Map<K, V> map1 = new HashMap<K, V>(map);
+        Map<V, K> map2 = new HashMap<V, K>(((BidiMap<K, V>) map).inverseBidiMap());
+        Set<K> keys1 = map1.keySet();
+        Set<V> keys2 = map2.keySet();
+        Collection<V> values1 = map1.values();
+        Collection<K> values2 = map2.values();
         assertEquals(true, keys1.containsAll(values2));
         assertEquals(true, values2.containsAll(keys1));
         assertEquals(true, values1.containsAll(keys2));
         assertEquals(true, keys2.containsAll(values1));
     }
-    
+
     // testGetKey
     //-----------------------------------------------------------------------
     public void testBidiGetKey() {
-        doTestGetKey(makeFullBidiMap(), entries[0][0], entries[0][1]);
+        doTestGetKey(makeFullMap(), getSampleKeys()[0], getSampleValues()[0]);
     }
 
     public void testBidiGetKeyInverse() {
         doTestGetKey(
-            makeFullBidiMap().inverseBidiMap(),
-            entries[0][1],
-            entries[0][0]);
+            makeFullMap().inverseBidiMap(),
+            getSampleValues()[0],
+            getSampleKeys()[0]);
     }
 
-    private final void doTestGetKey(BidiMap map, Object key, Object value) {
+    private final void doTestGetKey(BidiMap<?, ?> map, Object key, Object value) {
         assertEquals("Value not found for key.", value, map.get(key));
         assertEquals("Key not found for value.", key, map.getKey(value));
     }
@@ -185,8 +157,8 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
     // testInverse
     //-----------------------------------------------------------------------
     public void testBidiInverse() {
-        final BidiMap map = makeFullBidiMap();
-        final BidiMap inverseMap = map.inverseBidiMap();
+        final BidiMap<K, V> map = makeFullMap();
+        final BidiMap<V, K> inverseMap = map.inverseBidiMap();
 
         assertSame(
             "Inverse of inverse is not equal to original.",
@@ -195,26 +167,27 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
 
         assertEquals(
             "Value not found for key.",
-            entries[0][0],
-            inverseMap.get(entries[0][1]));
+            getSampleKeys()[0],
+            inverseMap.get(getSampleValues()[0]));
 
         assertEquals(
             "Key not found for value.",
-            entries[0][1],
-            inverseMap.getKey(entries[0][0]));
+            getSampleValues()[0],
+            inverseMap.getKey(getSampleKeys()[0]));
     }
 
     //-----------------------------------------------------------------------
     public void testBidiModifyEntrySet() {
         if (isSetValueSupported() == false) return;
-        
-        modifyEntrySet(makeFullBidiMap());
-        modifyEntrySet(makeFullBidiMap().inverseBidiMap());
+
+        modifyEntrySet(makeFullMap());
+        modifyEntrySet(makeFullMap().inverseBidiMap());
     }
 
-    private final void modifyEntrySet(BidiMap map) {
+    @SuppressWarnings("unchecked")
+    private final <T> void modifyEntrySet(BidiMap<?, T> map) {
         // Gets first entry
-        final Map.Entry entry = (Map.Entry)map.entrySet().iterator().next();
+        final Map.Entry<?, T> entry = map.entrySet().iterator().next();
 
         // Gets key and value
         final Object key = entry.getKey();
@@ -222,7 +195,7 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
 
         // Sets new value
         final Object newValue = "newValue";
-        entry.setValue(newValue);
+        entry.setValue((T) newValue);
 
         assertEquals(
             "Modifying entrySet did not affect underlying Map.",
@@ -238,19 +211,19 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
     public void testBidiClear() {
         if (isRemoveSupported() == false) {
             try {
-                makeFullBidiMap().clear();
+                makeFullMap().clear();
                 fail();
             } catch(UnsupportedOperationException ex) {}
             return;
         }
 
-        BidiMap map = makeFullBidiMap();
+        BidiMap<?, ?> map = makeFullMap();
         map.clear();
         assertTrue("Map was not cleared.", map.isEmpty());
         assertTrue("Inverse map was not cleared.", map.inverseBidiMap().isEmpty());
 
         // Tests clear on inverse
-        map = makeFullBidiMap().inverseBidiMap();
+        map = makeFullMap().inverseBidiMap();
         map.clear();
         assertTrue("Map was not cleared.", map.isEmpty());
         assertTrue("Inverse map was not cleared.", map.inverseBidiMap().isEmpty());
@@ -261,32 +234,32 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
     public void testBidiRemove() {
         if (isRemoveSupported() == false) {
             try {
-                makeFullBidiMap().remove(entries[0][0]);
+                makeFullMap().remove(getSampleKeys()[0]);
                 fail();
             } catch(UnsupportedOperationException ex) {}
             try {
-                makeFullBidiMap().removeValue(entries[0][1]);
+                makeFullMap().removeValue(getSampleValues()[0]);
                 fail();
             } catch(UnsupportedOperationException ex) {}
             return;
         }
-        
-        remove(makeFullBidiMap(), entries[0][0]);
-        remove(makeFullBidiMap().inverseBidiMap(), entries[0][1]);
-
-        removeValue(makeFullBidiMap(), entries[0][1]);
-        removeValue(makeFullBidiMap().inverseBidiMap(), entries[0][0]);
-        
-        assertEquals(null, makeFullBidiMap().removeValue("NotPresent"));
+
+        remove(makeFullMap(), getSampleKeys()[0]);
+        remove(makeFullMap().inverseBidiMap(), getSampleValues()[0]);
+
+        removeValue(makeFullMap(), getSampleValues()[0]);
+        removeValue(makeFullMap().inverseBidiMap(), getSampleKeys()[0]);
+
+        assertEquals(null, makeFullMap().removeValue("NotPresent"));
     }
 
-    private final void remove(BidiMap map, Object key) {
+    private final void remove(BidiMap<?, ?> map, Object key) {
         final Object value = map.remove(key);
         assertTrue("Key was not removed.", !map.containsKey(key));
         assertNull("Value was not removed.", map.getKey(value));
     }
 
-    private final void removeValue(BidiMap map, Object value) {
+    private final void removeValue(BidiMap<?, ?> map, Object value) {
         final Object key = map.removeValue(value);
         assertTrue("Key was not removed.", !map.containsKey(key));
         assertNull("Value was not removed.", map.getKey(value));
@@ -295,11 +268,11 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
     //-----------------------------------------------------------------------
     public void testBidiKeySetValuesOrder() {
         resetFull();
-        Iterator keys = map.keySet().iterator();
-        Iterator values = map.values().iterator();
+        Iterator<K> keys = map.keySet().iterator();
+        Iterator<V> values = map.values().iterator();
         for (; keys.hasNext() && values.hasNext();) {
-            Object key = keys.next();
-            Object value = values.next();
+            K key = keys.next();
+            V value = values.next();
             assertSame(map.get(key), value);
         }
         assertEquals(false, keys.hasNext());
@@ -309,12 +282,12 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
     //-----------------------------------------------------------------------
     public void testBidiRemoveByKeySet() {
         if (isRemoveSupported() == false) return;
-        
-        removeByKeySet(makeFullBidiMap(), entries[0][0], entries[0][1]);
-        removeByKeySet(makeFullBidiMap().inverseBidiMap(), entries[0][1], entries[0][0]);
+
+        removeByKeySet(makeFullMap(), getSampleKeys()[0], getSampleValues()[0]);
+        removeByKeySet(makeFullMap().inverseBidiMap(), getSampleValues()[0], getSampleKeys()[0]);
     }
 
-    private final void removeByKeySet(BidiMap map, Object key, Object value) {
+    private final void removeByKeySet(BidiMap<?, ?> map, Object key, Object value) {
         map.keySet().remove(key);
 
         assertTrue("Key was not removed.", !map.containsKey(key));
@@ -331,13 +304,13 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
     //-----------------------------------------------------------------------
     public void testBidiRemoveByEntrySet() {
         if (isRemoveSupported() == false) return;
-        
-        removeByEntrySet(makeFullBidiMap(), entries[0][0], entries[0][1]);
-        removeByEntrySet(makeFullBidiMap().inverseBidiMap(), entries[0][1], entries[0][0]);
+
+        removeByEntrySet(makeFullMap(), getSampleKeys()[0], getSampleValues()[0]);
+        removeByEntrySet(makeFullMap().inverseBidiMap(), getSampleValues()[0], getSampleKeys()[0]);
     }
 
-    private final void removeByEntrySet(BidiMap map, Object key, Object value) {
-        Map temp = new HashMap();
+    private final void removeByEntrySet(BidiMap<?, ?> map, Object key, Object value) {
+        Map<Object, Object> temp = new HashMap<Object, Object>();
         temp.put(key, value);
         map.entrySet().remove(temp.entrySet().iterator().next());
 
@@ -352,6 +325,14 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
             !map.inverseBidiMap().containsKey(value));
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public BidiMap<K, V> getMap() {
+        return (BidiMap<K, V>) super.getMap();
+    }
+
     //-----------------------------------------------------------------------
     public BulkTest bulkTestMapEntrySet() {
         return new TestBidiMapEntrySet();
@@ -362,24 +343,24 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
             super();
         }
         public void testMapEntrySetIteratorEntrySetValueCrossCheck() {
-            Object key1 = getSampleKeys()[0];
-            Object key2 = getSampleKeys()[1];
-            Object newValue1 = getNewSampleValues()[0];
-            Object newValue2 = getNewSampleValues()[1];
-                
+            K key1 = getSampleKeys()[0];
+            K key2 = getSampleKeys()[1];
+            V newValue1 = getNewSampleValues()[0];
+            V newValue2 = getNewSampleValues()[1];
+
             resetFull();
             // explicitly get entries as sample values/keys are connected for some maps
             // such as BeanMap
-            Iterator it = TestBidiMapEntrySet.this.collection.iterator();
-            Map.Entry entry1 = getEntry(it, key1);
-            it = TestBidiMapEntrySet.this.collection.iterator();
-            Map.Entry entry2 = getEntry(it, key2);
-            Iterator itConfirmed = TestBidiMapEntrySet.this.confirmed.iterator();
-            Map.Entry entryConfirmed1 = getEntry(itConfirmed, key1);
-            itConfirmed = TestBidiMapEntrySet.this.confirmed.iterator();
-            Map.Entry entryConfirmed2 = getEntry(itConfirmed, key2);
+            Iterator<Map.Entry<K, V>> it = TestBidiMapEntrySet.this.getCollection().iterator();
+            Map.Entry<K, V> entry1 = getEntry(it, key1);
+            it = TestBidiMapEntrySet.this.getCollection().iterator();
+            Map.Entry<K, V> entry2 = getEntry(it, key2);
+            Iterator<Map.Entry<K, V>> itConfirmed = TestBidiMapEntrySet.this.getConfirmed().iterator();
+            Map.Entry<K, V> entryConfirmed1 = getEntry(itConfirmed, key1);
+            itConfirmed = TestBidiMapEntrySet.this.getConfirmed().iterator();
+            Map.Entry<K, V> entryConfirmed2 = getEntry(itConfirmed, key2);
             TestBidiMapEntrySet.this.verify();
-                
+
             if (isSetValueSupported() == false) {
                 try {
                     entry1.setValue(newValue1);
@@ -388,12 +369,12 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
                 return;
             }
 
-            // these checked in superclass                
+            // these checked in superclass
             entry1.setValue(newValue1);
             entryConfirmed1.setValue(newValue1);
             entry2.setValue(newValue2);
             entryConfirmed2.setValue(newValue2);
-            
+
             // at this point
             // key1=newValue1, key2=newValue2
             try {
@@ -402,15 +383,15 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
                 return;  // simplest way of dealing with tricky situation
             }
             entryConfirmed2.setValue(newValue1);
-            AbstractTestBidiMap.this.confirmed.remove(key1);
+            AbstractTestBidiMap.this.getConfirmed().remove(key1);
             assertEquals(newValue1, entry2.getValue());
-            assertEquals(true, AbstractTestBidiMap.this.map.containsKey(entry2.getKey()));
-            assertEquals(true, AbstractTestBidiMap.this.map.containsValue(newValue1));
-            assertEquals(newValue1, AbstractTestBidiMap.this.map.get(entry2.getKey()));
-            assertEquals(false, AbstractTestBidiMap.this.map.containsKey(key1));
-            assertEquals(false, AbstractTestBidiMap.this.map.containsValue(newValue2));
+            assertEquals(true, AbstractTestBidiMap.this.getMap().containsKey(entry2.getKey()));
+            assertEquals(true, AbstractTestBidiMap.this.getMap().containsValue(newValue1));
+            assertEquals(newValue1, AbstractTestBidiMap.this.getMap().get(entry2.getKey()));
+            assertEquals(false, AbstractTestBidiMap.this.getMap().containsKey(key1));
+            assertEquals(false, AbstractTestBidiMap.this.getMap().containsValue(newValue2));
             TestBidiMapEntrySet.this.verify();
-            
+
             // check for ConcurrentModification
             it.next();  // if you fail here, maybe you should be throwing an IAE, see above
             if (isRemoveSupported()) {
@@ -418,72 +399,78 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
             }
         }
     }
-        
+
     public BulkTest bulkTestInverseMap() {
         return new TestInverseBidiMap(this);
     }
 
-    public class TestInverseBidiMap extends AbstractTestBidiMap {
-        final AbstractTestBidiMap main;
-        
-        public TestInverseBidiMap(AbstractTestBidiMap main) {
+    public class TestInverseBidiMap extends AbstractTestBidiMap<V, K> {
+        final AbstractTestBidiMap<K, V> main;
+
+        public TestInverseBidiMap(AbstractTestBidiMap<K, V> main) {
             super();
             this.main = main;
         }
-        public BidiMap makeEmptyBidiMap() {
-            return main.makeEmptyBidiMap().inverseBidiMap();
-        }
-        public BidiMap makeFullBidiMap() {
-            return main.makeFullBidiMap().inverseBidiMap();
+
+        public BidiMap<V, K> makeObject() {
+            return main.makeObject().inverseBidiMap();
         }
-        public Map makeFullMap() {
-            return ((BidiMap) main.makeFullMap()).inverseBidiMap();
+
+        public BidiMap<V, K> makeFullMap() {
+            return main.makeFullMap().inverseBidiMap();
         }
-        public Object[] getSampleKeys() {
+
+        public V[] getSampleKeys() {
             return main.getSampleValues();
         }
-        public Object[] getSampleValues() {
+        public K[] getSampleValues() {
             return main.getSampleKeys();
         }
-        
+
         public String getCompatibilityVersion() {
             return main.getCompatibilityVersion();
         }
+
         public boolean isAllowNullKey() {
             return main.isAllowNullKey();
         }
+
         public boolean isAllowNullValue() {
             return main.isAllowNullValue();
         }
+
         public boolean isPutAddSupported() {
             return main.isPutAddSupported();
         }
+
         public boolean isPutChangeSupported() {
             return main.isPutChangeSupported();
         }
+
         public boolean isSetValueSupported() {
             return main.isSetValueSupported();
         }
+
         public boolean isRemoveSupported() {
             return main.isRemoveSupported();
         }
 
     }
-    
+
     //-----------------------------------------------------------------------
     public BulkTest bulkTestBidiMapIterator() {
         return new TestBidiMapIterator();
     }
-    
-    public class TestBidiMapIterator extends AbstractTestMapIterator {
+
+    public class TestBidiMapIterator extends AbstractTestMapIterator<K, V> {
         public TestBidiMapIterator() {
             super("TestBidiMapIterator");
         }
-        
-        public Object[] addSetValues() {
+
+        public V[] addSetValues() {
             return AbstractTestBidiMap.this.getNewSampleValues();
         }
-        
+
         public boolean supportsRemove() {
             return AbstractTestBidiMap.this.isRemoveSupported();
         }
@@ -492,43 +479,43 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
             return AbstractTestBidiMap.this.isSetValueSupported();
         }
 
-        public MapIterator makeEmptyMapIterator() {
+        public MapIterator<K, V> makeEmptyIterator() {
             resetEmpty();
-            return ((BidiMap) AbstractTestBidiMap.this.map).mapIterator();
+            return AbstractTestBidiMap.this.getMap().mapIterator();
         }
 
-        public MapIterator makeFullMapIterator() {
+        public MapIterator<K, V> makeObject() {
             resetFull();
-            return ((BidiMap) AbstractTestBidiMap.this.map).mapIterator();
+            return AbstractTestBidiMap.this.getMap().mapIterator();
         }
-        
-        public Map getMap() {
+
+        public BidiMap<K, V> getMap() {
             // assumes makeFullMapIterator() called first
-            return AbstractTestBidiMap.this.map;
+            return AbstractTestBidiMap.this.getMap();
         }
-        
-        public Map getConfirmedMap() {
+
+        public Map<K, V> getConfirmedMap() {
             // assumes makeFullMapIterator() called first
-            return AbstractTestBidiMap.this.confirmed;
+            return AbstractTestBidiMap.this.getConfirmed();
         }
-        
+
         public void verify() {
             super.verify();
             AbstractTestBidiMap.this.verify();
         }
     }
-    
+
     //-----------------------------------------------------------------------
     public void testBidiMapIteratorSet() {
-        Object newValue1 = getOtherValues()[0];
-        Object newValue2 = getOtherValues()[1];
-        
+        V newValue1 = getOtherValues()[0];
+        V newValue2 = getOtherValues()[1];
+
         resetFull();
-        BidiMap bidi = (BidiMap) map;
-        MapIterator it = bidi.mapIterator();
+        BidiMap<K, V> bidi = getMap();
+        MapIterator<K, V> it = bidi.mapIterator();
         assertEquals(true, it.hasNext());
-        Object key1 = it.next();
-        
+        K key1 = it.next();
+
         if (isSetValueSupported() == false) {
             try {
                 it.setValue(newValue1);
@@ -537,7 +524,7 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
             }
             return;
         }
-        
+
         it.setValue(newValue1);
         confirmed.put(key1, newValue1);
         assertSame(key1, it.getKey());
@@ -546,7 +533,7 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
         assertEquals(true, bidi.containsValue(newValue1));
         assertEquals(newValue1, bidi.get(key1));
         verify();
-        
+
         it.setValue(newValue1);  // same value - should be OK
         confirmed.put(key1, newValue1);
         assertSame(key1, it.getKey());
@@ -555,8 +542,8 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
         assertEquals(true, bidi.containsValue(newValue1));
         assertEquals(newValue1, bidi.get(key1));
         verify();
-        
-        Object key2 = it.next();
+
+        K key2 = it.next();
         it.setValue(newValue2);
         confirmed.put(key2, newValue2);
         assertSame(key2, it.getKey());
@@ -565,7 +552,7 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
         assertEquals(true, bidi.containsValue(newValue2));
         assertEquals(newValue2, bidi.get(key2));
         verify();
-        
+
         // at this point
         // key1=newValue1, key2=newValue2
         try {
@@ -575,7 +562,7 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
             return;  // simplest way of dealing with tricky situation
         }
         confirmed.put(key2, newValue1);
-        AbstractTestBidiMap.this.confirmed.remove(key1);
+        AbstractTestBidiMap.this.getConfirmed().remove(key1);
         assertEquals(newValue1, it.getValue());
         assertEquals(true, bidi.containsKey(it.getKey()));
         assertEquals(true, bidi.containsValue(newValue1));
@@ -583,7 +570,7 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
         assertEquals(false, bidi.containsKey(key1));
         assertEquals(false, bidi.containsValue(newValue2));
         verify();
-            
+
         // check for ConcurrentModification
         it.next();  // if you fail here, maybe you should be throwing an IAE, see above
         if (isRemoveSupported()) {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/bidimap/AbstractTestOrderedBidiMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bidimap/AbstractTestOrderedBidiMap.java b/src/test/org/apache/commons/collections/bidimap/AbstractTestOrderedBidiMap.java
index 802810f..dcf7e29 100644
--- a/src/test/org/apache/commons/collections/bidimap/AbstractTestOrderedBidiMap.java
+++ b/src/test/org/apache/commons/collections/bidimap/AbstractTestOrderedBidiMap.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,13 +30,13 @@ import org.apache.commons.collections.iterators.AbstractTestMapIterator;
 
 /**
  * Abstract test class for {@link OrderedBidiMap} methods and contracts.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Matthew Hawthorne
  * @author Stephen Colebourne
  */
-public abstract class AbstractTestOrderedBidiMap extends AbstractTestBidiMap {
+public abstract class AbstractTestOrderedBidiMap<K, V> extends AbstractTestBidiMap<K, V> {
 
     public AbstractTestOrderedBidiMap(String testName) {
         super(testName);
@@ -49,39 +49,39 @@ public abstract class AbstractTestOrderedBidiMap extends AbstractTestBidiMap {
     //-----------------------------------------------------------------------
     public void testFirstKey() {
         resetEmpty();
-        OrderedBidiMap bidi = (OrderedBidiMap) map;
+        OrderedBidiMap<K, V> bidi = getMap();
         try {
             bidi.firstKey();
             fail();
         } catch (NoSuchElementException ex) {}
-        
+
         resetFull();
-        bidi = (OrderedBidiMap) map;
-        Object confirmedFirst = confirmed.keySet().iterator().next();
+        bidi = getMap();
+        K confirmedFirst = confirmed.keySet().iterator().next();
         assertEquals(confirmedFirst, bidi.firstKey());
     }
-    
+
     public void testLastKey() {
         resetEmpty();
-        OrderedBidiMap bidi = (OrderedBidiMap) map;
+        OrderedBidiMap<K, V> bidi = getMap();
         try {
             bidi.lastKey();
             fail();
         } catch (NoSuchElementException ex) {}
-        
+
         resetFull();
-        bidi = (OrderedBidiMap) map;
-        Object confirmedLast = null;
-        for (Iterator it = confirmed.keySet().iterator(); it.hasNext();) {
+        bidi = getMap();
+        K confirmedLast = null;
+        for (Iterator<K> it = confirmed.keySet().iterator(); it.hasNext();) {
             confirmedLast = it.next();
         }
         assertEquals(confirmedLast, bidi.lastKey());
     }
 
-    //-----------------------------------------------------------------------    
+    //-----------------------------------------------------------------------
     public void testNextKey() {
         resetEmpty();
-        OrderedBidiMap bidi = (OrderedBidiMap) map;
+        OrderedBidiMap<K, V> bidi = (OrderedBidiMap<K, V>) map;
         assertEquals(null, bidi.nextKey(getOtherKeys()[0]));
         if (isAllowNullKey() == false) {
             try {
@@ -90,18 +90,18 @@ public abstract class AbstractTestOrderedBidiMap extends AbstractTestBidiMap {
         } else {
             assertEquals(null, bidi.nextKey(null));
         }
-        
+
         resetFull();
-        bidi = (OrderedBidiMap) map;
-        Iterator it = confirmed.keySet().iterator();
-        Object confirmedLast = it.next();
+        bidi = (OrderedBidiMap<K, V>) map;
+        Iterator<K> it = confirmed.keySet().iterator();
+        K confirmedLast = it.next();
         while (it.hasNext()) {
-            Object confirmedObject = it.next();
+            K confirmedObject = it.next();
             assertEquals(confirmedObject, bidi.nextKey(confirmedLast));
             confirmedLast = confirmedObject;
         }
         assertEquals(null, bidi.nextKey(confirmedLast));
-        
+
         if (isAllowNullKey() == false) {
             try {
                 bidi.nextKey(null);
@@ -111,10 +111,10 @@ public abstract class AbstractTestOrderedBidiMap extends AbstractTestBidiMap {
             assertEquals(null, bidi.nextKey(null));
         }
     }
-    
+
     public void testPreviousKey() {
         resetEmpty();
-        OrderedBidiMap bidi = (OrderedBidiMap) map;
+        OrderedBidiMap<K, V> bidi = getMap();
         assertEquals(null, bidi.previousKey(getOtherKeys()[0]));
         if (isAllowNullKey() == false) {
             try {
@@ -123,20 +123,20 @@ public abstract class AbstractTestOrderedBidiMap extends AbstractTestBidiMap {
         } else {
             assertEquals(null, bidi.previousKey(null));
         }
-        
+
         resetFull();
-        bidi = (OrderedBidiMap) map;
-        List list = new ArrayList(confirmed.keySet());
+        bidi = getMap();
+        List<K> list = new ArrayList<K>(confirmed.keySet());
         Collections.reverse(list);
-        Iterator it = list.iterator();
-        Object confirmedLast = it.next();
+        Iterator<K> it = list.iterator();
+        K confirmedLast = it.next();
         while (it.hasNext()) {
-            Object confirmedObject = it.next();
+            K confirmedObject = it.next();
             assertEquals(confirmedObject, bidi.previousKey(confirmedLast));
             confirmedLast = confirmedObject;
         }
         assertEquals(null, bidi.previousKey(confirmedLast));
-        
+
         if (isAllowNullKey() == false) {
             try {
                 bidi.previousKey(null);
@@ -146,21 +146,29 @@ public abstract class AbstractTestOrderedBidiMap extends AbstractTestBidiMap {
             assertEquals(null, bidi.previousKey(null));
         }
     }
-    
+
     //-----------------------------------------------------------------------
     public BulkTest bulkTestOrderedMapIterator() {
         return new TestBidiOrderedMapIterator();
     }
-    
-    public class TestBidiOrderedMapIterator extends AbstractTestMapIterator {
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public OrderedBidiMap<K, V> getMap() {
+        return (OrderedBidiMap<K, V>) super.getMap();
+    }
+
+    public class TestBidiOrderedMapIterator extends AbstractTestMapIterator<K, V> {
         public TestBidiOrderedMapIterator() {
             super("TestBidiOrderedMapIterator");
         }
-        
-        public Object[] addSetValues() {
+
+        public V[] addSetValues() {
             return AbstractTestOrderedBidiMap.this.getNewSampleValues();
         }
-        
+
         public boolean supportsRemove() {
             return AbstractTestOrderedBidiMap.this.isRemoveSupported();
         }
@@ -169,30 +177,30 @@ public abstract class AbstractTestOrderedBidiMap extends AbstractTestBidiMap {
             return AbstractTestOrderedBidiMap.this.isSetValueSupported();
         }
 
-        public MapIterator makeEmptyMapIterator() {
+        public MapIterator<K, V> makeEmptyIterator() {
             resetEmpty();
-            return ((OrderedBidiMap) AbstractTestOrderedBidiMap.this.map).orderedMapIterator();
+            return AbstractTestOrderedBidiMap.this.getMap().mapIterator();
         }
 
-        public MapIterator makeFullMapIterator() {
+        public MapIterator<K, V> makeObject() {
             resetFull();
-            return ((OrderedBidiMap) AbstractTestOrderedBidiMap.this.map).orderedMapIterator();
+            return AbstractTestOrderedBidiMap.this.getMap().mapIterator();
         }
-        
-        public Map getMap() {
+
+        public Map<K, V> getMap() {
             // assumes makeFullMapIterator() called first
             return AbstractTestOrderedBidiMap.this.map;
         }
-        
-        public Map getConfirmedMap() {
+
+        public Map<K, V> getConfirmedMap() {
             // assumes makeFullMapIterator() called first
             return AbstractTestOrderedBidiMap.this.confirmed;
         }
-        
+
         public void verify() {
             super.verify();
             AbstractTestOrderedBidiMap.this.verify();
         }
     }
-    
+
 }


[22/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/AbstractInputCheckedMapDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/AbstractInputCheckedMapDecorator.java b/src/java/org/apache/commons/collections/map/AbstractInputCheckedMapDecorator.java
index 0add873..e8be0cd 100644
--- a/src/java/org/apache/commons/collections/map/AbstractInputCheckedMapDecorator.java
+++ b/src/java/org/apache/commons/collections/map/AbstractInputCheckedMapDecorator.java
@@ -44,8 +44,8 @@ import org.apache.commons.collections.set.AbstractSetDecorator;
  * 
  * @author Stephen Colebourne
  */
-abstract class AbstractInputCheckedMapDecorator
-        extends AbstractMapDecorator {
+abstract class AbstractInputCheckedMapDecorator<K, V>
+        extends AbstractMapDecorator<K, V> {
 
     /**
      * Constructor only used in deserialization, do not use otherwise.
@@ -60,7 +60,7 @@ abstract class AbstractInputCheckedMapDecorator
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if map is null
      */
-    protected AbstractInputCheckedMapDecorator(Map map) {
+    protected AbstractInputCheckedMapDecorator(Map<K, V> map) {
         super(map);
     }
 
@@ -79,7 +79,7 @@ abstract class AbstractInputCheckedMapDecorator
      * @throws ClassCastException if the class of the specified value is invalid
      * @throws NullPointerException if the specified value is null and nulls are invalid
      */
-    protected abstract Object checkSetValue(Object value);
+    protected abstract V checkSetValue(V value);
 
     /**
      * Hook method called to determine if <code>checkSetValue</code> has any effect.
@@ -96,41 +96,43 @@ abstract class AbstractInputCheckedMapDecorator
     }
 
     //-----------------------------------------------------------------------
-    public Set entrySet() {
+    public Set<Map.Entry<K, V>> entrySet() {
         if (isSetValueChecking()) {
             return new EntrySet(map.entrySet(), this);
-        } else {
-            return map.entrySet();
         }
+        return map.entrySet();
     }
 
     //-----------------------------------------------------------------------
     /**
      * Implementation of an entry set that checks additions via setValue.
      */
-    static class EntrySet extends AbstractSetDecorator {
+    @SuppressWarnings("serial")
+    private class EntrySet extends AbstractSetDecorator<Map.Entry<K, V>> {
         
         /** The parent map */
-        private final AbstractInputCheckedMapDecorator parent;
+        private final AbstractInputCheckedMapDecorator<K, V> parent;
 
-        protected EntrySet(Set set, AbstractInputCheckedMapDecorator parent) {
+        protected EntrySet(Set<Map.Entry<K, V>> set, AbstractInputCheckedMapDecorator<K, V> parent) {
             super(set);
             this.parent = parent;
         }
 
-        public Iterator iterator() {
+        public Iterator<Map.Entry<K, V>> iterator() {
             return new EntrySetIterator(collection.iterator(), parent);
         }
         
+        @SuppressWarnings("unchecked")
         public Object[] toArray() {
             Object[] array = collection.toArray();
             for (int i = 0; i < array.length; i++) {
-                array[i] = new MapEntry((Map.Entry) array[i], parent);
+                array[i] = new MapEntry((Map.Entry<K, V>) array[i], parent);
             }
             return array;
         }
         
-        public Object[] toArray(Object array[]) {
+        @SuppressWarnings("unchecked")
+        public <T> T[] toArray(T[] array) {
             Object[] result = array;
             if (array.length > 0) {
                 // we must create a new array to handle multi-threaded situations
@@ -139,12 +141,12 @@ abstract class AbstractInputCheckedMapDecorator
             }
             result = collection.toArray(result);
             for (int i = 0; i < result.length; i++) {
-                result[i] = new MapEntry((Map.Entry) result[i], parent);
+                result[i] = new MapEntry((Map.Entry<K, V>) result[i], parent);
             }
 
             // check to see if result should be returned straight
             if (result.length > array.length) {
-                return result;
+                return (T[]) result;
             }
 
             // copy back into input array to fulfil the method contract
@@ -159,18 +161,18 @@ abstract class AbstractInputCheckedMapDecorator
     /**
      * Implementation of an entry set iterator that checks additions via setValue.
      */
-    static class EntrySetIterator extends AbstractIteratorDecorator {
-        
+    private class EntrySetIterator extends AbstractIteratorDecorator<Map.Entry<K, V>> {
+
         /** The parent map */
-        private final AbstractInputCheckedMapDecorator parent;
-        
-        protected EntrySetIterator(Iterator iterator, AbstractInputCheckedMapDecorator parent) {
+        private final AbstractInputCheckedMapDecorator<K, V> parent;
+
+        protected EntrySetIterator(Iterator<Map.Entry<K, V>> iterator, AbstractInputCheckedMapDecorator<K, V> parent) {
             super(iterator);
             this.parent = parent;
         }
-        
-        public Object next() {
-            Map.Entry entry = (Map.Entry) iterator.next();
+
+        public Map.Entry<K, V> next() {
+            Map.Entry<K, V> entry = iterator.next();
             return new MapEntry(entry, parent);
         }
     }
@@ -178,17 +180,17 @@ abstract class AbstractInputCheckedMapDecorator
     /**
      * Implementation of a map entry that checks additions via setValue.
      */
-    static class MapEntry extends AbstractMapEntryDecorator {
+    private class MapEntry extends AbstractMapEntryDecorator<K, V> {
 
         /** The parent map */
-        private final AbstractInputCheckedMapDecorator parent;
+        private final AbstractInputCheckedMapDecorator<K, V> parent;
 
-        protected MapEntry(Map.Entry entry, AbstractInputCheckedMapDecorator parent) {
+        protected MapEntry(Map.Entry<K, V> entry, AbstractInputCheckedMapDecorator<K, V> parent) {
             super(entry);
             this.parent = parent;
         }
 
-        public Object setValue(Object value) {
+        public V setValue(V value) {
             value = parent.checkSetValue(value);
             return entry.setValue(value);
         }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java b/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java
index 4a735a5..9086918 100644
--- a/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java
+++ b/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java
@@ -21,7 +21,6 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.NoSuchElementException;
 
-import org.apache.commons.collections.MapIterator;
 import org.apache.commons.collections.OrderedIterator;
 import org.apache.commons.collections.OrderedMap;
 import org.apache.commons.collections.OrderedMapIterator;
@@ -63,10 +62,10 @@ import org.apache.commons.collections.iterators.EmptyOrderedMapIterator;
  * @author java util LinkedHashMap
  * @author Stephen Colebourne
  */
-public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
+public abstract class AbstractLinkedMap<K, V> extends AbstractHashedMap<K, V> implements OrderedMap<K, V> {
     
     /** Header in the linked list */
-    protected transient LinkEntry header;
+    protected transient LinkEntry<K, V> header;
 
     /**
      * Constructor only used in deserialization, do not use otherwise.
@@ -115,7 +114,7 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
      * @param map  the map to copy
      * @throws NullPointerException if the map is null
      */
-    protected AbstractLinkedMap(Map map) {
+    protected AbstractLinkedMap(Map<K, V> map) {
         super(map);
     }
 
@@ -127,7 +126,7 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
      * the map entry object.
      */
     protected void init() {
-        header = (LinkEntry) createEntry(null, -1, null, null);
+        header = createEntry(null, -1, null, null);
         header.before = header.after = header;
     }
 
@@ -141,13 +140,13 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
     public boolean containsValue(Object value) {
         // override uses faster iterator
         if (value == null) {
-            for (LinkEntry entry = header.after; entry != header; entry = entry.after) {
+            for (LinkEntry<K, V> entry = header.after; entry != header; entry = entry.after) {
                 if (entry.getValue() == null) {
                     return true;
                 }
             }
         } else {
-            for (LinkEntry entry = header.after; entry != header; entry = entry.after) {
+            for (LinkEntry<K, V> entry = header.after; entry != header; entry = entry.after) {
                 if (isEqualValue(value, entry.getValue())) {
                     return true;
                 }
@@ -172,7 +171,7 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
      * 
      * @return the most recently inserted key
      */
-    public Object firstKey() {
+    public K firstKey() {
         if (size == 0) {
             throw new NoSuchElementException("Map is empty");
         }
@@ -184,7 +183,7 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
      * 
      * @return the eldest key
      */
-    public Object lastKey() {
+    public K lastKey() {
         if (size == 0) {
             throw new NoSuchElementException("Map is empty");
         }
@@ -197,19 +196,23 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
      * @param key  the key to get after
      * @return the next key
      */
-    public Object nextKey(Object key) {
-        LinkEntry entry = (LinkEntry) getEntry(key);
+    public K nextKey(Object key) {
+        LinkEntry<K, V> entry = getEntry(key);
         return (entry == null || entry.after == header ? null : entry.after.getKey());
     }
 
+    protected LinkEntry<K, V> getEntry(Object key) {
+        return (LinkEntry<K, V>) super.getEntry(key);
+    }
+
     /**
      * Gets the previous key in sequence.
      * 
      * @param key  the key to get before
      * @return the previous key
      */
-    public Object previousKey(Object key) {
-        LinkEntry entry = (LinkEntry) getEntry(key);
+    public K previousKey(Object key) {
+        LinkEntry<K, V> entry = getEntry(key);
         return (entry == null || entry.before == header ? null : entry.before.getKey());
     }
 
@@ -221,14 +224,14 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
      * @return the key at the specified index
      * @throws IndexOutOfBoundsException if the index is invalid
      */
-    protected LinkEntry getEntry(int index) {
+    protected LinkEntry<K, V> getEntry(int index) {
         if (index < 0) {
             throw new IndexOutOfBoundsException("Index " + index + " is less than zero");
         }
         if (index >= size) {
             throw new IndexOutOfBoundsException("Index " + index + " is invalid for size " + size);
         }
-        LinkEntry entry;
+        LinkEntry<K, V> entry;
         if (index < (size / 2)) {
             // Search forwards
             entry = header.after;
@@ -251,18 +254,18 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
      * This implementation adds the entry to the data storage table and
      * to the end of the linked list.
      * 
-     * @param entry  the entry to add
+     * @param link  the entry to add
      * @param hashIndex  the index into the data array to store at
      */
-    protected void addEntry(HashEntry entry, int hashIndex) {
-        LinkEntry link = (LinkEntry) entry;
+    protected void addEntry(HashEntry<K, V> entry, int hashIndex) {
+        LinkEntry<K, V> link = (LinkEntry<K, V>) entry;
         link.after  = header;
         link.before = header.before;
         header.before.after = link;
         header.before = link;
-        data[hashIndex] = entry;
+        data[hashIndex] = link;
     }
-    
+
     /**
      * Creates an entry to store the data.
      * <p>
@@ -274,10 +277,10 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
      * @param value  the value to store
      * @return the newly created entry
      */
-    protected HashEntry createEntry(HashEntry next, int hashCode, Object key, Object value) {
-        return new LinkEntry(next, hashCode, key, value);
+    protected LinkEntry<K, V> createEntry(HashEntry<K, V> next, int hashCode, K key, V value) {
+        return new LinkEntry<K, V>(next, hashCode, convertKey(key), value);
     }
-    
+
     /**
      * Removes an entry from the map and the linked list.
      * <p>
@@ -288,15 +291,15 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
      * @param hashIndex  the index into the data structure
      * @param previous  the previous entry in the chain
      */
-    protected void removeEntry(HashEntry entry, int hashIndex, HashEntry previous) {
-        LinkEntry link = (LinkEntry) entry;
+    protected void removeEntry(HashEntry<K, V> entry, int hashIndex, HashEntry<K, V> previous) {
+        LinkEntry<K, V> link = (LinkEntry<K, V>) entry;
         link.before.after = link.after;
         link.after.before = link.before;
         link.after = null;
         link.before = null;
         super.removeEntry(entry, hashIndex, previous);
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Gets the <code>before</code> field from a <code>LinkEntry</code>.
@@ -307,10 +310,10 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
      * @throws NullPointerException if the entry is null
      * @since Commons Collections 3.1
      */
-    protected LinkEntry entryBefore(LinkEntry entry) {
+    protected LinkEntry<K, V> entryBefore(LinkEntry<K, V> entry) {
         return entry.before;
     }
-    
+
     /**
      * Gets the <code>after</code> field from a <code>LinkEntry</code>.
      * Used in subclasses that have no visibility of the field.
@@ -320,87 +323,64 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
      * @throws NullPointerException if the entry is null
      * @since Commons Collections 3.1
      */
-    protected LinkEntry entryAfter(LinkEntry entry) {
+    protected LinkEntry<K, V> entryAfter(LinkEntry<K, V> entry) {
         return entry.after;
     }
-    
-    //-----------------------------------------------------------------------
-    /**
-     * Gets an iterator over the map.
-     * Changes made to the iterator affect this map.
-     * <p>
-     * A MapIterator returns the keys in the map. It also provides convenient
-     * methods to get the key and value, and set the value.
-     * It avoids the need to create an entrySet/keySet/values object.
-     * 
-     * @return the map iterator
-     */
-    public MapIterator mapIterator() {
-        if (size == 0) {
-            return EmptyOrderedMapIterator.INSTANCE;
-        }
-        return new LinkMapIterator(this);
-    }
 
+    //-----------------------------------------------------------------------
     /**
-     * Gets a bidirectional iterator over the map.
-     * Changes made to the iterator affect this map.
-     * <p>
-     * A MapIterator returns the keys in the map. It also provides convenient
-     * methods to get the key and value, and set the value.
-     * It avoids the need to create an entrySet/keySet/values object.
-     * 
-     * @return the map iterator
+     * {@inheritDoc}
      */
-    public OrderedMapIterator orderedMapIterator() {
+    public OrderedMapIterator<K, V> mapIterator() {
         if (size == 0) {
-            return EmptyOrderedMapIterator.INSTANCE;
+            return EmptyOrderedMapIterator.<K, V>getInstance();
         }
-        return new LinkMapIterator(this);
+        return new LinkMapIterator<K, V>(this);
     }
 
     /**
      * MapIterator implementation.
      */
-    protected static class LinkMapIterator extends LinkIterator implements OrderedMapIterator {
-        
-        protected LinkMapIterator(AbstractLinkedMap parent) {
+    protected static class LinkMapIterator<K, V> extends LinkIterator<K, V> implements
+            OrderedMapIterator<K, V>, ResettableIterator<K> {
+
+        protected LinkMapIterator(AbstractLinkedMap<K, V> parent) {
             super(parent);
         }
 
-        public Object next() {
+        public K next() {
             return super.nextEntry().getKey();
         }
 
-        public Object previous() {
+        public K previous() {
             return super.previousEntry().getKey();
         }
 
-        public Object getKey() {
-            HashEntry current = currentEntry();
+        public K getKey() {
+            LinkEntry<K, V> current = currentEntry();
             if (current == null) {
                 throw new IllegalStateException(AbstractHashedMap.GETKEY_INVALID);
             }
             return current.getKey();
         }
 
-        public Object getValue() {
-            HashEntry current = currentEntry();
+        public V getValue() {
+            LinkEntry<K, V> current = currentEntry();
             if (current == null) {
                 throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID);
             }
             return current.getValue();
         }
 
-        public Object setValue(Object value) {
-            HashEntry current = currentEntry();
+        public V setValue(V value) {
+            LinkEntry<K, V> current = currentEntry();
             if (current == null) {
                 throw new IllegalStateException(AbstractHashedMap.SETVALUE_INVALID);
             }
             return current.setValue(value);
         }
     }
-    
+
     //-----------------------------------------------------------------------    
     /**
      * Creates an entry set iterator.
@@ -408,27 +388,28 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
      * 
      * @return the entrySet iterator
      */
-    protected Iterator createEntrySetIterator() {
+    protected Iterator<Map.Entry<K, V>> createEntrySetIterator() {
         if (size() == 0) {
-            return EmptyOrderedIterator.INSTANCE;
+            return EmptyOrderedIterator.<Map.Entry<K, V>>getInstance();
         }
-        return new EntrySetIterator(this);
+        return new EntrySetIterator<K, V>(this);
     }
 
     /**
      * EntrySet iterator.
      */
-    protected static class EntrySetIterator extends LinkIterator {
-        
-        protected EntrySetIterator(AbstractLinkedMap parent) {
+    protected static class EntrySetIterator<K, V> extends LinkIterator<K, V> implements
+            OrderedIterator<Map.Entry<K, V>>, ResettableIterator<Map.Entry<K, V>> {
+
+        protected EntrySetIterator(AbstractLinkedMap<K, V> parent) {
             super(parent);
         }
 
-        public Object next() {
+        public Map.Entry<K, V> next() {
             return super.nextEntry();
         }
 
-        public Object previous() {
+        public Map.Entry<K, V> previous() {
             return super.previousEntry();
         }
     }
@@ -440,31 +421,33 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
      * 
      * @return the keySet iterator
      */
-    protected Iterator createKeySetIterator() {
+    protected Iterator<K> createKeySetIterator() {
         if (size() == 0) {
-            return EmptyOrderedIterator.INSTANCE;
+            return EmptyOrderedIterator.<K>getInstance();
         }
-        return new KeySetIterator(this);
+        return new KeySetIterator<K>(this);
     }
 
     /**
      * KeySet iterator.
      */
-    protected static class KeySetIterator extends EntrySetIterator {
+    protected static class KeySetIterator<K> extends LinkIterator<K, Object> implements
+            OrderedIterator<K>, ResettableIterator<K> {
         
-        protected KeySetIterator(AbstractLinkedMap parent) {
-            super(parent);
+        @SuppressWarnings("unchecked")
+        protected KeySetIterator(AbstractLinkedMap<K, ?> parent) {
+            super((AbstractLinkedMap<K, Object>) parent);
         }
 
-        public Object next() {
+        public K next() {
             return super.nextEntry().getKey();
         }
 
-        public Object previous() {
+        public K previous() {
             return super.previousEntry().getKey();
         }
     }
-    
+
     //-----------------------------------------------------------------------    
     /**
      * Creates a values iterator.
@@ -472,31 +455,33 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
      * 
      * @return the values iterator
      */
-    protected Iterator createValuesIterator() {
+    protected Iterator<V> createValuesIterator() {
         if (size() == 0) {
-            return EmptyOrderedIterator.INSTANCE;
+            return EmptyOrderedIterator.<V>getInstance();
         }
-        return new ValuesIterator(this);
+        return new ValuesIterator<V>(this);
     }
 
     /**
      * Values iterator.
      */
-    protected static class ValuesIterator extends LinkIterator {
-        
-        protected ValuesIterator(AbstractLinkedMap parent) {
-            super(parent);
+    protected static class ValuesIterator<V> extends LinkIterator<Object, V> implements
+            OrderedIterator<V>, ResettableIterator<V> {
+
+        @SuppressWarnings("unchecked")
+        protected ValuesIterator(AbstractLinkedMap<?, V> parent) {
+            super((AbstractLinkedMap<Object, V>) parent);
         }
 
-        public Object next() {
+        public V next() {
             return super.nextEntry().getValue();
         }
 
-        public Object previous() {
+        public V previous() {
             return super.previousEntry().getValue();
         }
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * LinkEntry that stores the data.
@@ -506,12 +491,12 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
      * The <code>entryXxx()</code> methods on <code>AbstractLinkedMap</code> exist
      * to provide the necessary access.
      */
-    protected static class LinkEntry extends HashEntry {
+    protected static class LinkEntry<K, V> extends HashEntry<K, V> {
         /** The entry before this one in the order */
-        protected LinkEntry before;
+        protected LinkEntry<K, V> before;
         /** The entry after this one in the order */
-        protected LinkEntry after;
-        
+        protected LinkEntry<K, V> after;
+
         /**
          * Constructs a new entry.
          * 
@@ -520,27 +505,26 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
          * @param key  the key
          * @param value  the value
          */
-        protected LinkEntry(HashEntry next, int hashCode, Object key, Object value) {
+        protected LinkEntry(HashEntry<K, V> next, int hashCode, Object key, V value) {
             super(next, hashCode, key, value);
         }
     }
-    
+
     /**
      * Base Iterator that iterates in link order.
      */
-    protected static abstract class LinkIterator
-            implements OrderedIterator, ResettableIterator {
-                
+    protected static abstract class LinkIterator<K, V> {
+
         /** The parent map */
-        protected final AbstractLinkedMap parent;
+        protected final AbstractLinkedMap<K, V> parent;
         /** The current (last returned) entry */
-        protected LinkEntry last;
+        protected LinkEntry<K, V> last;
         /** The next entry */
-        protected LinkEntry next;
+        protected LinkEntry<K, V> next;
         /** The modification count expected */
         protected int expectedModCount;
-        
-        protected LinkIterator(AbstractLinkedMap parent) {
+
+        protected LinkIterator(AbstractLinkedMap<K, V> parent) {
             super();
             this.parent = parent;
             this.next = parent.header.after;
@@ -550,12 +534,12 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
         public boolean hasNext() {
             return (next != parent.header);
         }
-        
+
         public boolean hasPrevious() {
             return (next.before != parent.header);
         }
 
-        protected LinkEntry nextEntry() {
+        protected LinkEntry<K, V> nextEntry() {
             if (parent.modCount != expectedModCount) {
                 throw new ConcurrentModificationException();
             }
@@ -567,11 +551,11 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
             return last;
         }
 
-        protected LinkEntry previousEntry() {
+        protected LinkEntry<K, V> previousEntry() {
             if (parent.modCount != expectedModCount) {
                 throw new ConcurrentModificationException();
             }
-            LinkEntry previous = next.before;
+            LinkEntry<K, V> previous = next.before;
             if (previous == parent.header)  {
                 throw new NoSuchElementException(AbstractHashedMap.NO_PREVIOUS_ENTRY);
             }
@@ -579,11 +563,11 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
             last = previous;
             return last;
         }
-        
-        protected LinkEntry currentEntry() {
+
+        protected LinkEntry<K, V> currentEntry() {
             return last;
         }
-        
+
         public void remove() {
             if (last == null) {
                 throw new IllegalStateException(AbstractHashedMap.REMOVE_INVALID);
@@ -595,7 +579,7 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
             last = null;
             expectedModCount = parent.modCount;
         }
-        
+
         public void reset() {
             last = null;
             next = parent.header.after;
@@ -604,10 +588,9 @@ public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
         public String toString() {
             if (last != null) {
                 return "Iterator[" + last.getKey() + "=" + last.getValue() + "]";
-            } else {
-                return "Iterator[]";
             }
+            return "Iterator[]";
         }
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java b/src/java/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java
index 4a26fa4..4998a03 100644
--- a/src/java/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java
+++ b/src/java/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java
@@ -16,7 +16,6 @@
  */
 package org.apache.commons.collections.map;
 
-import org.apache.commons.collections.MapIterator;
 import org.apache.commons.collections.OrderedMap;
 import org.apache.commons.collections.OrderedMapIterator;
 
@@ -37,9 +36,8 @@ import org.apache.commons.collections.OrderedMapIterator;
  * 
  * @author Stephen Colebourne
  */
-public abstract class AbstractOrderedMapDecorator
-        extends AbstractMapDecorator
-        implements OrderedMap {
+public abstract class AbstractOrderedMapDecorator<K, V> extends AbstractMapDecorator<K, V>
+        implements OrderedMap<K, V> {
 
     /**
      * Constructor only used in deserialization, do not use otherwise.
@@ -55,7 +53,7 @@ public abstract class AbstractOrderedMapDecorator
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if the collection is null
      */
-    public AbstractOrderedMapDecorator(OrderedMap map) {
+    public AbstractOrderedMapDecorator(OrderedMap<K, V> map) {
         super(map);
     }
 
@@ -64,33 +62,29 @@ public abstract class AbstractOrderedMapDecorator
      * 
      * @return the decorated map
      */
-    protected OrderedMap decorated() {
-        return (OrderedMap) super.decorated();
+    protected OrderedMap<K, V> decorated() {
+        return (OrderedMap<K, V>) super.decorated();
     }
 
     //-----------------------------------------------------------------------
-    public Object firstKey() {
+    public K firstKey() {
         return decorated().firstKey();
     }
 
-    public Object lastKey() {
+    public K lastKey() {
         return decorated().lastKey();
     }
 
-    public Object nextKey(Object key) {
+    public K nextKey(K key) {
         return decorated().nextKey(key);
     }
 
-    public Object previousKey(Object key) {
+    public K previousKey(K key) {
         return decorated().previousKey(key);
     }
 
-    public MapIterator mapIterator() {
+    public OrderedMapIterator<K, V> mapIterator() {
         return decorated().mapIterator();
     }
 
-    public OrderedMapIterator orderedMapIterator() {
-        return decorated().orderedMapIterator();
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/AbstractReferenceMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/AbstractReferenceMap.java b/src/java/org/apache/commons/collections/map/AbstractReferenceMap.java
index f5b31a2..60a0699 100644
--- a/src/java/org/apache/commons/collections/map/AbstractReferenceMap.java
+++ b/src/java/org/apache/commons/collections/map/AbstractReferenceMap.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.
@@ -72,38 +72,61 @@ import org.apache.commons.collections.keyvalue.DefaultMapEntry;
  * <code>ResettableIterator</code> and calling <code>reset()</code>.
  * <p>
  * This implementation is not synchronized.
- * You can use {@link java.util.Collections#synchronizedMap} to 
+ * You can use {@link java.util.Collections#synchronizedMap} to
  * provide synchronized access to a <code>ReferenceMap</code>.
  *
  * @see java.lang.ref.Reference
  * @since Commons Collections 3.1 (extracted from ReferenceMap in 3.0)
  * @version $Revision$ $Date$
- * 
+ *
  * @author Paul Jack
  * @author Stephen Colebourne
  */
-public abstract class AbstractReferenceMap extends AbstractHashedMap {
+public abstract class AbstractReferenceMap<K, V> extends AbstractHashedMap<K, V> {
+
+    /**
+     * Reference type enum.
+     */
+    public static enum ReferenceStrength {
+        HARD(0), SOFT(1), WEAK(2);
+
+        /** value */
+        public final int value;
 
-    /** Constant indicating that hard references should be used */
-    public static final int HARD = 0;
+        /**
+         * Resolve enum from int.
+         * @param value
+         * @return ReferenceType
+         * @throws IllegalArgumentException if the specified value is invalid.
+         */
+        public static ReferenceStrength resolve(int value) {
+            switch (value) {
+            case 0:
+                return HARD;
+            case 1:
+                return SOFT;
+            case 2:
+                return WEAK;
+            default:
+                throw new IllegalArgumentException();
+            }
+        }
 
-    /** Constant indicating that soft references should be used */
-    public static final int SOFT = 1;
+        private ReferenceStrength(int value) {
+            this.value = value;
+        }
 
-    /** Constant indicating that weak references should be used */
-    public static final int WEAK = 2;
+    }
 
     /**
-     * The reference type for keys.  Must be HARD, SOFT, WEAK.
-     * @serial
+     * The reference type for keys.
      */
-    protected int keyType;
+    protected ReferenceStrength keyType;
 
     /**
-     * The reference type for values.  Must be HARD, SOFT, WEAK.
-     * @serial
+     * The reference type for values.
      */
-    protected int valueType;
+    protected ReferenceStrength valueType;
 
     /**
      * Should the value be automatically purged when the associated key has been collected?
@@ -114,7 +137,7 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
      * ReferenceQueue used to eliminate stale mappings.
      * See purge.
      */
-    private transient ReferenceQueue queue;
+    private transient ReferenceQueue<Object> queue;
 
     //-----------------------------------------------------------------------
     /**
@@ -134,15 +157,13 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
      *   must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
      * @param capacity  the initial capacity for the map
      * @param loadFactor  the load factor for the map
-     * @param purgeValues  should the value be automatically purged when the 
-     *   key is garbage collected 
+     * @param purgeValues  should the value be automatically purged when the
+     *   key is garbage collected
      */
     protected AbstractReferenceMap(
-            int keyType, int valueType, int capacity, 
+            ReferenceStrength keyType, ReferenceStrength valueType, int capacity,
             float loadFactor, boolean purgeValues) {
         super(capacity, loadFactor);
-        verify("keyType", keyType);
-        verify("valueType", valueType);
         this.keyType = keyType;
         this.valueType = valueType;
         this.purgeValues = purgeValues;
@@ -152,27 +173,13 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
      * Initialise this subclass during construction, cloning or deserialization.
      */
     protected void init() {
-        queue = new ReferenceQueue();
-    }
-
-    //-----------------------------------------------------------------------
-    /**
-     * Checks the type int is a valid value.
-     * 
-     * @param name  the name for error messages
-     * @param type  the type value to check
-     * @throws IllegalArgumentException if the value if invalid
-     */
-    private static void verify(String name, int type) {
-        if ((type < HARD) || (type > WEAK)) {
-            throw new IllegalArgumentException(name + " must be HARD, SOFT, WEAK.");
-        }
+        queue = new ReferenceQueue<Object>();
     }
 
     //-----------------------------------------------------------------------
     /**
      * Gets the size of the map.
-     * 
+     *
      * @return the size
      */
     public int size() {
@@ -182,7 +189,7 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
 
     /**
      * Checks whether the map is currently empty.
-     * 
+     *
      * @return true if the map is currently size zero
      */
     public boolean isEmpty() {
@@ -192,13 +199,13 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
 
     /**
      * Checks whether the map contains the specified key.
-     * 
+     *
      * @param key  the key to search for
      * @return true if the map contains the key
      */
     public boolean containsKey(Object key) {
         purgeBeforeRead();
-        Entry entry = getEntry(key);
+        Entry<K, V> entry = getEntry(key);
         if (entry == null) {
             return false;
         }
@@ -207,7 +214,7 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
 
     /**
      * Checks whether the map contains the specified value.
-     * 
+     *
      * @param value  the value to search for
      * @return true if the map contains the value
      */
@@ -221,13 +228,13 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
 
     /**
      * Gets the value mapped to the key specified.
-     * 
+     *
      * @param key  the key
      * @return the mapped value, null if no match
      */
-    public Object get(Object key) {
+    public V get(Object key) {
         purgeBeforeRead();
-        Entry entry = getEntry(key);
+        Entry<K, V> entry = getEntry(key);
         if (entry == null) {
             return null;
         }
@@ -238,13 +245,13 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
     /**
      * Puts a key-value mapping into this map.
      * Neither the key nor the value may be null.
-     * 
+     *
      * @param key  the key to add, must not be null
      * @param value  the value to add, must not be null
      * @return the value previously mapped to this key, null if none
      * @throws NullPointerException if either the key or value is null
      */
-    public Object put(Object key, Object value) {
+    public V put(K key, V value) {
         if (key == null) {
             throw new NullPointerException("null keys not allowed");
         }
@@ -255,14 +262,14 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
         purgeBeforeWrite();
         return super.put(key, value);
     }
-    
+
     /**
      * Removes the specified mapping from this map.
-     * 
+     *
      * @param key  the mapping to remove
      * @return the value mapped to the removed key, null if key not in map
      */
-    public Object remove(Object key) {
+    public V remove(Object key) {
         if (key == null) {
             return null;
         }
@@ -282,11 +289,11 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
     /**
      * Gets a MapIterator over the reference map.
      * The iterator only returns valid key/value pairs.
-     * 
+     *
      * @return a map iterator
      */
-    public MapIterator mapIterator() {
-        return new ReferenceMapIterator(this);
+    public MapIterator<K, V> mapIterator() {
+        return new ReferenceMapIterator<K, V>(this);
     }
 
     /**
@@ -296,9 +303,9 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
      *
      * @return a set view of this map's entries
      */
-    public Set entrySet() {
+    public Set<Map.Entry<K, V>> entrySet() {
         if (entrySet == null) {
-            entrySet = new ReferenceEntrySet(this);
+            entrySet = new ReferenceEntrySet<K, V>(this);
         }
         return entrySet;
     }
@@ -308,9 +315,9 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
      *
      * @return a set view of this map's keys
      */
-    public Set keySet() {
+    public Set<K> keySet() {
         if (keySet == null) {
-            keySet = new ReferenceKeySet(this);
+            keySet = new ReferenceKeySet<K>(this);
         }
         return keySet;
     }
@@ -320,9 +327,9 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
      *
      * @return a set view of this map's values
      */
-    public Collection values() {
+    public Collection<V> values() {
         if (values == null) {
-            values = new ReferenceValues(this);
+            values = new ReferenceValues<V>(this);
         }
         return values;
     }
@@ -355,7 +362,7 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
      * background thread.
      */
     protected void purge() {
-        Reference ref = queue.poll();
+        Reference<?> ref = queue.poll();
         while (ref != null) {
             purge(ref);
             ref = queue.poll();
@@ -364,19 +371,19 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
 
     /**
      * Purges the specified reference.
-     * 
+     *
      * @param ref  the reference to purge
      */
-    protected void purge(Reference ref) {
+    protected void purge(Reference<?> ref) {
         // The hashCode of the reference is the hashCode of the
-        // mapping key, even if the reference refers to the 
+        // mapping key, even if the reference refers to the
         // mapping value...
         int hash = ref.hashCode();
         int index = hashIndex(hash, data.length);
-        HashEntry previous = null;
-        HashEntry entry = data[index];
+        HashEntry<K, V> previous = null;
+        HashEntry<K, V> entry = data[index];
         while (entry != null) {
-            if (((ReferenceEntry) entry).purge(ref)) {
+            if (((ReferenceEntry<K, V>) entry).purge(ref)) {
                 if (previous == null) {
                     data[index] = entry.next;
                 } else {
@@ -394,93 +401,93 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
     //-----------------------------------------------------------------------
     /**
      * Gets the entry mapped to the key specified.
-     * 
+     *
      * @param key  the key
      * @return the entry, null if no match
      */
-    protected HashEntry getEntry(Object key) {
+    protected HashEntry<K, V> getEntry(Object key) {
         if (key == null) {
             return null;
-        } else {
-            return super.getEntry(key);
         }
+        return super.getEntry(key);
     }
 
     /**
      * Gets the hash code for a MapEntry.
      * Subclasses can override this, for example to use the identityHashCode.
-     * 
+     *
      * @param key  the key to get a hash code for, may be null
      * @param value  the value to get a hash code for, may be null
      * @return the hash code, as per the MapEntry specification
      */
     protected int hashEntry(Object key, Object value) {
         return (key == null ? 0 : key.hashCode()) ^
-               (value == null ? 0 : value.hashCode()); 
+               (value == null ? 0 : value.hashCode());
     }
-    
+
     /**
      * Compares two keys, in internal converted form, to see if they are equal.
      * <p>
      * This implementation converts the key from the entry to a real reference
      * before comparison.
-     * 
+     *
      * @param key1  the first key to compare passed in from outside
      * @param key2  the second key extracted from the entry via <code>entry.key</code>
      * @return true if equal
      */
+    @SuppressWarnings("unchecked")
     protected boolean isEqualKey(Object key1, Object key2) {
-        key2 = (keyType > HARD ? ((Reference) key2).get() : key2);
+        key2 = (keyType == ReferenceStrength.HARD ? key2 : ((Reference<K>) key2).get());
         return (key1 == key2 || key1.equals(key2));
     }
-    
+
     /**
      * Creates a ReferenceEntry instead of a HashEntry.
-     * 
+     *
      * @param next  the next entry in sequence
      * @param hashCode  the hash code to use
      * @param key  the key to store
      * @param value  the value to store
      * @return the newly created entry
      */
-    protected HashEntry createEntry(HashEntry next, int hashCode, Object key, Object value) {
-        return new ReferenceEntry(this, next, hashCode, key, value);
+    protected ReferenceEntry<K, V> createEntry(HashEntry<K, V> next, int hashCode, K key, V value) {
+        return new ReferenceEntry<K, V>(this, next, hashCode, key, value);
     }
 
     /**
      * Creates an entry set iterator.
-     * 
+     *
      * @return the entrySet iterator
      */
-    protected Iterator createEntrySetIterator() {
-        return new ReferenceEntrySetIterator(this);
+    protected Iterator<Map.Entry<K, V>> createEntrySetIterator() {
+        return new ReferenceEntrySetIterator<K, V>(this);
     }
 
     /**
      * Creates an key set iterator.
-     * 
+     *
      * @return the keySet iterator
      */
-    protected Iterator createKeySetIterator() {
-        return new ReferenceKeySetIterator(this);
+    protected Iterator<K> createKeySetIterator() {
+        return new ReferenceKeySetIterator<K>(this);
     }
 
     /**
      * Creates an values iterator.
-     * 
+     *
      * @return the values iterator
      */
-    protected Iterator createValuesIterator() {
-        return new ReferenceValuesIterator(this);
+    protected Iterator<V> createValuesIterator() {
+        return new ReferenceValuesIterator<V>(this);
     }
 
     //-----------------------------------------------------------------------
     /**
      * EntrySet implementation.
      */
-    static class ReferenceEntrySet extends EntrySet {
-        
-        protected ReferenceEntrySet(AbstractHashedMap parent) {
+    static class ReferenceEntrySet<K, V> extends EntrySet<K, V> {
+
+        protected ReferenceEntrySet(AbstractHashedMap<K, V> parent) {
             super(parent);
         }
 
@@ -488,13 +495,11 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
             return toArray(new Object[0]);
         }
 
-        public Object[] toArray(Object[] arr) {
+        public <T> T[] toArray(T[] arr) {
             // special implementation to handle disappearing entries
-            ArrayList list = new ArrayList();
-            Iterator iterator = iterator();
-            while (iterator.hasNext()) {
-                Entry e = (Entry) iterator.next();
-                list.add(new DefaultMapEntry(e.getKey(), e.getValue()));
+            ArrayList<Map.Entry<K, V>> list = new ArrayList<Map.Entry<K, V>>();
+            for (Map.Entry<K, V> entry : this) {
+                list.add(new DefaultMapEntry<K, V>(entry));
             }
             return list.toArray(arr);
         }
@@ -504,9 +509,9 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
     /**
      * KeySet implementation.
      */
-    static class ReferenceKeySet extends KeySet {
-        
-        protected ReferenceKeySet(AbstractHashedMap parent) {
+    static class ReferenceKeySet<K> extends KeySet<K> {
+
+        protected ReferenceKeySet(AbstractHashedMap<K, ?> parent) {
             super(parent);
         }
 
@@ -514,11 +519,11 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
             return toArray(new Object[0]);
         }
 
-        public Object[] toArray(Object[] arr) {
+        public <T> T[] toArray(T[] arr) {
             // special implementation to handle disappearing keys
-            List list = new ArrayList(parent.size());
-            for (Iterator it = iterator(); it.hasNext(); ) {
-                list.add(it.next());
+            List<K> list = new ArrayList<K>(parent.size());
+            for (K key : this) {
+                list.add(key);
             }
             return list.toArray(arr);
         }
@@ -528,9 +533,9 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
     /**
      * Values implementation.
      */
-    static class ReferenceValues extends Values {
-        
-        protected ReferenceValues(AbstractHashedMap parent) {
+    static class ReferenceValues<V> extends Values<V> {
+
+        protected ReferenceValues(AbstractHashedMap<?, V> parent) {
             super(parent);
         }
 
@@ -538,11 +543,11 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
             return toArray(new Object[0]);
         }
 
-        public Object[] toArray(Object[] arr) {
+        public <T> T[] toArray(T[] arr) {
             // special implementation to handle disappearing values
-            List list = new ArrayList(parent.size());
-            for (Iterator it = iterator(); it.hasNext(); ) {
-                list.add(it.next());
+            List<V> list = new ArrayList<V>(parent.size());
+            for (V value : this) {
+                list.add(value);
             }
             return list.toArray(arr);
         }
@@ -554,23 +559,23 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
      * <p>
      * If getKey() or getValue() returns null, it means
      * the mapping is stale and should be removed.
-     * 
+     *
      * @since Commons Collections 3.1
      */
-    protected static class ReferenceEntry extends HashEntry {
+    protected static class ReferenceEntry<K, V> extends HashEntry<K, V> {
         /** The parent map */
-        protected final AbstractReferenceMap parent;
+        protected final AbstractReferenceMap<K, V> parent;
 
         /**
          * Creates a new entry object for the ReferenceMap.
-         * 
+         *
          * @param parent  the parent map
          * @param next  the next entry in the hash bucket
          * @param hashCode  the hash code of the key
          * @param key  the key
          * @param value  the value
          */
-        public ReferenceEntry(AbstractReferenceMap parent, HashEntry next, int hashCode, Object key, Object value) {
+        public ReferenceEntry(AbstractReferenceMap<K, V> parent, HashEntry<K, V> next, int hashCode, K key, V value) {
             super(next, hashCode, null, null);
             this.parent = parent;
             this.key = toReference(parent.keyType, key, hashCode);
@@ -580,33 +585,36 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
         /**
          * Gets the key from the entry.
          * This method dereferences weak and soft keys and thus may return null.
-         * 
+         *
          * @return the key, which may be null if it was garbage collected
          */
-        public Object getKey() {
-            return (parent.keyType > HARD) ? ((Reference) key).get() : key;
+        @SuppressWarnings("unchecked")
+        public K getKey() {
+            return (K) ((parent.keyType == ReferenceStrength.HARD) ? key : ((Reference<K>) key).get());
         }
 
         /**
          * Gets the value from the entry.
          * This method dereferences weak and soft value and thus may return null.
-         * 
+         *
          * @return the value, which may be null if it was garbage collected
          */
-        public Object getValue() {
-            return (parent.valueType > HARD) ? ((Reference) value).get() : value;
+        @SuppressWarnings("unchecked")
+        public V getValue() {
+            return (V) ((parent.valueType == ReferenceStrength.HARD) ? value : ((Reference<V>) value).get());
         }
 
         /**
          * Sets the value of the entry.
-         * 
+         *
          * @param obj  the object to store
          * @return the previous value
          */
-        public Object setValue(Object obj) {
-            Object old = getValue();
-            if (parent.valueType > HARD) {
-                ((Reference)value).clear();
+        @SuppressWarnings("unchecked")
+        public V setValue(V obj) {
+            V old = getValue();
+            if (parent.valueType != ReferenceStrength.HARD) {
+                ((Reference<V>) value).clear();
             }
             value = toReference(parent.valueType, obj, hashCode);
             return old;
@@ -617,10 +625,11 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
          * <p>
          * This implementation uses <code>isEqualKey</code> and
          * <code>isEqualValue</code> on the main map for comparison.
-         * 
+         *
          * @param obj  the other map entry to compare to
          * @return true if equal, false if not
          */
+        @SuppressWarnings("unchecked")
         public boolean equals(Object obj) {
             if (obj == this) {
                 return true;
@@ -628,7 +637,7 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
             if (obj instanceof Map.Entry == false) {
                 return false;
             }
-            
+
             Map.Entry entry = (Map.Entry)obj;
             Object entryKey = entry.getKey();  // convert to hard reference
             Object entryValue = entry.getValue();  // convert to hard reference
@@ -645,7 +654,7 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
          * Gets the hashcode of the entry using temporary hard references.
          * <p>
          * This implementation uses <code>hashEntry</code> on the main map.
-         * 
+         *
          * @return the hashcode of the entry
          */
         public int hashCode() {
@@ -662,13 +671,17 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
          *    this number might be different from referent.hashCode() if
          *    the referent represents a value and not a key
          */
-        protected Object toReference(int type, Object referent, int hash) {
-            switch (type) {
-                case HARD: return referent;
-                case SOFT: return new SoftRef(hash, referent, parent.queue);
-                case WEAK: return new WeakRef(hash, referent, parent.queue);
-                default: throw new Error();
+        protected <T> Object toReference(ReferenceStrength type, T referent, int hash) {
+            if (type == ReferenceStrength.HARD) {
+                return referent;
             }
+            if (type == ReferenceStrength.SOFT) {
+                return new SoftRef<T>(hash, referent, parent.queue);
+            }
+            if (type == ReferenceStrength.WEAK) {
+                return new WeakRef<T>(hash, referent, parent.queue);
+            }
+            throw new Error();
         }
 
         /**
@@ -676,15 +689,15 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
          * @param ref  the reference to purge
          * @return true or false
          */
-        boolean purge(Reference ref) {
-            boolean r = (parent.keyType > HARD) && (key == ref);
-            r = r || ((parent.valueType > HARD) && (value == ref));
+        boolean purge(Reference<?> ref) {
+            boolean r = (parent.keyType != ReferenceStrength.HARD) && (key == ref);
+            r = r || ((parent.valueType != ReferenceStrength.HARD) && (value == ref));
             if (r) {
-                if (parent.keyType > HARD) {
-                    ((Reference)key).clear();
+                if (parent.keyType != ReferenceStrength.HARD) {
+                    ((Reference<?>) key).clear();
                 }
-                if (parent.valueType > HARD) {
-                    ((Reference)value).clear();
+                if (parent.valueType != ReferenceStrength.HARD) {
+                    ((Reference<?>) value).clear();
                 } else if (parent.purgeValues) {
                     value = null;
                 }
@@ -694,36 +707,36 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
 
         /**
          * Gets the next entry in the bucket.
-         * 
+         *
          * @return the next entry in the bucket
          */
-        protected ReferenceEntry next() {
-            return (ReferenceEntry) next;
+        protected ReferenceEntry<K, V> next() {
+            return (ReferenceEntry<K, V>) next;
         }
     }
 
     //-----------------------------------------------------------------------
     /**
-     * The EntrySet iterator.
+     * Base iterator class.
      */
-    static class ReferenceEntrySetIterator implements Iterator {
+    static class ReferenceBaseIterator<K, V> {
         /** The parent map */
-        final AbstractReferenceMap parent;
-        
+        final AbstractReferenceMap<K, V> parent;
+
         // These fields keep track of where we are in the table.
         int index;
-        ReferenceEntry entry;
-        ReferenceEntry previous;
+        ReferenceEntry<K, V> entry;
+        ReferenceEntry<K, V> previous;
 
         // These Object fields provide hard references to the
         // current and next entry; this assures that if hasNext()
         // returns true, next() will actually return a valid element.
-        Object nextKey, nextValue;
-        Object currentKey, currentValue;
+        K currentKey, nextKey;
+        V currentValue, nextValue;
 
         int expectedModCount;
 
-        public ReferenceEntrySetIterator(AbstractReferenceMap parent) {
+        public ReferenceBaseIterator(AbstractReferenceMap<K, V> parent) {
             super();
             this.parent = parent;
             index = (parent.size() != 0 ? parent.data.length : 0);
@@ -735,11 +748,11 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
         public boolean hasNext() {
             checkMod();
             while (nextNull()) {
-                ReferenceEntry e = entry;
+                ReferenceEntry<K, V> e = entry;
                 int i = index;
                 while ((e == null) && (i > 0)) {
                     i--;
-                    e = (ReferenceEntry) parent.data[i];
+                    e = (ReferenceEntry<K, V>) parent.data[i];
                 }
                 entry = e;
                 index = i;
@@ -767,7 +780,7 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
             return (nextKey == null) || (nextValue == null);
         }
 
-        protected ReferenceEntry nextEntry() {    
+        protected ReferenceEntry<K, V> nextEntry() {
             checkMod();
             if (nextNull() && !hasNext()) {
                 throw new NoSuchElementException();
@@ -781,14 +794,10 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
             return previous;
         }
 
-        protected ReferenceEntry currentEntry() {
+        protected ReferenceEntry<K, V> currentEntry() {
             checkMod();
             return previous;
         }
-        
-        public Object next() {
-            return nextEntry();
-        }
 
         public void remove() {
             checkMod();
@@ -804,15 +813,31 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
     }
 
     /**
-     * The keySet iterator.
+     * The EntrySet iterator.
      */
-    static class ReferenceKeySetIterator extends ReferenceEntrySetIterator {
-        
-        ReferenceKeySetIterator(AbstractReferenceMap parent) {
+    static class ReferenceEntrySetIterator<K, V> extends ReferenceBaseIterator<K, V> implements Iterator<Map.Entry<K, V>> {
+
+        public ReferenceEntrySetIterator(AbstractReferenceMap<K, V> parent) {
             super(parent);
         }
-        
-        public Object next() {
+
+        public Map.Entry<K, V> next() {
+            return nextEntry();
+        }
+
+    }
+
+    /**
+     * The keySet iterator.
+     */
+    static class ReferenceKeySetIterator<K> extends ReferenceBaseIterator<K, Object> implements Iterator<K> {
+
+        @SuppressWarnings("unchecked")
+        ReferenceKeySetIterator(AbstractReferenceMap<K, ?> parent) {
+            super((AbstractReferenceMap<K, Object>) parent);
+        }
+
+        public K next() {
             return nextEntry().getKey();
         }
     }
@@ -820,13 +845,14 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
     /**
      * The values iterator.
      */
-    static class ReferenceValuesIterator extends ReferenceEntrySetIterator {
-        
-        ReferenceValuesIterator(AbstractReferenceMap parent) {
-            super(parent);
+    static class ReferenceValuesIterator<V> extends ReferenceBaseIterator<Object, V> implements Iterator<V> {
+
+        @SuppressWarnings("unchecked")
+        ReferenceValuesIterator(AbstractReferenceMap<?, V> parent) {
+            super((AbstractReferenceMap<Object, V>) parent);
         }
-        
-        public Object next() {
+
+        public V next() {
             return nextEntry().getValue();
         }
     }
@@ -834,41 +860,41 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
     /**
      * The MapIterator implementation.
      */
-    static class ReferenceMapIterator extends ReferenceEntrySetIterator implements MapIterator {
-        
-        protected ReferenceMapIterator(AbstractReferenceMap parent) {
+    static class ReferenceMapIterator<K, V> extends ReferenceBaseIterator<K, V> implements MapIterator<K, V> {
+
+        protected ReferenceMapIterator(AbstractReferenceMap<K, V> parent) {
             super(parent);
         }
 
-        public Object next() {
+        public K next() {
             return nextEntry().getKey();
         }
 
-        public Object getKey() {
-            HashEntry current = currentEntry();
+        public K getKey() {
+            HashEntry<K, V> current = currentEntry();
             if (current == null) {
                 throw new IllegalStateException(AbstractHashedMap.GETKEY_INVALID);
             }
             return current.getKey();
         }
 
-        public Object getValue() {
-            HashEntry current = currentEntry();
+        public V getValue() {
+            HashEntry<K, V> current = currentEntry();
             if (current == null) {
                 throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID);
             }
             return current.getValue();
         }
 
-        public Object setValue(Object value) {
-            HashEntry current = currentEntry();
+        public V setValue(V value) {
+            HashEntry<K, V> current = currentEntry();
             if (current == null) {
                 throw new IllegalStateException(AbstractHashedMap.SETVALUE_INVALID);
             }
             return current.setValue(value);
         }
     }
-    
+
     //-----------------------------------------------------------------------
     // These two classes store the hashCode of the key of
     // of the mapping, so that after they're dequeued a quick
@@ -877,11 +903,11 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
     /**
      * A soft reference holder.
      */
-    static class SoftRef extends SoftReference {
+    static class SoftRef<T> extends SoftReference<T> {
         /** the hashCode of the key (even if the reference points to a value) */
         private int hash;
 
-        public SoftRef(int hash, Object r, ReferenceQueue q) {
+        public SoftRef(int hash, T r, ReferenceQueue<? super T> q) {
             super(r, q);
             this.hash = hash;
         }
@@ -894,11 +920,11 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
     /**
      * A weak reference holder.
      */
-    static class WeakRef extends WeakReference {
+    static class WeakRef<T> extends WeakReference<T> {
         /** the hashCode of the key (even if the reference points to a value) */
         private int hash;
 
-        public WeakRef(int hash, Object r, ReferenceQueue q) {
+        public WeakRef(int hash, T r, ReferenceQueue<? super T> q) {
             super(r, q);
             this.hash = hash;
         }
@@ -924,16 +950,16 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
      * Subclasses may override if they have a specific field that must be present
      * on read before this implementation will work. Generally, the read determines
      * what must be serialized here, if anything.
-     * 
+     *
      * @param out  the output stream
      */
     protected void doWriteObject(ObjectOutputStream out) throws IOException {
-        out.writeInt(keyType);
-        out.writeInt(valueType);
+        out.writeInt(keyType.value);
+        out.writeInt(valueType.value);
         out.writeBoolean(purgeValues);
         out.writeFloat(loadFactor);
         out.writeInt(data.length);
-        for (MapIterator it = mapIterator(); it.hasNext();) {
+        for (MapIterator<K, V> it = mapIterator(); it.hasNext();) {
             out.writeObject(it.next());
             out.writeObject(it.getValue());
         }
@@ -955,23 +981,24 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap {
      * <p>
      * Subclasses may override if the subclass has a specific field that must be present
      * before <code>put()</code> or <code>calculateThreshold()</code> will work correctly.
-     * 
+     *
      * @param in  the input stream
      */
+    @SuppressWarnings("unchecked")
     protected void doReadObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
-        this.keyType = in.readInt();
-        this.valueType = in.readInt();
+        this.keyType = ReferenceStrength.resolve(in.readInt());
+        this.valueType = ReferenceStrength.resolve(in.readInt());
         this.purgeValues = in.readBoolean();
         this.loadFactor = in.readFloat();
         int capacity = in.readInt();
         init();
         data = new HashEntry[capacity];
         while (true) {
-            Object key = in.readObject();
+            K key = (K) in.readObject();
             if (key == null) {
                 break;
             }
-            Object value = in.readObject();
+            V value = (V) in.readObject();
             put(key, value);
         }
         threshold = calculateThreshold(data.length, loadFactor);

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java b/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java
index eae1600..7c9a35b 100644
--- a/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java
+++ b/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java
@@ -38,9 +38,8 @@ import java.util.SortedMap;
  * 
  * @author Stephen Colebourne
  */
-public abstract class AbstractSortedMapDecorator<K, V>
-        extends AbstractMapDecorator<K, V>
-        implements SortedMap<K, V> {
+public abstract class AbstractSortedMapDecorator<K, V> extends AbstractMapDecorator<K, V> implements
+        SortedMap<K, V> {
 
     /**
      * Constructor only used in deserialization, do not use otherwise.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java b/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java
index 7d5a18c..05f4206 100644
--- a/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java
+++ b/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java
@@ -57,7 +57,7 @@ import java.util.Map;
  *
  * @author Commons-Collections team
  */
-public class CaseInsensitiveMap extends AbstractHashedMap implements Serializable, Cloneable {
+public class CaseInsensitiveMap<K, V> extends AbstractHashedMap<K, V> implements Serializable, Cloneable {
 
     /** Serialisation version */
     private static final long serialVersionUID = -7074655917369299456L;
@@ -102,7 +102,7 @@ public class CaseInsensitiveMap extends AbstractHashedMap implements Serializabl
      * @param map  the map to copy
      * @throws NullPointerException if the map is null
      */
-    public CaseInsensitiveMap(Map map) {
+    public CaseInsensitiveMap(Map<K, V> map) {
         super(map);
     }
 
@@ -119,9 +119,8 @@ public class CaseInsensitiveMap extends AbstractHashedMap implements Serializabl
     protected Object convertKey(Object key) {
         if (key != null) {
             return key.toString().toLowerCase();
-        } else {
-            return AbstractHashedMap.NULL;
         }
+        return AbstractHashedMap.NULL;
     }   
 
     //-----------------------------------------------------------------------
@@ -130,8 +129,8 @@ public class CaseInsensitiveMap extends AbstractHashedMap implements Serializabl
      *
      * @return a shallow clone
      */
-    public Object clone() {
-        return super.clone();
+    public CaseInsensitiveMap<K, V> clone() {
+        return (CaseInsensitiveMap<K, V>) super.clone();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/CompositeMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/CompositeMap.java b/src/java/org/apache/commons/collections/map/CompositeMap.java
index b806c62..264d7ec 100644
--- a/src/java/org/apache/commons/collections/map/CompositeMap.java
+++ b/src/java/org/apache/commons/collections/map/CompositeMap.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.
@@ -17,7 +17,6 @@
 package org.apache.commons.collections.map;
 
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -35,7 +34,7 @@ import org.apache.commons.collections.set.CompositeSet;
  * <strong>Note that CompositeMap is not synchronized and is not thread-safe.</strong>
  * If you wish to use this map from multiple threads concurrently, you must use
  * appropriate synchronization. The simplest approach is to wrap this map
- * using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw 
+ * using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw
  * exceptions when accessed by concurrent threads without synchronization.
  *
  * @since Commons Collections 3.0
@@ -43,62 +42,66 @@ import org.apache.commons.collections.set.CompositeSet;
  *
  * @author Brian McCallister
  */
-public class CompositeMap implements Map {
+public class CompositeMap<K, V> implements Map<K, V> {
 
     /** Array of all maps in the composite */
-    private Map[] composite;
+    private Map<K, V>[] composite;
 
     /** Handle mutation operations */
-    private MapMutator mutator;
+    private MapMutator<K, V> mutator;
 
     /**
      * Create a new, empty, CompositeMap.
      */
+    @SuppressWarnings("unchecked")
     public CompositeMap() {
-        this(new Map[]{}, null);
+        this(new Map[] {}, null);
     }
 
     /**
      * Create a new CompositeMap with two composited Map instances.
-     * 
+     *
      * @param one  the first Map to be composited
      * @param two  the second Map to be composited
      * @throws IllegalArgumentException if there is a key collision
      */
-    public CompositeMap(Map one, Map two) {
-        this(new Map[]{one, two}, null);
+    @SuppressWarnings("unchecked")
+    public CompositeMap(Map<K, V> one, Map<K, V> two) {
+        this(new Map[] { one, two }, null);
     }
 
     /**
      * Create a new CompositeMap with two composited Map instances.
-     * 
+     *
      * @param one  the first Map to be composited
      * @param two  the second Map to be composited
      * @param mutator  MapMutator to be used for mutation operations
      */
-    public CompositeMap(Map one, Map two, MapMutator mutator) {
-        this(new Map[]{one, two}, mutator);
+    @SuppressWarnings("unchecked")
+    public CompositeMap(Map<K, V> one, Map<K, V> two, MapMutator<K, V> mutator) {
+        this(new Map[] { one, two }, mutator);
     }
 
     /**
      * Create a new CompositeMap which composites all of the Map instances in the
      * argument. It copies the argument array, it does not use it directly.
-     * 
+     *
      * @param composite  the Maps to be composited
      * @throws IllegalArgumentException if there is a key collision
      */
-    public CompositeMap(Map[] composite) {
+    public CompositeMap(Map<K, V>[] composite) {
         this(composite, null);
     }
 
     /**
      * Create a new CompositeMap which composites all of the Map instances in the
      * argument. It copies the argument array, it does not use it directly.
-     * 
+     *
      * @param composite  Maps to be composited
      * @param mutator  MapMutator to be used for mutation operations
      */
-    public CompositeMap(Map[] composite, MapMutator mutator) {
+    @SuppressWarnings("unchecked")
+    public CompositeMap(Map<K, V>[] composite, MapMutator<K, V> mutator) {
         this.mutator = mutator;
         this.composite = new Map[0];
         for (int i = composite.length - 1; i >= 0; --i) {
@@ -109,13 +112,13 @@ public class CompositeMap implements Map {
     //-----------------------------------------------------------------------
     /**
      * Specify the MapMutator to be used by mutation operations.
-     * 
+     *
      * @param mutator  the MapMutator to be used for mutation delegation
      */
-    public void setMutator(MapMutator mutator) {
+    public void setMutator(MapMutator<K, V> mutator) {
         this.mutator = mutator;
     }
-    
+
     /**
      * Add an additional Map to the composite.
      *
@@ -123,35 +126,35 @@ public class CompositeMap implements Map {
      * @throws IllegalArgumentException if there is a key collision and there is no
      *         MapMutator set to handle it.
      */
-    public synchronized void addComposited(Map map) throws IllegalArgumentException {
+    @SuppressWarnings("unchecked")
+    public synchronized void addComposited(Map<K, V> map) throws IllegalArgumentException {
         for (int i = composite.length - 1; i >= 0; --i) {
-            Collection intersect = CollectionUtils.intersection(this.composite[i].keySet(), map.keySet());
+            Collection<K> intersect = CollectionUtils.intersection(this.composite[i].keySet(), map.keySet());
             if (intersect.size() != 0) {
                 if (this.mutator == null) {
                     throw new IllegalArgumentException("Key collision adding Map to CompositeMap");
                 }
-                else {
-                    this.mutator.resolveCollision(this, this.composite[i], map, intersect);
-                }
+                this.mutator.resolveCollision(this, this.composite[i], map, intersect);
             }
         }
-        Map[] temp = new Map[this.composite.length + 1];
+        Map<K, V>[] temp = new Map[this.composite.length + 1];
         System.arraycopy(this.composite, 0, temp, 0, this.composite.length);
         temp[temp.length - 1] = map;
         this.composite = temp;
     }
-    
+
     /**
      * Remove a Map from the composite.
      *
      * @param map  the Map to be removed from the composite
      * @return The removed Map or <code>null</code> if map is not in the composite
      */
-    public synchronized Map removeComposited(Map map) {
+    @SuppressWarnings("unchecked")
+    public synchronized Map<K, V> removeComposited(Map<K, V> map) {
         int size = this.composite.length;
         for (int i = 0; i < size; ++i) {
             if (this.composite[i].equals(map)) {
-                Map[] temp = new Map[size - 1];
+                Map<K, V>[] temp = new Map[size - 1];
                 System.arraycopy(this.composite, 0, temp, 0, i);
                 System.arraycopy(this.composite, i + 1, temp, i, size - i - 1);
                 this.composite = temp;
@@ -161,7 +164,7 @@ public class CompositeMap implements Map {
         return null;
     }
 
-    //-----------------------------------------------------------------------    
+    //-----------------------------------------------------------------------
     /**
      * Calls <code>clear()</code> on all composited Maps.
      *
@@ -172,7 +175,7 @@ public class CompositeMap implements Map {
             this.composite[i].clear();
         }
     }
-    
+
     /**
      * Returns <tt>true</tt> if this map contains a mapping for the specified
      * key.  More formally, returns <tt>true</tt> if and only if
@@ -197,7 +200,7 @@ public class CompositeMap implements Map {
         }
         return false;
     }
-    
+
     /**
      * Returns <tt>true</tt> if this map maps one or more keys to the
      * specified value.  More formally, returns <tt>true</tt> if and only if
@@ -222,7 +225,7 @@ public class CompositeMap implements Map {
         }
         return false;
     }
-    
+
     /**
      * Returns a set view of the mappings contained in this map.  Each element
      * in the returned set is a <code>Map.Entry</code>.  The set is backed by the
@@ -240,14 +243,14 @@ public class CompositeMap implements Map {
      * @see CompositeSet
      * @return a set view of the mappings contained in this map.
      */
-    public Set entrySet() {
-        CompositeSet entries = new CompositeSet();
-        for (int i = this.composite.length - 1; i >= 0; --i) {
-            entries.addComposited(this.composite[i].entrySet());
+    public Set<Map.Entry<K, V>> entrySet() {
+        CompositeSet<Map.Entry<K, V>> entries = new CompositeSet<Map.Entry<K,V>>();
+        for (int i = composite.length - 1; i >= 0; --i) {
+            entries.addComposited((Collection<Map.Entry<K, V>>) composite[i].entrySet());
         }
         return entries;
     }
-    
+
     /**
      * Returns the value to which this map maps the specified key.  Returns
      * <tt>null</tt> if the map contains no mapping for this key.  A return
@@ -272,7 +275,7 @@ public class CompositeMap implements Map {
      *
      * @see #containsKey(Object)
      */
-    public Object get(Object key) {
+    public V get(Object key) {
         for (int i = this.composite.length - 1; i >= 0; --i) {
             if (this.composite[i].containsKey(key)) {
                 return this.composite[i].get(key);
@@ -280,7 +283,7 @@ public class CompositeMap implements Map {
         }
         return null;
     }
-    
+
     /**
      * Returns <tt>true</tt> if this map contains no key-value mappings.
      *
@@ -294,7 +297,7 @@ public class CompositeMap implements Map {
         }
         return true;
     }
-    
+
     /**
      * Returns a set view of the keys contained in this map.  The set is
      * backed by the map, so changes to the map are reflected in the set, and
@@ -310,14 +313,14 @@ public class CompositeMap implements Map {
      *
      * @return a set view of the keys contained in this map.
      */
-    public Set keySet() {
-        CompositeSet keys = new CompositeSet();
+    public Set<K> keySet() {
+        CompositeSet<K> keys = new CompositeSet<K>();
         for (int i = this.composite.length - 1; i >= 0; --i) {
             keys.addComposited(this.composite[i].keySet());
         }
         return keys;
     }
-    
+
     /**
      * Associates the specified value with the specified key in this map
      * (optional operation).  If the map previously contained a mapping for
@@ -343,13 +346,13 @@ public class CompositeMap implements Map {
      *            keys or values, and the specified key or value is
      *            <tt>null</tt>.
      */
-    public Object put(Object key, Object value) {
+    public V put(K key, V value) {
         if (this.mutator == null) {
             throw new UnsupportedOperationException("No mutator specified");
         }
         return this.mutator.put(this, this.composite, key, value);
     }
-    
+
     /**
      * Copies all of the mappings from the specified map to this map
      * (optional operation).  The effect of this call is equivalent to that
@@ -372,13 +375,13 @@ public class CompositeMap implements Map {
      *         this map does not permit <tt>null</tt> keys or values, and the
      *         specified map contains <tt>null</tt> keys or values.
      */
-    public void putAll(Map map) {
+    public void putAll(Map<? extends K, ? extends V> map) {
         if (this.mutator == null) {
             throw new UnsupportedOperationException("No mutator specified");
         }
         this.mutator.putAll(this, this.composite, map);
     }
-    
+
     /**
      * Removes the mapping for this key from this map if it is present
      * (optional operation).   More formally, if this map contains a mapping
@@ -404,7 +407,7 @@ public class CompositeMap implements Map {
      * @throws UnsupportedOperationException if the <tt>remove</tt> method is
      *         not supported by the composited map containing the key
      */
-    public Object remove(Object key) {
+    public V remove(Object key) {
         for (int i = this.composite.length - 1; i >= 0; --i) {
             if (this.composite[i].containsKey(key)) {
                 return this.composite[i].remove(key);
@@ -412,7 +415,7 @@ public class CompositeMap implements Map {
         }
         return null;
     }
-    
+
     /**
      * Returns the number of key-value mappings in this map.  If the
      * map contains more than <tt>Integer.MAX_VALUE</tt> elements, returns
@@ -427,7 +430,7 @@ public class CompositeMap implements Map {
         }
         return size;
     }
-    
+
     /**
      * Returns a collection view of the values contained in this map.  The
      * collection is backed by the map, so changes to the map are reflected in
@@ -441,20 +444,21 @@ public class CompositeMap implements Map {
      *
      * @return a collection view of the values contained in this map.
      */
-    public Collection values() {
-        CompositeCollection keys = new CompositeCollection();
-        for (int i = this.composite.length - 1; i >= 0; --i) {
-            keys.addComposited(this.composite[i].values());
+    public Collection<V> values() {
+        CompositeCollection<V> values = new CompositeCollection<V>();
+        for (int i = composite.length - 1; i >= 0; --i) {
+            values.addComposited((Collection<V>) composite[i].values());
         }
-        return keys;
+        return values;
     }
-    
+
     /**
      * Checks if this Map equals another as per the Map specification.
-     * 
+     *
      * @param obj  the object to compare to
      * @return true if the maps are equal
      */
+    @SuppressWarnings("unchecked")
     public boolean equals(Object obj) {
         if (obj instanceof Map) {
             Map map = (Map) obj;
@@ -462,24 +466,24 @@ public class CompositeMap implements Map {
         }
         return false;
     }
-    
+
     /**
      * Gets a hash code for the Map as per the Map specification.
      */
     public int hashCode() {
         int code = 0;
-        for (Iterator i = this.entrySet().iterator(); i.hasNext();) {
-            code += i.next().hashCode();
+        for (Map.Entry<K, V> entry : entrySet()) {
+            code += entry.hashCode();
         }
         return code;
     }
-    
+
     /**
      * This interface allows definition for all of the indeterminate
      * mutators in a CompositeMap, as well as providing a hook for
      * callbacks on key collisions.
      */
-    public static interface MapMutator {
+    public static interface MapMutator<K, V> {
         /**
          * Called when adding a new Composited Map results in a
          * key collision.
@@ -490,9 +494,9 @@ public class CompositeMap implements Map {
          * @param added  the Map being added
          * @param intersect  the intersection of the keysets of the existing and added maps
          */
-        public void resolveCollision(
-            CompositeMap composite, Map existing, Map added, Collection intersect);
-        
+        public void resolveCollision(CompositeMap<K, V> composite, Map<K, V> existing,
+                Map<K, V> added, Collection<K> intersect);
+
         /**
          * Called when the CompositeMap.put() method is invoked.
          *
@@ -515,8 +519,8 @@ public class CompositeMap implements Map {
          *            keys or values, and the specified key or value is
          *            <tt>null</tt>.
          */
-        public Object put(CompositeMap map, Map[] composited, Object key, Object value);
-        
+        public V put(CompositeMap<K, V> map, Map<K, V>[] composited, K key, V value);
+
         /**
          * Called when the CompositeMap.putAll() method is invoked.
          *
@@ -533,6 +537,7 @@ public class CompositeMap implements Map {
          *            keys or values, and the specified key or value is
          *            <tt>null</tt>.
          */
-        public void putAll(CompositeMap map, Map[] composited, Map mapToAdd);
+        public void putAll(CompositeMap<K, V> map, Map<K, V>[] composited,
+                Map<? extends K, ? extends V> mapToAdd);
     }
 }


[47/77] [abbrv] commons-collections git commit: generics

Posted by ch...@apache.org.
generics

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@751858 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/3d5f3fec
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/3d5f3fec
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/3d5f3fec

Branch: refs/heads/collections_jdk5_branch
Commit: 3d5f3fec054fdafb33f2eb2cc4f27109929e6508
Parents: 613d1ac
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Mon Mar 9 21:45:53 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Mon Mar 9 21:45:53 2009 +0000

----------------------------------------------------------------------
 .../org/apache/commons/collections/map/TestTransformedMap.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/3d5f3fec/src/test/org/apache/commons/collections/map/TestTransformedMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestTransformedMap.java b/src/test/org/apache/commons/collections/map/TestTransformedMap.java
index 517bce2..aec0e06 100644
--- a/src/test/org/apache/commons/collections/map/TestTransformedMap.java
+++ b/src/test/org/apache/commons/collections/map/TestTransformedMap.java
@@ -94,9 +94,9 @@ public class TestTransformedMap<K, V> extends AbstractTestIterableMap<K, V> {
 
         assertEquals(new Integer((String) els[0]), map.remove(els[0]));
 
-        Set entrySet = map.entrySet();
-        Map.Entry[] array = (Map.Entry[]) entrySet.toArray(new Map.Entry[0]);
-        array[0].setValue("66");
+        Set<Map.Entry<K, V>> entrySet = map.entrySet();
+        Map.Entry<K, V>[] array = entrySet.toArray(new Map.Entry[0]);
+        array[0].setValue((V) "66");
         assertEquals(new Integer(66), array[0].getValue());
         assertEquals(new Integer(66), map.get(array[0].getKey()));
 


[27/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/FunctorUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/FunctorUtils.java b/src/java/org/apache/commons/collections/functors/FunctorUtils.java
index d52ba01..3585558 100644
--- a/src/java/org/apache/commons/collections/functors/FunctorUtils.java
+++ b/src/java/org/apache/commons/collections/functors/FunctorUtils.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,7 +24,7 @@ import org.apache.commons.collections.Transformer;
 
 /**
  * Internal utilities for functors.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
@@ -32,38 +32,38 @@ import org.apache.commons.collections.Transformer;
  * @author Matt Benson
  */
 class FunctorUtils {
-    
+
     /**
      * Restricted constructor.
      */
     private FunctorUtils() {
         super();
     }
-    
+
     /**
      * Clone the predicates to ensure that the internal reference can't be messed with.
      * Due to the {@link Predicate#evaluate(T)} method, Predicate<? super T> is
-     * able to be coerced to Predicate<T> without casting issues. 
-     * 
+     * able to be coerced to Predicate<T> without casting issues.
+     *
      * @param predicates  the predicates to copy
      * @return the cloned predicates
      */
     @SuppressWarnings("unchecked")
-    static <T> Predicate<? super T>[] copy(Predicate<? super T>[] predicates) {
+    static <T> Predicate<T>[] copy(Predicate<? super T>[] predicates) {
         if (predicates == null) {
             return null;
         }
-        return predicates.clone();
+        return (Predicate<T>[]) predicates.clone();
     }
-    
+
     /**
      * A very simple method that coerces Predicate<? super T> to Predicate<T>.
      * Due to the {@link Predicate#evaluate(T)} method, Predicate<? super T> is
-     * able to be coerced to Predicate<T> without casting issues. 
+     * able to be coerced to Predicate<T> without casting issues.
      * <p>This method exists
      * simply as centralised documentation and atomic unchecked warning
      * suppression.
-     * 
+     *
      * @param <T> the type of object the returned predicate should "accept"
      * @param predicate the predicate to coerce.
      * @return the coerced predicate.
@@ -72,10 +72,10 @@ class FunctorUtils {
     static <T> Predicate<T> coerce(Predicate<? super T> predicate){
         return (Predicate<T>) predicate;
     }
-    
+
     /**
      * Validate the predicates to ensure that all is well.
-     * 
+     *
      * @param predicates  the predicates to validate
      */
     static void validate(Predicate<?>[] predicates) {
@@ -88,22 +88,22 @@ class FunctorUtils {
             }
         }
     }
-    
+
     /**
      * Validate the predicates to ensure that all is well.
-     * 
+     *
      * @param predicates  the predicates to validate
      * @return predicate array
      */
     @SuppressWarnings("unchecked")
-    static <T> Predicate<? super T>[] validate(Collection<Predicate<? super T>> predicates) {
+    static <T> Predicate<T>[] validate(Collection<? extends Predicate<T>> predicates) {
         if (predicates == null) {
             throw new IllegalArgumentException("The predicate collection must not be null");
         }
         // convert to array like this to guarantee iterator() ordering
-        Predicate<? super T>[] preds = new Predicate[predicates.size()];
+        Predicate<T>[] preds = new Predicate[predicates.size()];
         int i = 0;
-        for (Predicate<? super T> predicate : predicates) {
+        for (Predicate<T> predicate : predicates) {
             preds[i] = predicate;
             if (preds[i] == null) {
                 throw new IllegalArgumentException("The predicate collection must not contain a null predicate, index " + i + " was null");
@@ -112,26 +112,27 @@ class FunctorUtils {
         }
         return preds;
     }
-    
+
     /**
      * Clone the closures to ensure that the internal reference can't be messed with.
-     * 
+     *
      * @param closures  the closures to copy
      * @return the cloned closures
      */
-    static Closure[] copy(Closure[] closures) {
+    @SuppressWarnings("unchecked")
+    static <E> Closure<E>[] copy(Closure<? super E>[] closures) {
         if (closures == null) {
             return null;
         }
-        return (Closure[]) closures.clone();
+        return (Closure<E>[]) closures.clone();
     }
-    
+
     /**
      * Validate the closures to ensure that all is well.
-     * 
+     *
      * @param closures  the closures to validate
      */
-    static void validate(Closure[] closures) {
+    static void validate(Closure<?>[] closures) {
         if (closures == null) {
             throw new IllegalArgumentException("The closure array must not be null");
         }
@@ -143,24 +144,40 @@ class FunctorUtils {
     }
 
     /**
+     * A very simple method that coerces Closure<? super T> to Closure<T>.
+     * <p>This method exists
+     * simply as centralised documentation and atomic unchecked warning
+     * suppression.
+     *
+     * @param <T> the type of object the returned closure should "accept"
+     * @param closure the closure to coerce.
+     * @return the coerced closure.
+     */
+    @SuppressWarnings("unchecked")
+    static <T> Closure<T> coerce(Closure<? super T> closure){
+        return (Closure<T>) closure;
+    }
+
+    /**
      * Copy method
-     * 
+     *
      * @param transformers  the transformers to copy
      * @return a clone of the transformers
      */
-    static Transformer[] copy(Transformer[] transformers) {
+    @SuppressWarnings("unchecked")
+    static <I, O> Transformer<I, O>[] copy(Transformer<? super I, ? extends O>[] transformers) {
         if (transformers == null) {
             return null;
         }
-        return (Transformer[]) transformers.clone();
+        return (Transformer<I, O>[]) transformers.clone();
     }
-    
+
     /**
      * Validate method
-     * 
+     *
      * @param transformers  the transformers to validate
      */
-    static void validate(Transformer[] transformers) {
+    static void validate(Transformer<?, ?>[] transformers) {
         if (transformers == null) {
             throw new IllegalArgumentException("The transformer array must not be null");
         }
@@ -172,4 +189,19 @@ class FunctorUtils {
         }
     }
 
+    /**
+     * A very simple method that coerces Transformer<? super I, ? extends O> to Transformer<I, O>.
+     * <p>This method exists
+     * simply as centralised documentation and atomic unchecked warning
+     * suppression.
+     *
+     * @param <T> the type of object the returned transformer should "accept"
+     * @param transformer the transformer to coerce.
+     * @return the coerced transformer.
+     */
+    @SuppressWarnings("unchecked")
+    static <I, O> Transformer<I, O> coerce(Transformer<? super I, ? extends O> transformer) {
+        return (Transformer<I, O>) transformer;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/IdentityPredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/IdentityPredicate.java b/src/java/org/apache/commons/collections/functors/IdentityPredicate.java
index 5175a15..5768259 100644
--- a/src/java/org/apache/commons/collections/functors/IdentityPredicate.java
+++ b/src/java/org/apache/commons/collections/functors/IdentityPredicate.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,42 +23,41 @@ import org.apache.commons.collections.Predicate;
 /**
  * Predicate implementation that returns true if the input is the same object
  * as the one stored in this predicate.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
  * @author Stephen Colebourne
  */
-public final class IdentityPredicate implements Predicate, Serializable {
+public final class IdentityPredicate<T> implements Predicate<T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = -89901658494523293L;
 
-    
     /** The value to compare to */
-    private final Object iValue;
-    
+    private final T iValue;
+
     /**
      * Factory to create the identity predicate.
-     * 
+     *
      * @param object  the object to compare to
      * @return the predicate
      * @throws IllegalArgumentException if the predicate is null
      */
-    public static Predicate getInstance(Object object) {
+    public static <T> Predicate<T> getInstance(T object) {
         if (object == null) {
-            return NullPredicate.INSTANCE;
+            return NullPredicate.<T>nullPredicate();
         }
-        return new IdentityPredicate(object);
+        return new IdentityPredicate<T>(object);
     }
 
     /**
      * Constructor that performs no validation.
      * Use <code>getInstance</code> if you want that.
-     * 
+     *
      * @param object  the object to compare to
      */
-    public IdentityPredicate(Object object) {
+    public IdentityPredicate(T object) {
         super();
         iValue = object;
     }
@@ -66,21 +65,21 @@ public final class IdentityPredicate implements Predicate, Serializable {
     /**
      * Evaluates the predicate returning true if the input object is identical to
      * the stored object.
-     * 
+     *
      * @param object  the input object
      * @return true if input is the same object as the stored value
      */
-    public boolean evaluate(Object object) {
+    public boolean evaluate(T object) {
         return (iValue == object);
     }
 
     /**
      * Gets the value.
-     * 
+     *
      * @return the value
      * @since Commons Collections 3.1
      */
-    public Object getValue() {
+    public T getValue() {
         return iValue;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/IfClosure.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/IfClosure.java b/src/java/org/apache/commons/collections/functors/IfClosure.java
index 0f49a39..151874a 100644
--- a/src/java/org/apache/commons/collections/functors/IfClosure.java
+++ b/src/java/org/apache/commons/collections/functors/IfClosure.java
@@ -31,17 +31,17 @@ import org.apache.commons.collections.Predicate;
  * @author Stephen Colebourne
  * @author Matt Benson
  */
-public class IfClosure implements Closure, Serializable {
+public class IfClosure<E> implements Closure<E>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = 3518477308466486130L;
 
     /** The test */
-    private final Predicate iPredicate;
+    private final Predicate<? super E> iPredicate;
     /** The closure to use if true */
-    private final Closure iTrueClosure;
+    private final Closure<? super E> iTrueClosure;
     /** The closure to use if false */
-    private final Closure iFalseClosure;
+    private final Closure<? super E> iFalseClosure;
 
     /**
      * Factory method that performs validation.
@@ -55,8 +55,8 @@ public class IfClosure implements Closure, Serializable {
      * @throws IllegalArgumentException if either argument is null
      * @since Commons Collections 3.2
      */
-    public static Closure getInstance(Predicate predicate, Closure trueClosure) {
-        return getInstance(predicate, trueClosure, NOPClosure.INSTANCE);
+    public static <E> Closure<E> getInstance(Predicate<? super E> predicate, Closure<? super E> trueClosure) {
+        return IfClosure.<E>getInstance(predicate, trueClosure, NOPClosure.<E>getInstance());
     }
 
     /**
@@ -68,14 +68,14 @@ public class IfClosure implements Closure, Serializable {
      * @return the <code>if</code> closure
      * @throws IllegalArgumentException if any argument is null
      */
-    public static Closure getInstance(Predicate predicate, Closure trueClosure, Closure falseClosure) {
+    public static <E> Closure<E> getInstance(Predicate<? super E> predicate, Closure<? super E> trueClosure, Closure<? super E> falseClosure) {
         if (predicate == null) {
             throw new IllegalArgumentException("Predicate must not be null");
         }
         if (trueClosure == null || falseClosure == null) {
             throw new IllegalArgumentException("Closures must not be null");
         }
-        return new IfClosure(predicate, trueClosure, falseClosure);
+        return new IfClosure<E>(predicate, trueClosure, falseClosure);
     }
 
     /**
@@ -89,7 +89,7 @@ public class IfClosure implements Closure, Serializable {
      * @param trueClosure  closure used if true, not null
      * @since Commons Collections 3.2
      */
-    public IfClosure(Predicate predicate, Closure trueClosure) {
+    public IfClosure(Predicate<? super E> predicate, Closure<? super E> trueClosure) {
         this(predicate, trueClosure, NOPClosure.INSTANCE);
     }
 
@@ -101,7 +101,7 @@ public class IfClosure implements Closure, Serializable {
      * @param trueClosure  closure used if true, not null
      * @param falseClosure  closure used if false, not null
      */
-    public IfClosure(Predicate predicate, Closure trueClosure, Closure falseClosure) {
+    public IfClosure(Predicate<? super E> predicate, Closure<? super E> trueClosure, Closure<? super E> falseClosure) {
         super();
         iPredicate = predicate;
         iTrueClosure = trueClosure;
@@ -113,8 +113,8 @@ public class IfClosure implements Closure, Serializable {
      * 
      * @param input  the input object
      */
-    public void execute(Object input) {
-        if (iPredicate.evaluate(input) == true) {
+    public void execute(E input) {
+        if (iPredicate.evaluate(input)) {
             iTrueClosure.execute(input);
         } else {
             iFalseClosure.execute(input);
@@ -127,7 +127,7 @@ public class IfClosure implements Closure, Serializable {
      * @return the predicate
      * @since Commons Collections 3.1
      */
-    public Predicate getPredicate() {
+    public Predicate<? super E> getPredicate() {
         return iPredicate;
     }
 
@@ -137,7 +137,7 @@ public class IfClosure implements Closure, Serializable {
      * @return the closure
      * @since Commons Collections 3.1
      */
-    public Closure getTrueClosure() {
+    public Closure<? super E> getTrueClosure() {
         return iTrueClosure;
     }
 
@@ -147,7 +147,7 @@ public class IfClosure implements Closure, Serializable {
      * @return the closure
      * @since Commons Collections 3.1
      */
-    public Closure getFalseClosure() {
+    public Closure<? super E> getFalseClosure() {
         return iFalseClosure;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/InstanceofPredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/InstanceofPredicate.java b/src/java/org/apache/commons/collections/functors/InstanceofPredicate.java
index d97971e..58fbe86 100644
--- a/src/java/org/apache/commons/collections/functors/InstanceofPredicate.java
+++ b/src/java/org/apache/commons/collections/functors/InstanceofPredicate.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,28 +23,28 @@ import org.apache.commons.collections.Predicate;
 /**
  * Predicate implementation that returns true if the input is an instanceof
  * the type stored in this predicate.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
  * @author Stephen Colebourne
  */
-public final class InstanceofPredicate implements Predicate, Serializable {
+public final class InstanceofPredicate implements Predicate<Object>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = -6682656911025165584L;
 
     /** The type to compare to */
-    private final Class iType;
-    
+    private final Class<?> iType;
+
     /**
      * Factory to create the identity predicate.
-     * 
+     *
      * @param type  the type to check for, may not be null
      * @return the predicate
      * @throws IllegalArgumentException if the class is null
      */
-    public static Predicate getInstance(Class type) {
+    public static Predicate<Object> getInstance(Class<?> type) {
         if (type == null) {
             throw new IllegalArgumentException("The type to check instanceof must not be null");
         }
@@ -54,17 +54,17 @@ public final class InstanceofPredicate implements Predicate, Serializable {
     /**
      * Constructor that performs no validation.
      * Use <code>getInstance</code> if you want that.
-     * 
+     *
      * @param type  the type to check for
      */
-    public InstanceofPredicate(Class type) {
+    public InstanceofPredicate(Class<?> type) {
         super();
         iType = type;
     }
 
     /**
      * Evaluates the predicate returning true if the input object is of the correct type.
-     * 
+     *
      * @param object  the input object
      * @return true if input is of stored type
      */
@@ -74,11 +74,11 @@ public final class InstanceofPredicate implements Predicate, Serializable {
 
     /**
      * Gets the type to compare to.
-     * 
+     *
      * @return the type
      * @since Commons Collections 3.1
      */
-    public Class getType() {
+    public Class<?> getType() {
         return iType;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/InstantiateFactory.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/InstantiateFactory.java b/src/java/org/apache/commons/collections/functors/InstantiateFactory.java
index f6e11df..a09c580 100644
--- a/src/java/org/apache/commons/collections/functors/InstantiateFactory.java
+++ b/src/java/org/apache/commons/collections/functors/InstantiateFactory.java
@@ -39,7 +39,7 @@ public class InstantiateFactory<T> implements Factory<T>, Serializable {
     /** The class to create */
     private final Class<T> iClassToInstantiate;
     /** The constructor parameter types */
-    private final Class[] iParamTypes;
+    private final Class<?>[] iParamTypes;
     /** The constructor arguments */
     private final Object[] iArgs;
     /** The constructor */
@@ -53,7 +53,7 @@ public class InstantiateFactory<T> implements Factory<T>, Serializable {
      * @param args  the constructor arguments
      * @return a new instantiate factory
      */
-    public static <T> Factory<T> getInstance(Class<T> classToInstantiate, Class[] paramTypes, Object[] args) {
+    public static <T> Factory<T> getInstance(Class<T> classToInstantiate, Class<?>[] paramTypes, Object[] args) {
         if (classToInstantiate == null) {
             throw new IllegalArgumentException("Class to instantiate must not be null");
         }
@@ -93,7 +93,7 @@ public class InstantiateFactory<T> implements Factory<T>, Serializable {
      * @param paramTypes  the constructor parameter types, not cloned
      * @param args  the constructor arguments, not cloned
      */
-    public InstantiateFactory(Class<T> classToInstantiate, Class[] paramTypes, Object[] args) {
+    public InstantiateFactory(Class<T> classToInstantiate, Class<?>[] paramTypes, Object[] args) {
         super();
         iClassToInstantiate = classToInstantiate;
         iParamTypes = paramTypes;
@@ -126,7 +126,6 @@ public class InstantiateFactory<T> implements Factory<T>, Serializable {
 
         try {
             return iConstructor.newInstance(iArgs);
-
         } catch (InstantiationException ex) {
             throw new FunctorException("InstantiateFactory: InstantiationException", ex);
         } catch (IllegalAccessException ex) {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/InstantiateTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/InstantiateTransformer.java b/src/java/org/apache/commons/collections/functors/InstantiateTransformer.java
index 61af4a8..ab1d098 100644
--- a/src/java/org/apache/commons/collections/functors/InstantiateTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/InstantiateTransformer.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.
@@ -25,33 +25,42 @@ import org.apache.commons.collections.Transformer;
 
 /**
  * Transformer implementation that creates a new object instance by reflection.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
  * @author Stephen Colebourne
  */
-public class InstantiateTransformer implements Transformer, Serializable {
+public class InstantiateTransformer<T> implements Transformer<Class<? extends T>, T>, Serializable {
 
     /** The serial version */
     private static final long serialVersionUID = 3786388740793356347L;
-    
+
     /** Singleton instance that uses the no arg constructor */
-    public static final Transformer NO_ARG_INSTANCE = new InstantiateTransformer();
+    public static final Transformer<Class<?>, ?> NO_ARG_INSTANCE = new InstantiateTransformer<Object>();
 
     /** The constructor parameter types */
-    private final Class[] iParamTypes;
+    private final Class<?>[] iParamTypes;
     /** The constructor arguments */
     private final Object[] iArgs;
 
     /**
+     * Get a typed no-arg instance.
+     * @param <T>
+     * @return Transformer<Class<? extends T>, T>
+     */
+    public static <T> Transformer<Class<? extends T>, T> getInstance() {
+        return new InstantiateTransformer<T>();
+    }
+
+    /**
      * Transformer method that performs validation.
-     * 
+     *
      * @param paramTypes  the constructor parameter types
      * @param args  the constructor arguments
      * @return an instantiate transformer
      */
-    public static Transformer getInstance(Class[] paramTypes, Object[] args) {
+    public static <T> Transformer<Class<? extends T>, T> getInstance(Class<?>[] paramTypes, Object[] args) {
         if (((paramTypes == null) && (args != null))
             || ((paramTypes != null) && (args == null))
             || ((paramTypes != null) && (args != null) && (paramTypes.length != args.length))) {
@@ -59,12 +68,11 @@ public class InstantiateTransformer implements Transformer, Serializable {
         }
 
         if (paramTypes == null || paramTypes.length == 0) {
-            return NO_ARG_INSTANCE;
-        } else {
-            paramTypes = (Class[]) paramTypes.clone();
-            args = (Object[]) args.clone();
+            return new InstantiateTransformer<T>();
         }
-        return new InstantiateTransformer(paramTypes, args);
+        paramTypes = (Class[]) paramTypes.clone();
+        args = (Object[]) args.clone();
+        return new InstantiateTransformer<T>(paramTypes, args);
     }
 
     /**
@@ -79,11 +87,11 @@ public class InstantiateTransformer implements Transformer, Serializable {
     /**
      * Constructor that performs no validation.
      * Use <code>getInstance</code> if you want that.
-     * 
+     *
      * @param paramTypes  the constructor parameter types, not cloned
      * @param args  the constructor arguments, not cloned
      */
-    public InstantiateTransformer(Class[] paramTypes, Object[] args) {
+    public InstantiateTransformer(Class<?>[] paramTypes, Object[] args) {
         super();
         iParamTypes = paramTypes;
         iArgs = args;
@@ -91,20 +99,19 @@ public class InstantiateTransformer implements Transformer, Serializable {
 
     /**
      * Transforms the input Class object to a result by instantiation.
-     * 
+     *
      * @param input  the input object to transform
      * @return the transformed result
      */
-    public Object transform(Object input) {
+    public T transform(Class<? extends T> input) {
         try {
             if (input instanceof Class == false) {
                 throw new FunctorException(
                     "InstantiateTransformer: Input object was not an instanceof Class, it was a "
                         + (input == null ? "null object" : input.getClass().getName()));
             }
-            Constructor con = ((Class) input).getConstructor(iParamTypes);
+            Constructor<? extends T> con = input.getConstructor(iParamTypes);
             return con.newInstance(iArgs);
-
         } catch (NoSuchMethodException ex) {
             throw new FunctorException("InstantiateTransformer: The constructor must exist and be public ");
         } catch (InstantiationException ex) {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/InvokerTransformer.java b/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
index fdb4502..0ab3dbb 100644
--- a/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
@@ -31,7 +31,7 @@ import org.apache.commons.collections.Transformer;
  *
  * @author Stephen Colebourne
  */
-public class InvokerTransformer implements Transformer, Serializable {
+public class InvokerTransformer<I, O> implements Transformer<I, O>, Serializable {
 
     /** The serial version */
     private static final long serialVersionUID = -8653385846894047688L;
@@ -39,7 +39,7 @@ public class InvokerTransformer implements Transformer, Serializable {
     /** The method name to call */
     private final String iMethodName;
     /** The array of reflection parameter types */
-    private final Class[] iParamTypes;
+    private final Class<?>[] iParamTypes;
     /** The array of reflection arguments */
     private final Object[] iArgs;
 
@@ -50,11 +50,11 @@ public class InvokerTransformer implements Transformer, Serializable {
      * @return an invoker transformer
      * @since Commons Collections 3.1
      */
-    public static Transformer getInstance(String methodName) {
+    public static <I, O> Transformer<I, O> getInstance(String methodName) {
         if (methodName == null) {
             throw new IllegalArgumentException("The method to invoke must not be null");
         }
-        return new InvokerTransformer(methodName);
+        return new InvokerTransformer<I, O>(methodName);
     }
 
     /**
@@ -65,7 +65,7 @@ public class InvokerTransformer implements Transformer, Serializable {
      * @param args  the arguments to pass to the method
      * @return an invoker transformer
      */
-    public static Transformer getInstance(String methodName, Class[] paramTypes, Object[] args) {
+    public static <I, O> Transformer<I, O> getInstance(String methodName, Class<?>[] paramTypes, Object[] args) {
         if (methodName == null) {
             throw new IllegalArgumentException("The method to invoke must not be null");
         }
@@ -75,11 +75,11 @@ public class InvokerTransformer implements Transformer, Serializable {
             throw new IllegalArgumentException("The parameter types must match the arguments");
         }
         if (paramTypes == null || paramTypes.length == 0) {
-            return new InvokerTransformer(methodName);
+            return new InvokerTransformer<I, O>(methodName);
         } else {
             paramTypes = (Class[]) paramTypes.clone();
             args = (Object[]) args.clone();
-            return new InvokerTransformer(methodName, paramTypes, args);
+            return new InvokerTransformer<I, O>(methodName, paramTypes, args);
         }
     }
 
@@ -103,7 +103,7 @@ public class InvokerTransformer implements Transformer, Serializable {
      * @param paramTypes  the constructor parameter types, not cloned
      * @param args  the constructor arguments, not cloned
      */
-    public InvokerTransformer(String methodName, Class[] paramTypes, Object[] args) {
+    public InvokerTransformer(String methodName, Class<?>[] paramTypes, Object[] args) {
         super();
         iMethodName = methodName;
         iParamTypes = paramTypes;
@@ -116,15 +116,15 @@ public class InvokerTransformer implements Transformer, Serializable {
      * @param input  the input object to transform
      * @return the transformed result, null if null input
      */
-    public Object transform(Object input) {
+    @SuppressWarnings("unchecked")
+    public O transform(Object input) {
         if (input == null) {
             return null;
         }
         try {
-            Class cls = input.getClass();
+            Class<?> cls = input.getClass();
             Method method = cls.getMethod(iMethodName, iParamTypes);
-            return method.invoke(input, iArgs);
-                
+            return (O) method.invoke(input, iArgs);
         } catch (NoSuchMethodException ex) {
             throw new FunctorException("InvokerTransformer: The method '" + iMethodName + "' on '" + input.getClass() + "' does not exist");
         } catch (IllegalAccessException ex) {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/MapTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/MapTransformer.java b/src/java/org/apache/commons/collections/functors/MapTransformer.java
index 573762b..2bdaa98 100644
--- a/src/java/org/apache/commons/collections/functors/MapTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/MapTransformer.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,63 +24,63 @@ import org.apache.commons.collections.Transformer;
 /**
  * Transformer implementation that returns the value held in a specified map
  * using the input parameter as a key.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
  * @author Stephen Colebourne
  */
-public final class MapTransformer implements Transformer, Serializable {
+public final class MapTransformer<I, O> implements Transformer<I, O>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = 862391807045468939L;
-    
+
     /** The map of data to lookup in */
-    private final Map iMap;
+    private final Map<? super I, ? extends O> iMap;
 
     /**
      * Factory to create the transformer.
      * <p>
      * If the map is null, a transformer that always returns null is returned.
-     * 
+     *
      * @param map the map, not cloned
      * @return the transformer
      */
-    public static Transformer getInstance(Map map) {
+    public static <I, O> Transformer<I, O> getInstance(Map<? super I, ? extends O> map) {
         if (map == null) {
-            return ConstantTransformer.NULL_INSTANCE;
+            return ConstantTransformer.<I, O>getNullInstance();
         }
-        return new MapTransformer(map);
+        return new MapTransformer<I, O>(map);
     }
 
     /**
      * Constructor that performs no validation.
      * Use <code>getInstance</code> if you want that.
-     * 
+     *
      * @param map  the map to use for lookup, not cloned
      */
-    private MapTransformer(Map map) {
+    private MapTransformer(Map<? super I, ? extends O> map) {
         super();
         iMap = map;
     }
 
     /**
      * Transforms the input to result by looking it up in a <code>Map</code>.
-     * 
+     *
      * @param input  the input object to transform
      * @return the transformed result
      */
-    public Object transform(Object input) {
+    public O transform(I input) {
         return iMap.get(input);
     }
 
     /**
      * Gets the map to lookup in.
-     * 
+     *
      * @return the map
      * @since Commons Collections 3.1
      */
-    public Map getMap() {
+    public Map<? super I, ? extends O> getMap() {
         return iMap;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/NOPClosure.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/NOPClosure.java b/src/java/org/apache/commons/collections/functors/NOPClosure.java
index 3bfee9e..3fa08c2 100644
--- a/src/java/org/apache/commons/collections/functors/NOPClosure.java
+++ b/src/java/org/apache/commons/collections/functors/NOPClosure.java
@@ -28,13 +28,13 @@ import org.apache.commons.collections.Closure;
  *
  * @author Stephen Colebourne
  */
-public class NOPClosure implements Closure, Serializable {
+public class NOPClosure<E> implements Closure<E>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = 3518477308466486130L;
 
     /** Singleton predicate instance */
-    public static final Closure INSTANCE = new NOPClosure();
+    public static final Closure<Object> INSTANCE = new NOPClosure<Object>();
 
     /**
      * Factory returning the singleton instance.
@@ -42,8 +42,9 @@ public class NOPClosure implements Closure, Serializable {
      * @return the singleton instance
      * @since Commons Collections 3.1
      */
-    public static Closure getInstance() {
-        return INSTANCE;
+    @SuppressWarnings("unchecked")
+    public static <E> Closure<E> getInstance() {
+        return (Closure<E>) INSTANCE;
     }
 
     /**
@@ -58,8 +59,23 @@ public class NOPClosure implements Closure, Serializable {
      * 
      * @param input  the input object
      */
-    public void execute(Object input) {
+    public void execute(E input) {
         // do nothing
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals(Object arg0) {
+        return arg0.hashCode() == this.hashCode();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode() {
+        return System.identityHashCode(INSTANCE);
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/NOPTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/NOPTransformer.java b/src/java/org/apache/commons/collections/functors/NOPTransformer.java
index 6c018c8..a21e44a 100644
--- a/src/java/org/apache/commons/collections/functors/NOPTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/NOPTransformer.java
@@ -28,13 +28,13 @@ import org.apache.commons.collections.Transformer;
  *
  * @author Stephen Colebourne
  */
-public class NOPTransformer implements Transformer, Serializable {
+public class NOPTransformer<T> implements Transformer<T, T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = 2133891748318574490L;
 
     /** Singleton predicate instance */
-    public static final Transformer INSTANCE = new NOPTransformer();
+    public static final Transformer<Object, Object> INSTANCE = new NOPTransformer<Object>();
 
     /**
      * Factory returning the singleton instance.
@@ -42,8 +42,9 @@ public class NOPTransformer implements Transformer, Serializable {
      * @return the singleton instance
      * @since Commons Collections 3.1
      */
-    public static Transformer getInstance() {
-        return INSTANCE;
+    @SuppressWarnings("unchecked")
+    public static <T> Transformer<T, T> getInstance() {
+        return (Transformer<T, T>) INSTANCE;
     }
 
     /**
@@ -59,7 +60,7 @@ public class NOPTransformer implements Transformer, Serializable {
      * @param input  the input object to transform
      * @return the transformed result which is the input
      */
-    public Object transform(Object input) {
+    public T transform(T input) {
         return input;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/NonePredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/NonePredicate.java b/src/java/org/apache/commons/collections/functors/NonePredicate.java
index f3cf062..11b07a1 100644
--- a/src/java/org/apache/commons/collections/functors/NonePredicate.java
+++ b/src/java/org/apache/commons/collections/functors/NonePredicate.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.
@@ -35,14 +35,14 @@ import org.apache.commons.collections.Predicate;
  * @author Stephen Colebourne
  * @author Matt Benson
  */
-public final class NonePredicate implements Predicate, PredicateDecorator, Serializable {
+public final class NonePredicate<T> implements Predicate<T>, PredicateDecorator<T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = 2007613066565892961L;
-    
+
     /** The array of predicates to call */
-    private final Predicate[] iPredicates;
-    
+    private final Predicate<? super T>[] iPredicates;
+
     /**
      * Factory to create the predicate.
      * <p>
@@ -53,13 +53,13 @@ public final class NonePredicate implements Predicate, PredicateDecorator, Seria
      * @throws IllegalArgumentException if the predicates array is null
      * @throws IllegalArgumentException if any predicate in the array is null
      */
-    public static Predicate getInstance(Predicate[] predicates) {
+    public static <T> Predicate<T> getInstance(Predicate<? super T>[] predicates) {
         FunctorUtils.validate(predicates);
         if (predicates.length == 0) {
-            return TruePredicate.INSTANCE;
+            return TruePredicate.<T>truePredicate();
         }
         predicates = FunctorUtils.copy(predicates);
-        return new NonePredicate(predicates);
+        return new NonePredicate<T>(predicates);
     }
 
     /**
@@ -72,32 +72,32 @@ public final class NonePredicate implements Predicate, PredicateDecorator, Seria
      * @throws IllegalArgumentException if the predicates array is null
      * @throws IllegalArgumentException if any predicate in the array is null
      */
-    public static Predicate getInstance(Collection predicates) {
-        Predicate[] preds = FunctorUtils.validate(predicates);
+    public static <T> Predicate<T> getInstance(Collection<? extends Predicate<T>> predicates) {
+        Predicate<? super T>[] preds = FunctorUtils.validate(predicates);
         if (preds.length == 0) {
-            return TruePredicate.INSTANCE;
+            return TruePredicate.<T>truePredicate();
         }
-        return new NonePredicate(preds);
+        return new NonePredicate<T>(preds);
     }
 
     /**
      * Constructor that performs no validation.
      * Use <code>getInstance</code> if you want that.
-     * 
+     *
      * @param predicates  the predicates to check, not cloned, not null
      */
-    public NonePredicate(Predicate[] predicates) {
+    public NonePredicate(Predicate<? super T>[] predicates) {
         super();
         iPredicates = predicates;
     }
 
     /**
      * Evaluates the predicate returning false if any stored predicate returns false.
-     * 
+     *
      * @param object  the input object
      * @return true if none of decorated predicates return true
      */
-    public boolean evaluate(Object object) {
+    public boolean evaluate(T object) {
         for (int i = 0; i < iPredicates.length; i++) {
             if (iPredicates[i].evaluate(object)) {
                 return false;
@@ -108,11 +108,11 @@ public final class NonePredicate implements Predicate, PredicateDecorator, Seria
 
     /**
      * Gets the predicates, do not modify the array.
-     * 
+     *
      * @return the predicates
      * @since Commons Collections 3.1
      */
-    public Predicate[] getPredicates() {
+    public Predicate<? super T>[] getPredicates() {
         return iPredicates;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/NotNullPredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/NotNullPredicate.java b/src/java/org/apache/commons/collections/functors/NotNullPredicate.java
index c68d0cf..218ad82 100644
--- a/src/java/org/apache/commons/collections/functors/NotNullPredicate.java
+++ b/src/java/org/apache/commons/collections/functors/NotNullPredicate.java
@@ -28,13 +28,13 @@ import org.apache.commons.collections.Predicate;
  *
  * @author Stephen Colebourne
  */
-public final class NotNullPredicate implements Predicate, Serializable {
+public final class NotNullPredicate<T> implements Predicate<T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = 7533784454832764388L;
     
     /** Singleton predicate instance */
-    public static final Predicate INSTANCE = new NotNullPredicate();
+    public static final Predicate<Object> INSTANCE = new NotNullPredicate<Object>();
 
     /**
      * Factory returning the singleton instance.
@@ -42,8 +42,9 @@ public final class NotNullPredicate implements Predicate, Serializable {
      * @return the singleton instance
      * @since Commons Collections 3.1
      */
-    public static Predicate getInstance() {
-        return INSTANCE;
+    @SuppressWarnings("unchecked")
+    public static <T> Predicate<T> getInstance() {
+        return (Predicate<T>) INSTANCE;
     }
 
     /**
@@ -59,7 +60,7 @@ public final class NotNullPredicate implements Predicate, Serializable {
      * @param object  the object to evaluate
      * @return true if not null
      */
-    public boolean evaluate(Object object) {
+    public boolean evaluate(T object) {
         return (object != null);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/NotPredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/NotPredicate.java b/src/java/org/apache/commons/collections/functors/NotPredicate.java
index 7096683..5bc171b 100644
--- a/src/java/org/apache/commons/collections/functors/NotPredicate.java
+++ b/src/java/org/apache/commons/collections/functors/NotPredicate.java
@@ -28,13 +28,13 @@ import org.apache.commons.collections.Predicate;
  *
  * @author Stephen Colebourne
  */
-public final class NotPredicate implements Predicate, PredicateDecorator, Serializable {
+public final class NotPredicate<T> implements Predicate<T>, PredicateDecorator<T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = -2654603322338049674L;
     
     /** The predicate to decorate */
-    private final Predicate iPredicate;
+    private final Predicate<? super T> iPredicate;
     
     /**
      * Factory to create the not predicate.
@@ -43,11 +43,11 @@ public final class NotPredicate implements Predicate, PredicateDecorator, Serial
      * @return the predicate
      * @throws IllegalArgumentException if the predicate is null
      */
-    public static Predicate getInstance(Predicate predicate) {
+    public static <T> Predicate<T> getInstance(Predicate<? super T> predicate) {
         if (predicate == null) {
             throw new IllegalArgumentException("Predicate must not be null");
         }
-        return new NotPredicate(predicate);
+        return new NotPredicate<T>(predicate);
     }
 
     /**
@@ -56,7 +56,7 @@ public final class NotPredicate implements Predicate, PredicateDecorator, Serial
      * 
      * @param predicate  the predicate to call after the null check
      */
-    public NotPredicate(Predicate predicate) {
+    public NotPredicate(Predicate<? super T> predicate) {
         super();
         iPredicate = predicate;
     }
@@ -67,7 +67,7 @@ public final class NotPredicate implements Predicate, PredicateDecorator, Serial
      * @param object  the input object
      * @return true if predicate returns false
      */
-    public boolean evaluate(Object object) {
+    public boolean evaluate(T object) {
         return !(iPredicate.evaluate(object));
     }
 
@@ -77,7 +77,8 @@ public final class NotPredicate implements Predicate, PredicateDecorator, Serial
      * @return the predicate as the only element in an array
      * @since Commons Collections 3.1
      */
-    public Predicate[] getPredicates() {
+    @SuppressWarnings("unchecked")
+    public Predicate<? super T>[] getPredicates() {
         return new Predicate[] {iPredicate};
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/NullIsExceptionPredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/NullIsExceptionPredicate.java b/src/java/org/apache/commons/collections/functors/NullIsExceptionPredicate.java
index 8e6728c..d8269fa 100644
--- a/src/java/org/apache/commons/collections/functors/NullIsExceptionPredicate.java
+++ b/src/java/org/apache/commons/collections/functors/NullIsExceptionPredicate.java
@@ -29,13 +29,13 @@ import org.apache.commons.collections.Predicate;
  *
  * @author Stephen Colebourne
  */
-public final class NullIsExceptionPredicate implements Predicate, PredicateDecorator, Serializable {
+public final class NullIsExceptionPredicate<T> implements Predicate<T>, PredicateDecorator<T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = 3243449850504576071L;
     
     /** The predicate to decorate */
-    private final Predicate iPredicate;
+    private final Predicate<? super T> iPredicate;
     
     /**
      * Factory to create the null exception predicate.
@@ -44,11 +44,11 @@ public final class NullIsExceptionPredicate implements Predicate, PredicateDecor
      * @return the predicate
      * @throws IllegalArgumentException if the predicate is null
      */
-    public static Predicate getInstance(Predicate predicate) {
+    public static <T> Predicate<T> getInstance(Predicate<? super T> predicate) {
         if (predicate == null) {
             throw new IllegalArgumentException("Predicate must not be null");
         }
-        return new NullIsExceptionPredicate(predicate);
+        return new NullIsExceptionPredicate<T>(predicate);
     }
 
     /**
@@ -57,7 +57,7 @@ public final class NullIsExceptionPredicate implements Predicate, PredicateDecor
      * 
      * @param predicate  the predicate to call after the null check
      */
-    public NullIsExceptionPredicate(Predicate predicate) {
+    public NullIsExceptionPredicate(Predicate<? super T> predicate) {
         super();
         iPredicate = predicate;
     }
@@ -70,7 +70,7 @@ public final class NullIsExceptionPredicate implements Predicate, PredicateDecor
      * @return true if decorated predicate returns true
      * @throws FunctorException if input is null
      */
-    public boolean evaluate(Object object) {
+    public boolean evaluate(T object) {
         if (object == null) {
             throw new FunctorException("Input Object must not be null");
         }
@@ -83,8 +83,9 @@ public final class NullIsExceptionPredicate implements Predicate, PredicateDecor
      * @return the predicate as the only element in an array
      * @since Commons Collections 3.1
      */
-    public Predicate[] getPredicates() {
-        return new Predicate[] {iPredicate};
+    @SuppressWarnings("unchecked")
+    public Predicate<? super T>[] getPredicates() {
+        return new Predicate[] { iPredicate };
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/NullIsFalsePredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/NullIsFalsePredicate.java b/src/java/org/apache/commons/collections/functors/NullIsFalsePredicate.java
index a60a277..217422c 100644
--- a/src/java/org/apache/commons/collections/functors/NullIsFalsePredicate.java
+++ b/src/java/org/apache/commons/collections/functors/NullIsFalsePredicate.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.
@@ -22,41 +22,41 @@ import org.apache.commons.collections.Predicate;
 
 /**
  * Predicate implementation that returns false if the input is null.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
  * @author Stephen Colebourne
  */
-public final class NullIsFalsePredicate implements Predicate, PredicateDecorator, Serializable {
+public final class NullIsFalsePredicate<T> implements Predicate<T>, PredicateDecorator<T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = -2997501534564735525L;
-    
+
     /** The predicate to decorate */
-    private final Predicate iPredicate;
-    
+    private final Predicate<? super T> iPredicate;
+
     /**
      * Factory to create the null false predicate.
-     * 
+     *
      * @param predicate  the predicate to decorate, not null
      * @return the predicate
      * @throws IllegalArgumentException if the predicate is null
      */
-    public static Predicate getInstance(Predicate predicate) {
+    public static <T> Predicate<T> getInstance(Predicate<? super T> predicate) {
         if (predicate == null) {
             throw new IllegalArgumentException("Predicate must not be null");
         }
-        return new NullIsFalsePredicate(predicate);
+        return new NullIsFalsePredicate<T>(predicate);
     }
 
     /**
      * Constructor that performs no validation.
      * Use <code>getInstance</code> if you want that.
-     * 
+     *
      * @param predicate  the predicate to call after the null check
      */
-    public NullIsFalsePredicate(Predicate predicate) {
+    public NullIsFalsePredicate(Predicate<? super T> predicate) {
         super();
         iPredicate = predicate;
     }
@@ -64,11 +64,11 @@ public final class NullIsFalsePredicate implements Predicate, PredicateDecorator
     /**
      * Evaluates the predicate returning the result of the decorated predicate
      * once a null check is performed.
-     * 
+     *
      * @param object  the input object
      * @return true if decorated predicate returns true, false if input is null
      */
-    public boolean evaluate(Object object) {
+    public boolean evaluate(T object) {
         if (object == null) {
             return false;
         }
@@ -77,12 +77,13 @@ public final class NullIsFalsePredicate implements Predicate, PredicateDecorator
 
     /**
      * Gets the predicate being decorated.
-     * 
+     *
      * @return the predicate as the only element in an array
      * @since Commons Collections 3.1
      */
-    public Predicate[] getPredicates() {
-        return new Predicate[] {iPredicate};
+    @SuppressWarnings("unchecked")
+    public Predicate<? super T>[] getPredicates() {
+        return new Predicate[] { iPredicate };
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/NullIsTruePredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/NullIsTruePredicate.java b/src/java/org/apache/commons/collections/functors/NullIsTruePredicate.java
index e75fc23..0ba668f 100644
--- a/src/java/org/apache/commons/collections/functors/NullIsTruePredicate.java
+++ b/src/java/org/apache/commons/collections/functors/NullIsTruePredicate.java
@@ -28,13 +28,13 @@ import org.apache.commons.collections.Predicate;
  *
  * @author Stephen Colebourne
  */
-public final class NullIsTruePredicate implements Predicate, PredicateDecorator, Serializable {
+public final class NullIsTruePredicate<T> implements Predicate<T>, PredicateDecorator<T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = -7625133768987126273L;
     
     /** The predicate to decorate */
-    private final Predicate iPredicate;
+    private final Predicate<? super T> iPredicate;
     
     /**
      * Factory to create the null true predicate.
@@ -43,11 +43,11 @@ public final class NullIsTruePredicate implements Predicate, PredicateDecorator,
      * @return the predicate
      * @throws IllegalArgumentException if the predicate is null
      */
-    public static Predicate getInstance(Predicate predicate) {
+    public static <T> Predicate<T> getInstance(Predicate<? super T> predicate) {
         if (predicate == null) {
             throw new IllegalArgumentException("Predicate must not be null");
         }
-        return new NullIsTruePredicate(predicate);
+        return new NullIsTruePredicate<T>(predicate);
     }
 
     /**
@@ -56,7 +56,7 @@ public final class NullIsTruePredicate implements Predicate, PredicateDecorator,
      * 
      * @param predicate  the predicate to call after the null check
      */
-    public NullIsTruePredicate(Predicate predicate) {
+    public NullIsTruePredicate(Predicate<? super T> predicate) {
         super();
         iPredicate = predicate;
     }
@@ -68,7 +68,7 @@ public final class NullIsTruePredicate implements Predicate, PredicateDecorator,
      * @param object  the input object
      * @return true if decorated predicate returns true or input is null
      */
-    public boolean evaluate(Object object) {
+    public boolean evaluate(T object) {
         if (object == null) {
             return true;
         }
@@ -81,8 +81,9 @@ public final class NullIsTruePredicate implements Predicate, PredicateDecorator,
      * @return the predicate as the only element in an array
      * @since Commons Collections 3.1
      */
-    public Predicate[] getPredicates() {
-        return new Predicate[] {iPredicate};
+    @SuppressWarnings("unchecked")
+    public Predicate<? super T>[] getPredicates() {
+        return new Predicate[] { iPredicate };
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/OnePredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/OnePredicate.java b/src/java/org/apache/commons/collections/functors/OnePredicate.java
index 425f9b6..5f3252e 100644
--- a/src/java/org/apache/commons/collections/functors/OnePredicate.java
+++ b/src/java/org/apache/commons/collections/functors/OnePredicate.java
@@ -35,13 +35,13 @@ import org.apache.commons.collections.Predicate;
  * @author Stephen Colebourne
  * @author Matt Benson
  */
-public final class OnePredicate implements Predicate, PredicateDecorator, Serializable {
+public final class OnePredicate<T> implements Predicate<T>, PredicateDecorator<T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = -8125389089924745785L;
     
     /** The array of predicates to call */
-    private final Predicate[] iPredicates;
+    private final Predicate<? super T>[] iPredicates;
     
     /**
      * Factory to create the predicate.
@@ -54,16 +54,17 @@ public final class OnePredicate implements Predicate, PredicateDecorator, Serial
      * @throws IllegalArgumentException if the predicates array is null
      * @throws IllegalArgumentException if any predicate in the array is null
      */
-    public static Predicate getInstance(Predicate[] predicates) {
+    @SuppressWarnings("unchecked")
+    public static <T> Predicate<T> getInstance(Predicate<? super T>[] predicates) {
         FunctorUtils.validate(predicates);
         if (predicates.length == 0) {
-            return FalsePredicate.INSTANCE;
+            return FalsePredicate.<T>falsePredicate();
         }
         if (predicates.length == 1) {
-            return predicates[0];
+            return (Predicate<T>) predicates[0];
         }
         predicates = FunctorUtils.copy(predicates);
-        return new OnePredicate(predicates);
+        return new OnePredicate<T>(predicates);
     }
 
     /**
@@ -74,9 +75,9 @@ public final class OnePredicate implements Predicate, PredicateDecorator, Serial
      * @throws IllegalArgumentException if the predicates array is null
      * @throws IllegalArgumentException if any predicate in the array is null
      */
-    public static Predicate getInstance(Collection predicates) {
-        Predicate[] preds = FunctorUtils.validate(predicates);
-        return new OnePredicate(preds);
+    public static <T> Predicate<T> getInstance(Collection<? extends Predicate<T>> predicates) {
+        Predicate<? super T>[] preds = FunctorUtils.validate(predicates);
+        return new OnePredicate<T>(preds);
     }
 
     /**
@@ -85,7 +86,7 @@ public final class OnePredicate implements Predicate, PredicateDecorator, Serial
      * 
      * @param predicates  the predicates to check, not cloned, not null
      */
-    public OnePredicate(Predicate[] predicates) {
+    public OnePredicate(Predicate<? super T>[] predicates) {
         super();
         iPredicates = predicates;
     }
@@ -97,7 +98,7 @@ public final class OnePredicate implements Predicate, PredicateDecorator, Serial
      * @param object  the input object
      * @return true if only one decorated predicate returns true
      */
-    public boolean evaluate(Object object) {
+    public boolean evaluate(T object) {
         boolean match = false;
         for (int i = 0; i < iPredicates.length; i++) {
             if (iPredicates[i].evaluate(object)) {
@@ -116,7 +117,7 @@ public final class OnePredicate implements Predicate, PredicateDecorator, Serial
      * @return the predicates
      * @since Commons Collections 3.1
      */
-    public Predicate[] getPredicates() {
+    public Predicate<? super T>[] getPredicates() {
         return iPredicates;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/OrPredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/OrPredicate.java b/src/java/org/apache/commons/collections/functors/OrPredicate.java
index ea7f0fd..e87edbd 100644
--- a/src/java/org/apache/commons/collections/functors/OrPredicate.java
+++ b/src/java/org/apache/commons/collections/functors/OrPredicate.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.
@@ -22,45 +22,45 @@ import org.apache.commons.collections.Predicate;
 
 /**
  * Predicate implementation that returns true if either of the predicates return true.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
  * @author Stephen Colebourne
  */
-public final class OrPredicate implements Predicate, PredicateDecorator, Serializable {
+public final class OrPredicate<T> implements Predicate<T>, PredicateDecorator<T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = -8791518325735182855L;
-    
+
     /** The array of predicates to call */
-    private final Predicate iPredicate1;
+    private final Predicate<? super T> iPredicate1;
     /** The array of predicates to call */
-    private final Predicate iPredicate2;
-    
+    private final Predicate<? super T> iPredicate2;
+
     /**
      * Factory to create the predicate.
-     * 
+     *
      * @param predicate1  the first predicate to check, not null
      * @param predicate2  the second predicate to check, not null
      * @return the <code>and</code> predicate
      * @throws IllegalArgumentException if either predicate is null
      */
-    public static Predicate getInstance(Predicate predicate1, Predicate predicate2) {
+    public static <T> Predicate<T> getInstance(Predicate<? super T> predicate1, Predicate<? super T> predicate2) {
         if (predicate1 == null || predicate2 == null) {
             throw new IllegalArgumentException("Predicate must not be null");
         }
-        return new OrPredicate(predicate1, predicate2);
+        return new OrPredicate<T>(predicate1, predicate2);
     }
 
     /**
      * Constructor that performs no validation.
      * Use <code>getInstance</code> if you want that.
-     * 
+     *
      * @param predicate1  the first predicate to check, not null
      * @param predicate2  the second predicate to check, not null
      */
-    public OrPredicate(Predicate predicate1, Predicate predicate2) {
+    public OrPredicate(Predicate<? super T> predicate1, Predicate<? super T> predicate2) {
         super();
         iPredicate1 = predicate1;
         iPredicate2 = predicate2;
@@ -68,21 +68,22 @@ public final class OrPredicate implements Predicate, PredicateDecorator, Seriali
 
     /**
      * Evaluates the predicate returning true if either predicate returns true.
-     * 
+     *
      * @param object  the input object
      * @return true if either decorated predicate returns true
      */
-    public boolean evaluate(Object object) {
+    public boolean evaluate(T object) {
        return (iPredicate1.evaluate(object) || iPredicate2.evaluate(object));
     }
 
     /**
      * Gets the two predicates being decorated as an array.
-     * 
+     *
      * @return the predicates
      * @since Commons Collections 3.1
      */
-    public Predicate[] getPredicates() {
+    @SuppressWarnings("unchecked")
+    public Predicate<? super T>[] getPredicates() {
         return new Predicate[] {iPredicate1, iPredicate2};
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/PredicateTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/PredicateTransformer.java b/src/java/org/apache/commons/collections/functors/PredicateTransformer.java
index a0a83d9..ca8c93b 100644
--- a/src/java/org/apache/commons/collections/functors/PredicateTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/PredicateTransformer.java
@@ -23,20 +23,20 @@ import org.apache.commons.collections.Transformer;
 
 /**
  * Transformer implementation that calls a Predicate using the input object
- * and then returns the input.
+ * and then returns the result.
  * 
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
  * @author Stephen Colebourne
  */
-public class PredicateTransformer implements Transformer, Serializable {
+public class PredicateTransformer<T> implements Transformer<T, Boolean>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = 5278818408044349346L;
 
     /** The closure to wrap */
-    private final Predicate iPredicate;
+    private final Predicate<? super T> iPredicate;
 
     /**
      * Factory method that performs validation.
@@ -45,11 +45,11 @@ public class PredicateTransformer implements Transformer, Serializable {
      * @return the <code>predicate</code> transformer
      * @throws IllegalArgumentException if the predicate is null
      */
-    public static Transformer getInstance(Predicate predicate) {
+    public static <T> Transformer<T, Boolean> getInstance(Predicate<? super T> predicate) {
         if (predicate == null) {
             throw new IllegalArgumentException("Predicate must not be null");
         }
-        return new PredicateTransformer(predicate);
+        return new PredicateTransformer<T>(predicate);
     }
 
     /**
@@ -58,7 +58,7 @@ public class PredicateTransformer implements Transformer, Serializable {
      * 
      * @param predicate  the predicate to call, not null
      */
-    public PredicateTransformer(Predicate predicate) {
+    public PredicateTransformer(Predicate<? super T> predicate) {
         super();
         iPredicate = predicate;
     }
@@ -69,8 +69,8 @@ public class PredicateTransformer implements Transformer, Serializable {
      * @param input  the input object to transform
      * @return the transformed result
      */
-    public Object transform(Object input) {
-        return (iPredicate.evaluate(input) ? Boolean.TRUE : Boolean.FALSE);
+    public Boolean transform(T input) {
+        return iPredicate.evaluate(input);
     }
 
     /**
@@ -79,7 +79,7 @@ public class PredicateTransformer implements Transformer, Serializable {
      * @return the predicate
      * @since Commons Collections 3.1
      */
-    public Predicate getPredicate() {
+    public Predicate<? super T> getPredicate() {
         return iPredicate;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/PrototypeFactory.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/PrototypeFactory.java b/src/java/org/apache/commons/collections/functors/PrototypeFactory.java
index d3b2ed0..c23d584 100644
--- a/src/java/org/apache/commons/collections/functors/PrototypeFactory.java
+++ b/src/java/org/apache/commons/collections/functors/PrototypeFactory.java
@@ -55,22 +55,22 @@ public class PrototypeFactory {
      * @throws IllegalArgumentException if the prototype is null
      * @throws IllegalArgumentException if the prototype cannot be cloned
      */
-    public static Factory getInstance(Object prototype) {
+    @SuppressWarnings("unchecked")
+    public static <T> Factory<T> getInstance(T prototype) {
         if (prototype == null) {
-            return ConstantFactory.NULL_INSTANCE;
+            return ConstantFactory.<T>getInstance(null);
         }
         try {
             Method method = prototype.getClass().getMethod("clone", (Class[]) null);
-            return new PrototypeCloneFactory(prototype, method);
+            return new PrototypeCloneFactory<T>(prototype, method);
 
         } catch (NoSuchMethodException ex) {
             try {
-                prototype.getClass().getConstructor(new Class[] { prototype.getClass()});
-                return new InstantiateFactory(
-                    prototype.getClass(),
-                    new Class[] { prototype.getClass()},
+                prototype.getClass().getConstructor(new Class<?>[] { prototype.getClass() });
+                return new InstantiateFactory<T>(
+                    (Class<T>) prototype.getClass(),
+                    new Class<?>[] { prototype.getClass() },
                     new Object[] { prototype });
-
             } catch (NoSuchMethodException ex2) {
                 if (prototype instanceof Serializable) {
                     return new PrototypeSerializationFactory((Serializable) prototype);
@@ -93,20 +93,20 @@ public class PrototypeFactory {
     /**
      * PrototypeCloneFactory creates objects by copying a prototype using the clone method.
      */
-    static class PrototypeCloneFactory implements Factory, Serializable {
+    static class PrototypeCloneFactory<T> implements Factory<T>, Serializable {
         
         /** The serial version */
         private static final long serialVersionUID = 5604271422565175555L;
         
         /** The object to clone each time */
-        private final Object iPrototype;
+        private final T iPrototype;
         /** The method used to clone */
         private transient Method iCloneMethod;
 
         /**
          * Constructor to store prototype.
          */
-        private PrototypeCloneFactory(Object prototype, Method method) {
+        private PrototypeCloneFactory(T prototype, Method method) {
             super();
             iPrototype = prototype;
             iCloneMethod = method;
@@ -118,7 +118,6 @@ public class PrototypeFactory {
         private void findCloneMethod() {
             try {
                 iCloneMethod = iPrototype.getClass().getMethod("clone", (Class[]) null);
-
             } catch (NoSuchMethodException ex) {
                 throw new IllegalArgumentException("PrototypeCloneFactory: The clone method must exist and be public ");
             }
@@ -129,15 +128,15 @@ public class PrototypeFactory {
          * 
          * @return the new object
          */
-        public Object create() {
+        @SuppressWarnings("unchecked")
+        public T create() {
             // needed for post-serialization
             if (iCloneMethod == null) {
                 findCloneMethod();
             }
 
             try {
-                return iCloneMethod.invoke(iPrototype, (Object[])null);
-
+                return (T) iCloneMethod.invoke(iPrototype, (Object[]) null);
             } catch (IllegalAccessException ex) {
                 throw new FunctorException("PrototypeCloneFactory: Clone method must be public", ex);
             } catch (InvocationTargetException ex) {
@@ -151,18 +150,18 @@ public class PrototypeFactory {
     /**
      * PrototypeSerializationFactory creates objects by cloning a prototype using serialization.
      */
-    static class PrototypeSerializationFactory implements Factory, Serializable {
+    static class PrototypeSerializationFactory<T extends Serializable> implements Factory<T>, Serializable {
         
         /** The serial version */
         private static final long serialVersionUID = -8704966966139178833L;
         
         /** The object to clone via serialization each time */
-        private final Serializable iPrototype;
+        private final T iPrototype;
 
         /**
          * Constructor to store prototype
          */
-        private PrototypeSerializationFactory(Serializable prototype) {
+        private PrototypeSerializationFactory(T prototype) {
             super();
             iPrototype = prototype;
         }
@@ -172,7 +171,8 @@ public class PrototypeFactory {
          * 
          * @return the new object
          */
-        public Object create() {
+        @SuppressWarnings("unchecked")
+        public T create() {
             ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
             ByteArrayInputStream bais = null;
             try {
@@ -181,7 +181,7 @@ public class PrototypeFactory {
 
                 bais = new ByteArrayInputStream(baos.toByteArray());
                 ObjectInputStream in = new ObjectInputStream(bais);
-                return in.readObject();
+                return (T) in.readObject();
 
             } catch (ClassNotFoundException ex) {
                 throw new FunctorException(ex);

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/StringValueTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/StringValueTransformer.java b/src/java/org/apache/commons/collections/functors/StringValueTransformer.java
index 8e75c82..3e54967 100644
--- a/src/java/org/apache/commons/collections/functors/StringValueTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/StringValueTransformer.java
@@ -29,13 +29,13 @@ import org.apache.commons.collections.Transformer;
  *
  * @author Stephen Colebourne
  */
-public final class StringValueTransformer implements Transformer, Serializable {
+public final class StringValueTransformer<T> implements Transformer<T, String>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = 7511110693171758606L;
 
     /** Singleton predicate instance */
-    public static final Transformer INSTANCE = new StringValueTransformer();
+    public static final Transformer<Object, String> INSTANCE = new StringValueTransformer<Object>();
 
     /**
      * Factory returning the singleton instance.
@@ -43,8 +43,9 @@ public final class StringValueTransformer implements Transformer, Serializable {
      * @return the singleton instance
      * @since Commons Collections 3.1
      */
-    public static Transformer getInstance() {
-        return INSTANCE;
+    @SuppressWarnings("unchecked")
+    public static <T> Transformer<T, String> getInstance() {
+        return (Transformer<T, String>) INSTANCE;
     }
 
     /**
@@ -60,7 +61,7 @@ public final class StringValueTransformer implements Transformer, Serializable {
      * @param input  the input object to transform
      * @return the transformed result
      */
-    public Object transform(Object input) {
+    public String transform(T input) {
         return String.valueOf(input);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/SwitchClosure.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/SwitchClosure.java b/src/java/org/apache/commons/collections/functors/SwitchClosure.java
index be64369..1ee7806 100644
--- a/src/java/org/apache/commons/collections/functors/SwitchClosure.java
+++ b/src/java/org/apache/commons/collections/functors/SwitchClosure.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.
@@ -17,7 +17,6 @@
 package org.apache.commons.collections.functors;
 
 import java.io.Serializable;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.commons.collections.Closure;
@@ -26,27 +25,27 @@ import org.apache.commons.collections.Predicate;
 /**
  * Closure implementation calls the closure whose predicate returns true,
  * like a switch statement.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
  * @author Stephen Colebourne
  */
-public class SwitchClosure implements Closure, Serializable {
+public class SwitchClosure<E> implements Closure<E>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = 3518477308466486130L;
 
     /** The tests to consider */
-    private final Predicate[] iPredicates;
+    private final Predicate<? super E>[] iPredicates;
     /** The matching closures to call */
-    private final Closure[] iClosures;
+    private final Closure<? super E>[] iClosures;
     /** The default closure to call if no tests match */
-    private final Closure iDefault;
+    private final Closure<? super E> iDefault;
 
     /**
      * Factory method that performs validation and copies the parameter arrays.
-     * 
+     *
      * @param predicates  array of predicates, cloned, no nulls
      * @param closures  matching array of closures, cloned, no nulls
      * @param defaultClosure  the closure to use if no match, null means nop
@@ -54,85 +53,82 @@ public class SwitchClosure implements Closure, Serializable {
      * @throws IllegalArgumentException if array is null
      * @throws IllegalArgumentException if any element in the array is null
      */
-    public static Closure getInstance(Predicate[] predicates, Closure[] closures, Closure defaultClosure) {
+    @SuppressWarnings("unchecked")
+    public static <E> Closure<E> getInstance(Predicate<? super E>[] predicates, Closure<? super E>[] closures, Closure<? super E> defaultClosure) {
         FunctorUtils.validate(predicates);
         FunctorUtils.validate(closures);
         if (predicates.length != closures.length) {
             throw new IllegalArgumentException("The predicate and closure arrays must be the same size");
         }
         if (predicates.length == 0) {
-            return (defaultClosure == null ? NOPClosure.INSTANCE : defaultClosure);
+            return (Closure<E>) (defaultClosure == null ? NOPClosure.<E>getInstance(): defaultClosure);
         }
         predicates = FunctorUtils.copy(predicates);
         closures = FunctorUtils.copy(closures);
-        return new SwitchClosure(predicates, closures, defaultClosure);
+        return new SwitchClosure<E>(predicates, closures, defaultClosure);
     }
 
     /**
-     * Create a new Closure that calls one of the closures depending 
-     * on the predicates. 
+     * Create a new Closure that calls one of the closures depending
+     * on the predicates.
      * <p>
-     * The Map consists of Predicate keys and Closure values. A closure 
+     * The Map consists of Predicate keys and Closure values. A closure
      * is called if its matching predicate returns true. Each predicate is evaluated
      * until one returns true. If no predicates evaluate to true, the default
-     * closure is called. The default closure is set in the map with a 
-     * null key. The ordering is that of the iterator() method on the entryset 
+     * closure is called. The default closure is set in the map with a
+     * null key. The ordering is that of the iterator() method on the entryset
      * collection of the map.
-     * 
+     *
      * @param predicatesAndClosures  a map of predicates to closures
      * @return the <code>switch</code> closure
      * @throws IllegalArgumentException if the map is null
      * @throws IllegalArgumentException if any closure in the map is null
      * @throws ClassCastException  if the map elements are of the wrong type
      */
-    public static Closure getInstance(Map predicatesAndClosures) {
-        Closure[] closures = null;
-        Predicate[] preds = null;
+    @SuppressWarnings("unchecked")
+    public static <E> Closure<E> getInstance(Map<Predicate<E>, Closure<E>> predicatesAndClosures) {
         if (predicatesAndClosures == null) {
             throw new IllegalArgumentException("The predicate and closure map must not be null");
         }
-        if (predicatesAndClosures.size() == 0) {
-            return NOPClosure.INSTANCE;
-        }
         // convert to array like this to guarantee iterator() ordering
-        Closure defaultClosure = (Closure) predicatesAndClosures.remove(null);
+        Closure<? super E> defaultClosure = predicatesAndClosures.remove(null);
         int size = predicatesAndClosures.size();
         if (size == 0) {
-            return (defaultClosure == null ? NOPClosure.INSTANCE : defaultClosure);
+            return (Closure<E>) (defaultClosure == null ? NOPClosure.<E>getInstance() : defaultClosure);
         }
-        closures = new Closure[size];
-        preds = new Predicate[size];
+        Closure<E>[] closures = new Closure[size];
+        Predicate<E>[] preds = new Predicate[size];
         int i = 0;
-        for (Iterator it = predicatesAndClosures.entrySet().iterator(); it.hasNext();) {
-            Map.Entry entry = (Map.Entry) it.next();
-            preds[i] = (Predicate) entry.getKey();
-            closures[i] = (Closure) entry.getValue();
+        for (Map.Entry<Predicate<E>, Closure<E>> entry : predicatesAndClosures.entrySet()) {
+            preds[i] = entry.getKey();
+            closures[i] = entry.getValue();
             i++;
         }
-        return new SwitchClosure(preds, closures, defaultClosure);
+        return new SwitchClosure<E>(preds, closures, defaultClosure);
     }
-    
+
     /**
      * Constructor that performs no validation.
      * Use <code>getInstance</code> if you want that.
-     * 
+     *
      * @param predicates  array of predicates, not cloned, no nulls
      * @param closures  matching array of closures, not cloned, no nulls
      * @param defaultClosure  the closure to use if no match, null means nop
      */
-    public SwitchClosure(Predicate[] predicates, Closure[] closures, Closure defaultClosure) {
+    @SuppressWarnings("unchecked")
+    public SwitchClosure(Predicate<? super E>[] predicates, Closure<? super E>[] closures, Closure<? super E> defaultClosure) {
         super();
         iPredicates = predicates;
         iClosures = closures;
-        iDefault = (defaultClosure == null ? NOPClosure.INSTANCE : defaultClosure);
+        iDefault = (Closure<? super E>) (defaultClosure == null ? NOPClosure.<E>getInstance() : defaultClosure);
     }
 
     /**
      * Executes the closure whose matching predicate returns true
-     * 
+     *
      * @param input  the input object
      */
-    public void execute(Object input) {
+    public void execute(E input) {
         for (int i = 0; i < iPredicates.length; i++) {
             if (iPredicates[i].evaluate(input) == true) {
                 iClosures[i].execute(input);
@@ -144,32 +140,32 @@ public class SwitchClosure implements Closure, Serializable {
 
     /**
      * Gets the predicates, do not modify the array.
-     * 
+     *
      * @return the predicates
      * @since Commons Collections 3.1
      */
-    public Predicate[] getPredicates() {
+    public Predicate<? super E>[] getPredicates() {
         return iPredicates;
     }
 
     /**
      * Gets the closures, do not modify the array.
-     * 
+     *
      * @return the closures
      * @since Commons Collections 3.1
      */
-    public Closure[] getClosures() {
+    public Closure<? super E>[] getClosures() {
         return iClosures;
     }
 
     /**
      * Gets the default closure.
-     * 
+     *
      * @return the default closure
      * @since Commons Collections 3.1
      */
-    public Closure getDefaultClosure() {
+    public Closure<? super E> getDefaultClosure() {
         return iDefault;
     }
-    
+
 }


[71/77] [abbrv] commons-collections git commit: Replacing '^ \* $' with '^ \*$' - to help with merging to trunk

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/set/PredicatedSet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/PredicatedSet.java b/src/java/org/apache/commons/collections/set/PredicatedSet.java
index 8b09fd1..6cfcb53 100644
--- a/src/java/org/apache/commons/collections/set/PredicatedSet.java
+++ b/src/java/org/apache/commons/collections/set/PredicatedSet.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.
@@ -36,7 +36,7 @@ import org.apache.commons.collections.collection.PredicatedCollection;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Paul Jack
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/set/PredicatedSortedSet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/PredicatedSortedSet.java b/src/java/org/apache/commons/collections/set/PredicatedSortedSet.java
index 7c5e2e9..6527b07 100644
--- a/src/java/org/apache/commons/collections/set/PredicatedSortedSet.java
+++ b/src/java/org/apache/commons/collections/set/PredicatedSortedSet.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.
@@ -36,7 +36,7 @@ import org.apache.commons.collections.Predicate;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Paul Jack
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/set/SynchronizedSet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/SynchronizedSet.java b/src/java/org/apache/commons/collections/set/SynchronizedSet.java
index 1bc69f1..464efd6 100644
--- a/src/java/org/apache/commons/collections/set/SynchronizedSet.java
+++ b/src/java/org/apache/commons/collections/set/SynchronizedSet.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,7 +30,7 @@ import org.apache.commons.collections.collection.SynchronizedCollection;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class SynchronizedSet<E> extends SynchronizedCollection<E> implements Set<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/set/TransformedSet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/TransformedSet.java b/src/java/org/apache/commons/collections/set/TransformedSet.java
index 2a90556..a6e6b44 100644
--- a/src/java/org/apache/commons/collections/set/TransformedSet.java
+++ b/src/java/org/apache/commons/collections/set/TransformedSet.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,10 +30,10 @@ import org.apache.commons.collections.collection.TransformedCollection;
  * use the Integer form to remove objects.
  * <p>
  * This class is Serializable from Commons Collections 3.1.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TransformedSet<E> extends TransformedCollection<E> implements Set<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/set/TransformedSortedSet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/TransformedSortedSet.java b/src/java/org/apache/commons/collections/set/TransformedSortedSet.java
index 7961faa..5903ea6 100644
--- a/src/java/org/apache/commons/collections/set/TransformedSortedSet.java
+++ b/src/java/org/apache/commons/collections/set/TransformedSortedSet.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,10 +30,10 @@ import org.apache.commons.collections.Transformer;
  * use the Integer form to remove objects.
  * <p>
  * This class is Serializable from Commons Collections 3.1.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TransformedSortedSet<E> extends TransformedSet<E> implements SortedSet<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/set/UnmodifiableSet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/UnmodifiableSet.java b/src/java/org/apache/commons/collections/set/UnmodifiableSet.java
index c3e126c..2eab62b 100644
--- a/src/java/org/apache/commons/collections/set/UnmodifiableSet.java
+++ b/src/java/org/apache/commons/collections/set/UnmodifiableSet.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,7 +30,7 @@ import org.apache.commons.collections.iterators.UnmodifiableIterator;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public final class UnmodifiableSet<E>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java b/src/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java
index 58cec6b..cf2e29f 100644
--- a/src/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java
+++ b/src/java/org/apache/commons/collections/set/UnmodifiableSortedSet.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.
@@ -34,7 +34,7 @@ import org.apache.commons.collections.iterators.UnmodifiableIterator;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public final class UnmodifiableSortedSet<E>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/AbstractTestObject.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/AbstractTestObject.java b/src/test/org/apache/commons/collections/AbstractTestObject.java
index f692def..90ba9ec 100644
--- a/src/test/org/apache/commons/collections/AbstractTestObject.java
+++ b/src/test/org/apache/commons/collections/AbstractTestObject.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.
@@ -39,7 +39,7 @@ import java.io.Serializable;
  * test case (method) your {@link Object} fails.
  *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Rodney Waldhoff
  * @author Stephen Colebourne
  * @author Anonymous

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/BulkTest.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/BulkTest.java b/src/test/org/apache/commons/collections/BulkTest.java
index fd19542..35cb267 100644
--- a/src/test/org/apache/commons/collections/BulkTest.java
+++ b/src/test/org/apache/commons/collections/BulkTest.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/LocalTestNode.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/LocalTestNode.java b/src/test/org/apache/commons/collections/LocalTestNode.java
index 6eb0138..47e0f8e 100644
--- a/src/test/org/apache/commons/collections/LocalTestNode.java
+++ b/src/test/org/apache/commons/collections/LocalTestNode.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,7 @@ package org.apache.commons.collections;
 
 /**
  * Class LocalTestNode, a helper class for TestDoubleOrderedMap
- * 
+ *
  * @version $Revision$ $Date$
  *
  * @author Marc Johnson (marcj at users dot sourceforge dot net)

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/MapPerformance.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/MapPerformance.java b/src/test/org/apache/commons/collections/MapPerformance.java
index a7f6e0a..126b367 100644
--- a/src/test/org/apache/commons/collections/MapPerformance.java
+++ b/src/test/org/apache/commons/collections/MapPerformance.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/TestAll.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestAll.java b/src/test/org/apache/commons/collections/TestAll.java
index 16f669d..134c10b 100644
--- a/src/test/org/apache/commons/collections/TestAll.java
+++ b/src/test/org/apache/commons/collections/TestAll.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,9 +24,9 @@ import org.junit.runners.Suite.SuiteClasses;
 
 /**
  * Entry point for all Collections package tests.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Rodney Waldhoff
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/TestAllPackages.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestAllPackages.java b/src/test/org/apache/commons/collections/TestAllPackages.java
index 48ec3d6..9439dd6 100644
--- a/src/test/org/apache/commons/collections/TestAllPackages.java
+++ b/src/test/org/apache/commons/collections/TestAllPackages.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.
@@ -22,9 +22,9 @@ import org.junit.runners.Suite.SuiteClasses;
 
 /**
  * Entry point for all Collections project tests.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Stephen Kestle
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/TestArrayStack.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestArrayStack.java b/src/test/org/apache/commons/collections/TestArrayStack.java
index 03a826a..ff99d82 100644
--- a/src/test/org/apache/commons/collections/TestArrayStack.java
+++ b/src/test/org/apache/commons/collections/TestArrayStack.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.
@@ -22,9 +22,9 @@ import junit.framework.Test;
 
 /**
  * Tests ArrayStack.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Craig McClanahan
  */
 public class TestArrayStack<E> extends TestArrayList<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/TestBufferUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestBufferUtils.java b/src/test/org/apache/commons/collections/TestBufferUtils.java
index 5d860b2..2697c61 100644
--- a/src/test/org/apache/commons/collections/TestBufferUtils.java
+++ b/src/test/org/apache/commons/collections/TestBufferUtils.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.
@@ -22,9 +22,9 @@ import org.apache.commons.collections.buffer.PredicatedBuffer;
 
 /**
  * Tests for BufferUtils.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Unknown
  */
 public class TestBufferUtils extends BulkTest {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/TestEnumerationUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestEnumerationUtils.java b/src/test/org/apache/commons/collections/TestEnumerationUtils.java
index 649ce0a..4f9e02f 100644
--- a/src/test/org/apache/commons/collections/TestEnumerationUtils.java
+++ b/src/test/org/apache/commons/collections/TestEnumerationUtils.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.
@@ -26,7 +26,7 @@ import junit.framework.Test;
 
 /**
  * Tests EnumerationUtils.
- * 
+ *
  * @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
  * @version $Id$
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/TestExtendedProperties.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestExtendedProperties.java b/src/test/org/apache/commons/collections/TestExtendedProperties.java
index 73621f5..0fff147 100644
--- a/src/test/org/apache/commons/collections/TestExtendedProperties.java
+++ b/src/test/org/apache/commons/collections/TestExtendedProperties.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.
@@ -27,9 +27,9 @@ import junit.framework.TestSuite;
 
 /**
  * Tests some basic functions of the ExtendedProperties class.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Geir Magnusson Jr.
  * @author Mohan Kishore
  * @author Stephen Colebourne

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/TestFactoryUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestFactoryUtils.java b/src/test/org/apache/commons/collections/TestFactoryUtils.java
index 257acef..5d8ef9f 100644
--- a/src/test/org/apache/commons/collections/TestFactoryUtils.java
+++ b/src/test/org/apache/commons/collections/TestFactoryUtils.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.
@@ -31,7 +31,7 @@ import org.junit.Test;
 
 /**
  * Tests the org.apache.commons.collections.FactoryUtils class.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/TestLinkedList.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestLinkedList.java b/src/test/org/apache/commons/collections/TestLinkedList.java
index 62e7166..ff045a0 100644
--- a/src/test/org/apache/commons/collections/TestLinkedList.java
+++ b/src/test/org/apache/commons/collections/TestLinkedList.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.list.AbstractTestList;
  * If your {@link LinkedList} fails one of these tests by design,
  * you may still use this base set of cases.  Simply override the
  * test case (method) your {@link List} fails.
- * 
+ *
  * @version $Revision$ $Date$
  *
  * @author Rich Dougherty

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/TestMapUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestMapUtils.java b/src/test/org/apache/commons/collections/TestMapUtils.java
index 6db8920..a91a50b 100644
--- a/src/test/org/apache/commons/collections/TestMapUtils.java
+++ b/src/test/org/apache/commons/collections/TestMapUtils.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/TestTypedCollection.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestTypedCollection.java b/src/test/org/apache/commons/collections/TestTypedCollection.java
index cd7f96c..167f666 100644
--- a/src/test/org/apache/commons/collections/TestTypedCollection.java
+++ b/src/test/org/apache/commons/collections/TestTypedCollection.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.
@@ -22,9 +22,9 @@ import java.util.List;
 
 /**
  * Tests TypedCollection.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public abstract class TestTypedCollection<T> extends BulkTest {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/bag/AbstractTestBag.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bag/AbstractTestBag.java b/src/test/org/apache/commons/collections/bag/AbstractTestBag.java
index 2ec00a0..b3f58e2 100644
--- a/src/test/org/apache/commons/collections/bag/AbstractTestBag.java
+++ b/src/test/org/apache/commons/collections/bag/AbstractTestBag.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.
@@ -38,7 +38,7 @@ import org.apache.commons.collections.Bag;
  * test case (method) your bag fails.
  *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Chuck Burdick
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/bag/AbstractTestSortedBag.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bag/AbstractTestSortedBag.java b/src/test/org/apache/commons/collections/bag/AbstractTestSortedBag.java
index 739d701..c530b63 100644
--- a/src/test/org/apache/commons/collections/bag/AbstractTestSortedBag.java
+++ b/src/test/org/apache/commons/collections/bag/AbstractTestSortedBag.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.
@@ -25,7 +25,7 @@ import org.apache.commons.collections.SortedBag;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public abstract class AbstractTestSortedBag<T> extends AbstractTestBag<T> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/bag/TestAll.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bag/TestAll.java b/src/test/org/apache/commons/collections/bag/TestAll.java
index 21b6040..a95b826 100644
--- a/src/test/org/apache/commons/collections/bag/TestAll.java
+++ b/src/test/org/apache/commons/collections/bag/TestAll.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.
@@ -22,10 +22,10 @@ import junit.framework.TestSuite;
 
 /**
  * Entry point for tests.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TestAll extends TestCase {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/bag/TestHashBag.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bag/TestHashBag.java b/src/test/org/apache/commons/collections/bag/TestHashBag.java
index 1e2b500..5997671 100644
--- a/src/test/org/apache/commons/collections/bag/TestHashBag.java
+++ b/src/test/org/apache/commons/collections/bag/TestHashBag.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,7 +24,7 @@ import org.apache.commons.collections.Bag;
 /**
  * Extension of {@link TestBag} for exercising the {@link HashBag}
  * implementation.
- * 
+ *
  * @version $Revision$ $Date$
  *
  * @author Chuck Burdick

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/bag/TestTreeBag.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bag/TestTreeBag.java b/src/test/org/apache/commons/collections/bag/TestTreeBag.java
index ce4f250..e14ff52 100644
--- a/src/test/org/apache/commons/collections/bag/TestTreeBag.java
+++ b/src/test/org/apache/commons/collections/bag/TestTreeBag.java
@@ -25,10 +25,10 @@ import org.apache.commons.collections.SortedBag;
 /**
  * Extension of {@link TestBag} for exercising the {@link TreeBag}
  * implementation.
- * 
+ *
  * @version $Revision$ $Date: 2006-10-27 19:52:37 -0500 (Fri, 27 Oct
  * 2006) $
- * 
+ *
  * @author Chuck Burdick
  */
 public class TestTreeBag<T> extends AbstractTestSortedBag<T> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/bidimap/TestAll.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bidimap/TestAll.java b/src/test/org/apache/commons/collections/bidimap/TestAll.java
index d155d40..930ac1f 100644
--- a/src/test/org/apache/commons/collections/bidimap/TestAll.java
+++ b/src/test/org/apache/commons/collections/bidimap/TestAll.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.
@@ -22,10 +22,10 @@ import junit.framework.TestSuite;
 
 /**
  * Entry point for tests.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TestAll extends TestCase {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/bidimap/TestDualHashBidiMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bidimap/TestDualHashBidiMap.java b/src/test/org/apache/commons/collections/bidimap/TestDualHashBidiMap.java
index af5c363..4ff34cb 100644
--- a/src/test/org/apache/commons/collections/bidimap/TestDualHashBidiMap.java
+++ b/src/test/org/apache/commons/collections/bidimap/TestDualHashBidiMap.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,9 +23,9 @@ import org.apache.commons.collections.BulkTest;
 
 /**
  * JUnit tests.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Matthew Hawthorne
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap.java b/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap.java
index 470d6c0..815b114 100644
--- a/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap.java
+++ b/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap.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,9 +23,9 @@ import org.apache.commons.collections.BulkTest;
 
 /**
  * JUnit tests.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Matthew Hawthorne
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java b/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java
index 74c7389..7f4909e 100644
--- a/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java
+++ b/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.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.
@@ -37,9 +37,9 @@ import org.apache.commons.collections.comparators.ReverseComparator;
 
 /**
  * JUnit tests.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Matthew Hawthorne
  * @author Stephen Colebourne
  * @author Jonas Van Poucke

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/bidimap/TestTreeBidiMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bidimap/TestTreeBidiMap.java b/src/test/org/apache/commons/collections/bidimap/TestTreeBidiMap.java
index 66def22..9923faa 100644
--- a/src/test/org/apache/commons/collections/bidimap/TestTreeBidiMap.java
+++ b/src/test/org/apache/commons/collections/bidimap/TestTreeBidiMap.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.
@@ -26,9 +26,9 @@ import org.apache.commons.collections.BulkTest;
 
 /**
  * JUnit tests.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TestTreeBidiMap<K extends Comparable<K>, V extends Comparable<V>> extends AbstractTestOrderedBidiMap<K, V> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/buffer/TestAll.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/buffer/TestAll.java b/src/test/org/apache/commons/collections/buffer/TestAll.java
index 74c4b2a..26a4aca 100644
--- a/src/test/org/apache/commons/collections/buffer/TestAll.java
+++ b/src/test/org/apache/commons/collections/buffer/TestAll.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.
@@ -22,10 +22,10 @@ import junit.framework.TestSuite;
 
 /**
  * Entry point for tests.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TestAll extends TestCase {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/buffer/TestBlockingBuffer.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/buffer/TestBlockingBuffer.java b/src/test/org/apache/commons/collections/buffer/TestBlockingBuffer.java
index 2860de5..d92d77d 100644
--- a/src/test/org/apache/commons/collections/buffer/TestBlockingBuffer.java
+++ b/src/test/org/apache/commons/collections/buffer/TestBlockingBuffer.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.
@@ -31,7 +31,7 @@ import java.util.Set;
 /**
  * Extension of {@link AbstractTestObject} for exercising the
  * {@link BlockingBuffer} implementation.
- * 
+ *
  * @author Janek Bogucki
  * @author Phil Steitz
  * @version $Revision$

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/buffer/TestBoundedBuffer.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/buffer/TestBoundedBuffer.java b/src/test/org/apache/commons/collections/buffer/TestBoundedBuffer.java
index 057f469..849a54c 100644
--- a/src/test/org/apache/commons/collections/buffer/TestBoundedBuffer.java
+++ b/src/test/org/apache/commons/collections/buffer/TestBoundedBuffer.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/buffer/TestBoundedFifoBuffer2.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/buffer/TestBoundedFifoBuffer2.java b/src/test/org/apache/commons/collections/buffer/TestBoundedFifoBuffer2.java
index 7efcbd1..3e5d55b 100644
--- a/src/test/org/apache/commons/collections/buffer/TestBoundedFifoBuffer2.java
+++ b/src/test/org/apache/commons/collections/buffer/TestBoundedFifoBuffer2.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.
@@ -27,9 +27,9 @@ import org.apache.commons.collections.BulkTest;
 /**
  * Runs tests against a full BoundedFifoBuffer, since many of the algorithms
  * differ depending on whether the fifo is full or not.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Unknown
  */
 public class TestBoundedFifoBuffer2<E> extends TestBoundedFifoBuffer<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/buffer/TestTransformedBuffer.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/buffer/TestTransformedBuffer.java b/src/test/org/apache/commons/collections/buffer/TestTransformedBuffer.java
index d1498a1..78aa3e8 100644
--- a/src/test/org/apache/commons/collections/buffer/TestTransformedBuffer.java
+++ b/src/test/org/apache/commons/collections/buffer/TestTransformedBuffer.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,7 +30,7 @@ import org.apache.commons.collections.collection.TestTransformedCollection;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TestTransformedBuffer extends TestCase {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/buffer/TestUnboundedFifoBuffer.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/buffer/TestUnboundedFifoBuffer.java b/src/test/org/apache/commons/collections/buffer/TestUnboundedFifoBuffer.java
index a45248d..b696396 100644
--- a/src/test/org/apache/commons/collections/buffer/TestUnboundedFifoBuffer.java
+++ b/src/test/org/apache/commons/collections/buffer/TestUnboundedFifoBuffer.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.
@@ -28,9 +28,9 @@ import org.apache.commons.collections.collection.AbstractTestCollection;
 
 /**
  * Test cases for UnboundedFifoBuffer.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Unknown
  */
 public class TestUnboundedFifoBuffer<E> extends AbstractTestCollection<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/collection/TestAll.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/collection/TestAll.java b/src/test/org/apache/commons/collections/collection/TestAll.java
index 3262105..55c0e8d 100644
--- a/src/test/org/apache/commons/collections/collection/TestAll.java
+++ b/src/test/org/apache/commons/collections/collection/TestAll.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.
@@ -22,10 +22,10 @@ import junit.framework.TestSuite;
 
 /**
  * Entry point for tests.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TestAll extends TestCase {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/collection/TestTransformedCollection.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/collection/TestTransformedCollection.java b/src/test/org/apache/commons/collections/collection/TestTransformedCollection.java
index 6706624..5f92783 100644
--- a/src/test/org/apache/commons/collections/collection/TestTransformedCollection.java
+++ b/src/test/org/apache/commons/collections/collection/TestTransformedCollection.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.TransformerUtils;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TestTransformedCollection extends AbstractTestCollection<Object> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java b/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java
index 3ebe3eb..fb87988 100644
--- a/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java
+++ b/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.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.
@@ -31,7 +31,7 @@ import org.apache.commons.collections.AbstractTestObject;
  * <p>
  * Concrete subclasses declare the comparator to be tested.
  * They also declare certain aspects of the tests.
- * 
+ *
  * @author Stephen Colebourne
  */
 public abstract class AbstractTestComparator<T> extends AbstractTestObject {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/comparators/TestAll.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/comparators/TestAll.java b/src/test/org/apache/commons/collections/comparators/TestAll.java
index 63a9ecc..e9b36f6 100644
--- a/src/test/org/apache/commons/collections/comparators/TestAll.java
+++ b/src/test/org/apache/commons/collections/comparators/TestAll.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.
@@ -22,9 +22,9 @@ import junit.framework.TestSuite;
 
 /**
  * Entry point for all Comparator Collections tests.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TestAll extends TestCase {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/comparators/TestComparableComparator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/comparators/TestComparableComparator.java b/src/test/org/apache/commons/collections/comparators/TestComparableComparator.java
index 90d6c8d..6b199c5 100644
--- a/src/test/org/apache/commons/collections/comparators/TestComparableComparator.java
+++ b/src/test/org/apache/commons/collections/comparators/TestComparableComparator.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.
@@ -25,9 +25,9 @@ import junit.framework.TestSuite;
 
 /**
  * Tests for ComparableComparator.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Unknown
  */
 public class TestComparableComparator extends AbstractTestComparator<Integer> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/iterators/AbstractTestIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/AbstractTestIterator.java b/src/test/org/apache/commons/collections/iterators/AbstractTestIterator.java
index 695aee8..53be5a7 100644
--- a/src/test/org/apache/commons/collections/iterators/AbstractTestIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/AbstractTestIterator.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.
@@ -28,10 +28,10 @@ import org.apache.commons.collections.AbstractTestObject;
  * Concrete subclasses must provide the iterator to be tested.
  * They must also specify certain details of how the iterator operates by
  * overriding the supportsXxx() methods if necessary.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Morgan Delagrange
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/iterators/TestAll.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestAll.java b/src/test/org/apache/commons/collections/iterators/TestAll.java
index ac20c46..d8e113f 100644
--- a/src/test/org/apache/commons/collections/iterators/TestAll.java
+++ b/src/test/org/apache/commons/collections/iterators/TestAll.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.
@@ -22,9 +22,9 @@ import junit.framework.TestSuite;
 
 /**
  * Entry point for all iterator tests.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Rodney Waldhoff
  */
 public class TestAll extends TestCase {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/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 44a3efc..6a585d1 100644
--- a/src/test/org/apache/commons/collections/iterators/TestArrayIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestArrayIterator.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.
@@ -26,9 +26,9 @@ import junit.framework.TestSuite;
  * Tests the ArrayIterator to ensure that the next() method will actually
  * perform the iteration rather than the hasNext() method.
  * The code of this test was supplied by Mauricio S. Moura.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author James Strachan
  * @author Mauricio S. Moura
  * @author Morgan Delagrange

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/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 1c70fe2..621ae5a 100644
--- a/src/test/org/apache/commons/collections/iterators/TestArrayListIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestArrayListIterator.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.
@@ -25,7 +25,7 @@ import junit.framework.TestSuite;
 
 /**
  * Test the ArrayListIterator class.
- * 
+ *
  * @version $Revision$ $Date$
  * @author Neil O'Toole
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/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 cb2ea8c..83d9b96 100644
--- a/src/test/org/apache/commons/collections/iterators/TestArrayListIterator2.java
+++ b/src/test/org/apache/commons/collections/iterators/TestArrayListIterator2.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.
@@ -21,7 +21,7 @@ import junit.framework.TestSuite;
 
 /**
  * Test the ArrayListIterator class with primitives.
- * 
+ *
  * @version $Revision$ $Date$
  * @author Neil O'Toole
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/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 e0bab72..a350856 100644
--- a/src/test/org/apache/commons/collections/iterators/TestFilterListIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestFilterListIterator.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,9 +29,9 @@ import org.apache.commons.collections.Predicate;
 
 /**
  * Tests the FilterListIterator class.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Rodney Waldhoff
  */
 public class TestFilterListIterator extends TestCase {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/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 eb3ed5e..9999c08 100644
--- a/src/test/org/apache/commons/collections/iterators/TestIteratorChain.java
+++ b/src/test/org/apache/commons/collections/iterators/TestIteratorChain.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,9 +29,9 @@ import org.apache.commons.collections.Predicate;
 
 /**
  * Tests the IteratorChain class.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author James Strachan
  * @author Mauricio S. Moura
  * @author Morgan Delagrange

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/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 8571356..1050801 100644
--- a/src/test/org/apache/commons/collections/iterators/TestListIteratorWrapper.java
+++ b/src/test/org/apache/commons/collections/iterators/TestListIteratorWrapper.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/iterators/TestListIteratorWrapper2.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestListIteratorWrapper2.java b/src/test/org/apache/commons/collections/iterators/TestListIteratorWrapper2.java
index acad9fe..aad138d 100644
--- a/src/test/org/apache/commons/collections/iterators/TestListIteratorWrapper2.java
+++ b/src/test/org/apache/commons/collections/iterators/TestListIteratorWrapper2.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/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 dfa572c..655e1cd 100644
--- a/src/test/org/apache/commons/collections/iterators/TestLoopingIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestLoopingIterator.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.
@@ -27,9 +27,9 @@ import junit.framework.TestSuite;
 
 /**
  * Tests the LoopingIterator class.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Jonathan Carlson
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/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 9f4e2ce..954d519 100644
--- a/src/test/org/apache/commons/collections/iterators/TestLoopingListIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestLoopingListIterator.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/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 13f270a..797cea8 100644
--- a/src/test/org/apache/commons/collections/iterators/TestObjectArrayIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestObjectArrayIterator.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,9 +24,9 @@ import junit.framework.TestSuite;
 
 /**
  * Tests the ObjectArrayIterator.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author James Strachan
  * @author Mauricio S. Moura
  * @author Morgan Delagrange

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/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 01c3bc6..ccd29ff 100644
--- a/src/test/org/apache/commons/collections/iterators/TestObjectArrayListIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestObjectArrayListIterator.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.
@@ -25,9 +25,9 @@ import junit.framework.TestSuite;
 
 /**
  * Tests the ObjectArrayListIterator class.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Neil O'Toole
  */
 public class TestObjectArrayListIterator<E> extends TestObjectArrayIterator<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/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 69d0e3d..1aaab9b 100644
--- a/src/test/org/apache/commons/collections/iterators/TestObjectGraphIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestObjectGraphIterator.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,9 +30,9 @@ import org.apache.commons.collections.Transformer;
 
 /**
  * Testcase.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TestObjectGraphIterator extends AbstractTestIterator<Object> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/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 e76378d..f5cbf6e 100644
--- a/src/test/org/apache/commons/collections/iterators/TestSingletonIterator2.java
+++ b/src/test/org/apache/commons/collections/iterators/TestSingletonIterator2.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,7 +29,7 @@ import org.apache.commons.collections.ResettableIterator;
  * perform the iteration rather than the hasNext() method.
  *
  * @version $Revision$ $Date$
- * 
+ *
  * @author James Strachan
  */
 public class TestSingletonIterator2<E> extends AbstractTestIterator<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/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 3cbf500..455b8ba 100644
--- a/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.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.
@@ -28,7 +28,7 @@ import org.apache.commons.collections.ResettableListIterator;
  * Tests the SingletonListIterator.
  *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TestSingletonListIterator<E> extends AbstractTestListIterator<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/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 ba86b51..efe6d30 100644
--- a/src/test/org/apache/commons/collections/iterators/TestUniqueFilterIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestUniqueFilterIterator.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.
@@ -26,9 +26,9 @@ import junit.framework.TestSuite;
 
 /**
  * Tests the UniqueFilterIterator class.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author James Strachan
  * @author Mauricio S. Moura
  * @author Morgan Delagrange

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/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 828db76..0500955 100644
--- a/src/test/org/apache/commons/collections/iterators/TestUnmodifiableMapIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestUnmodifiableMapIterator.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/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 5ae427a..227077d 100644
--- a/src/test/org/apache/commons/collections/keyvalue/AbstractTestMapEntry.java
+++ b/src/test/org/apache/commons/collections/keyvalue/AbstractTestMapEntry.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.
@@ -27,10 +27,10 @@ import junit.framework.TestCase;
  * a new Map.Entry of the type being tested. Subclasses must also implement
  * {@link #testConstructors()} to test the constructors of the Map.Entry
  * type being tested.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Neil O'Toole
  */
 public abstract class AbstractTestMapEntry<K, V> extends TestCase {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/keyvalue/TestAll.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/keyvalue/TestAll.java b/src/test/org/apache/commons/collections/keyvalue/TestAll.java
index e61e38f..88f84c3 100644
--- a/src/test/org/apache/commons/collections/keyvalue/TestAll.java
+++ b/src/test/org/apache/commons/collections/keyvalue/TestAll.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.
@@ -22,10 +22,10 @@ import junit.framework.TestSuite;
 
 /**
  * Entry point for key-value test cases.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Neil O'Toole
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/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 b820959..7115613 100644
--- a/src/test/org/apache/commons/collections/keyvalue/TestDefaultKeyValue.java
+++ b/src/test/org/apache/commons/collections/keyvalue/TestDefaultKeyValue.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.
@@ -25,10 +25,10 @@ import junit.framework.TestSuite;
 
 /**
  * Test the DefaultKeyValue class.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Neil O'Toole
  */
 public class TestDefaultKeyValue<K, V> extends TestCase {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/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 cba3503..fa3e4b6 100644
--- a/src/test/org/apache/commons/collections/keyvalue/TestDefaultMapEntry.java
+++ b/src/test/org/apache/commons/collections/keyvalue/TestDefaultMapEntry.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.
@@ -25,10 +25,10 @@ import org.apache.commons.collections.KeyValue;
 
 /**
  * Test the DefaultMapEntry class.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Neil O'Toole
  */
 public class TestDefaultMapEntry<K, V> extends AbstractTestMapEntry<K, V> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/list/TestAll.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/list/TestAll.java b/src/test/org/apache/commons/collections/list/TestAll.java
index 562be42..549b548 100644
--- a/src/test/org/apache/commons/collections/list/TestAll.java
+++ b/src/test/org/apache/commons/collections/list/TestAll.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.
@@ -22,10 +22,10 @@ import junit.framework.TestSuite;
 
 /**
  * Entry point for tests.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TestAll extends TestCase {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/list/TestGrowthList.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/list/TestGrowthList.java b/src/test/org/apache/commons/collections/list/TestGrowthList.java
index 1b6e1a7..fdaccf0 100644
--- a/src/test/org/apache/commons/collections/list/TestGrowthList.java
+++ b/src/test/org/apache/commons/collections/list/TestGrowthList.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,7 +29,7 @@ import junit.framework.TestSuite;
  *
  * @since Commons Collections 3.2
  * @version $Revision: 155406 $ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TestGrowthList<E> extends AbstractTestList<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/map/TestAll.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestAll.java b/src/test/org/apache/commons/collections/map/TestAll.java
index 711b089..91f070b 100644
--- a/src/test/org/apache/commons/collections/map/TestAll.java
+++ b/src/test/org/apache/commons/collections/map/TestAll.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,10 +24,10 @@ import org.junit.runners.Suite.SuiteClasses;
 
 /**
  * Entry point for tests.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Stephen Kestle
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/map/TestCompositeMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestCompositeMap.java b/src/test/org/apache/commons/collections/map/TestCompositeMap.java
index 0f89192..f538484 100644
--- a/src/test/org/apache/commons/collections/map/TestCompositeMap.java
+++ b/src/test/org/apache/commons/collections/map/TestCompositeMap.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/map/TestLazySortedMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestLazySortedMap.java b/src/test/org/apache/commons/collections/map/TestLazySortedMap.java
index 02ca1d4..f9e7cfe 100644
--- a/src/test/org/apache/commons/collections/map/TestLazySortedMap.java
+++ b/src/test/org/apache/commons/collections/map/TestLazySortedMap.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.
@@ -35,7 +35,7 @@ import org.junit.Test;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  */
 public class TestLazySortedMap<K, V> extends AbstractTestSortedMap<K, V> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/set/AbstractTestSet.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/AbstractTestSet.java b/src/test/org/apache/commons/collections/set/AbstractTestSet.java
index 46f1649..136ac7a 100644
--- a/src/test/org/apache/commons/collections/set/AbstractTestSet.java
+++ b/src/test/org/apache/commons/collections/set/AbstractTestSet.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.
@@ -40,7 +40,7 @@ import org.apache.commons.collections.collection.AbstractTestCollection;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Paul Jack
  */
 public abstract class AbstractTestSet<E> extends AbstractTestCollection<E> {


[62/77] [abbrv] commons-collections git commit: [COLLECTIONS-182] return Closure from CollectionUtils.forAllDo

Posted by ch...@apache.org.
[COLLECTIONS-182] return Closure from CollectionUtils.forAllDo

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@813925 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/dabd2401
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/dabd2401
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/dabd2401

Branch: refs/heads/collections_jdk5_branch
Commit: dabd2401bd294bf33ffef9fbc10dd732a4ac4bf2
Parents: df940e0
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Fri Sep 11 17:05:31 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Fri Sep 11 17:05:31 2009 +0000

----------------------------------------------------------------------
 .../commons/collections/CollectionUtils.java    | 150 ++++++++++---------
 .../collections/TestCollectionUtils.java        |  23 +--
 2 files changed, 89 insertions(+), 84 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/dabd2401/src/java/org/apache/commons/collections/CollectionUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/CollectionUtils.java b/src/java/org/apache/commons/collections/CollectionUtils.java
index 1208eb4..cf34edc 100644
--- a/src/java/org/apache/commons/collections/CollectionUtils.java
+++ b/src/java/org/apache/commons/collections/CollectionUtils.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.
@@ -37,10 +37,10 @@ import org.apache.commons.collections.collection.UnmodifiableCollection;
 /**
  * Provides utility methods and decorators for {@link Collection} instances.
  * Method parameters will take {@link Iterable} objects when possible.
- * 
+ *
  * @since Commons Collections 1.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Rodney Waldhoff
  * @author Paul Jack
  * @author Stephen Colebourne
@@ -62,16 +62,16 @@ public class CollectionUtils {
 
     private static class CardinalityHelper<O> {
         final Map<O, Integer> cardinalityA, cardinalityB;
-        
+
         public CardinalityHelper(Iterable<? extends O> a, Iterable<? extends O> b) {
             cardinalityA = CollectionUtils.<O>getCardinalityMap(a);
             cardinalityB = CollectionUtils.<O>getCardinalityMap(b);
         }
-        
+
         public final int max(Object obj) {
             return Math.max(freqA(obj), freqB(obj));
         }
-        
+
         public final int min(Object obj) {
             return Math.min(freqA(obj), freqB(obj));
         }
@@ -79,11 +79,11 @@ public class CollectionUtils {
         public int freqA(Object obj) {
             return getFreq(obj, cardinalityA);
         }
-        
+
         public int freqB(Object obj) {
             return getFreq(obj, cardinalityB);
         }
-        
+
         private final int getFreq(final Object obj, final Map<?, Integer> freqMap) {
             Integer count = freqMap.get(obj);
             if (count != null) {
@@ -92,7 +92,7 @@ public class CollectionUtils {
             return 0;
         }
     }
-    
+
     private static class SetOperationCardinalityHelper<O> extends CardinalityHelper<O> implements Iterable<O> {
         private final Set<O> elements;
         private final List<O> newList;
@@ -138,7 +138,7 @@ public class CollectionUtils {
 
     /**
      * Returns the immutable EMPTY_COLLECTION with generic type safety.
-     * 
+     *
      * @see #EMPTY_COLLECTION
      * @since 4.0
      * @return immutable empty collection
@@ -155,7 +155,7 @@ public class CollectionUtils {
      * The cardinality of each element in the returned {@link Collection} will
      * be equal to the maximum of the cardinality of that element in the two
      * given {@link Collection}s.
-     * 
+     *
      * @param a the first collection, must not be null
      * @param b the second collection, must not be null
      * @param <O> the generic type that is able to represent the types contained
@@ -178,7 +178,7 @@ public class CollectionUtils {
      * The cardinality of each element in the returned {@link Collection} will
      * be equal to the minimum of the cardinality of that element in the two
      * given {@link Collection}s.
-     * 
+     *
      * @param a the first collection, must not be null
      * @param b the second collection, must not be null
      * @param <O> the generic type that is able to represent the types contained
@@ -207,7 +207,7 @@ public class CollectionUtils {
      * <tt>{@link #subtract subtract}({@link #union union(a,b)},{@link #intersection intersection(a,b)})</tt>
      * or
      * <tt>{@link #union union}({@link #subtract subtract(a,b)},{@link #subtract subtract(b,a)})</tt>.
-     
+
      * @param a the first collection, must not be null
      * @param b the second collection, must not be null
      * @param <O> the generic type that is able to represent the types contained
@@ -280,7 +280,7 @@ public class CollectionUtils {
      * <p>
      * Only those elements present in the collection will appear as
      * keys in the map.
-     * 
+     *
      * @param coll
      *            the collection to get the cardinality map for, must not be
      *            null
@@ -309,7 +309,7 @@ public class CollectionUtils {
      * that is, iff the cardinality of <i>e</i> in <i>a</i> is less than or
      * equal to the cardinality of <i>e</i> in <i>b</i>, for each element <i>e</i>
      * in <i>a</i>.
-     * 
+     *
      * @param a the first (sub?) collection, must not be null
      * @param b the second (super?) collection, must not be null
      * @return <code>true</code> iff <i>a</i> is a sub-collection of <i>b</i>
@@ -336,7 +336,7 @@ public class CollectionUtils {
      * <p>
      * The implementation assumes
      * <ul>
-     *    <li><code>a.size()</code> and <code>b.size()</code> represent the 
+     *    <li><code>a.size()</code> and <code>b.size()</code> represent the
      *    total cardinality of <i>a</i> and <i>b</i>, resp. </li>
      *    <li><code>a.size() < Integer.MAXVALUE</code></li>
      * </ul>
@@ -381,7 +381,7 @@ public class CollectionUtils {
 
     /**
      * Returns the number of occurrences of <i>obj</i> in <i>coll</i>.
-     * 
+     *
      * @param obj the object to find the cardinality of
      * @param coll the {@link Iterable} to search
      * @param <O> the type of object that the {@link Iterable} may contain.
@@ -411,10 +411,10 @@ public class CollectionUtils {
         return count;
     }
 
-    /** 
+    /**
      * Finds the first element in the given collection which matches the given predicate.
      * <p>
-     * If the input collection or predicate is null, or no element of the collection 
+     * If the input collection or predicate is null, or no element of the collection
      * matches the predicate, null is returned.
      *
      * @param collection  the collection to search, may be null
@@ -436,18 +436,20 @@ public class CollectionUtils {
      * Executes the given closure on each element in the collection.
      * <p>
      * If the input collection or closure is null, there is no change made.
-     * 
+     *
      * @param collection
      *            the collection to get the input from, may be null
      * @param closure
      *            the closure to perform, may be null
+     * @return closure
      */
-    public static <T> void forAllDo(Collection<T> collection, Closure<? super T> closure) {
+    public static <T, C extends Closure<? super T>> C forAllDo(Collection<T> collection, C closure) {
         if (collection != null && closure != null) {
             for (T element : collection) {
                 closure.execute(element);
             }
         }
+        return closure;
     }
 
     /**
@@ -455,7 +457,7 @@ public class CollectionUtils {
      * predicate returns false, remove the element.
      * <p>
      * If the input collection or predicate is null, there is no change made.
-     * 
+     *
      * @param collection
      *            the collection to get the input from, may be null
      * @param predicate
@@ -483,7 +485,7 @@ public class CollectionUtils {
      * If the input collection controls its input, such as a Set, and the
      * Transformer creates duplicates (or are otherwise invalid), the collection
      * may reduce in size due to calling this method.
-     * 
+     *
      * @param collection
      *            the {@link Iterable} to get the input from, may be null
      * @param transformer
@@ -510,7 +512,7 @@ public class CollectionUtils {
      * predicate.
      * <p>
      * A <code>null</code> collection or predicate matches no elements.
-     * 
+     *
      * @param input
      *            the {@link Iterable} to get the input from, may be null
      * @param predicate
@@ -534,7 +536,7 @@ public class CollectionUtils {
      * collection.
      * <p>
      * A <code>null</code> collection or predicate returns false.
-     * 
+     *
      * @param input
      *            the {@link Iterable} to get the input from, may be null
      * @param predicate
@@ -558,7 +560,7 @@ public class CollectionUtils {
      * predicate into an output collection.
      * <p>
      * A <code>null</code> predicate matches no elements.
-     * 
+     *
      * @param inputCollection
      *            the collection to get the input from, may not be null
      * @param predicate
@@ -578,7 +580,7 @@ public class CollectionUtils {
      * <p>
      * If the input collection or predicate is null, there is no change to the
      * output collection.
-     * 
+     *
      * @param inputCollection
      *            the collection to get the input from, may be null
      * @param predicate
@@ -605,7 +607,7 @@ public class CollectionUtils {
      * <p>
      * If the input predicate is <code>null</code>, the result is an empty
      * list.
-     * 
+     *
      * @param inputCollection
      *            the collection to get the input from, may not be null
      * @param predicate
@@ -625,7 +627,7 @@ public class CollectionUtils {
      * <p>
      * If the input predicate is <code>null</code>, no elements are added to
      * <code>outputCollection</code>.
-     * 
+     *
      * @param inputCollection
      *            the collection to get the input from, may be null
      * @param predicate
@@ -651,7 +653,7 @@ public class CollectionUtils {
      * transformed by the given transformer.
      * <p>
      * If the input transformer is null, the result is an empty list.
-     * 
+     *
      * @param inputCollection
      *            the collection to get the input from, may not be null
      * @param transformer
@@ -675,7 +677,7 @@ public class CollectionUtils {
      * <p>
      * If the input iterator or transformer is null, the result is an empty
      * list.
-     * 
+     *
      * @param inputIterator
      *            the iterator to get the input from, may be null
      * @param transformer
@@ -690,12 +692,12 @@ public class CollectionUtils {
         collect(inputIterator, transformer, answer);
         return answer;
     }
-    
-    /** 
-     * Transforms all elements from inputCollection with the given transformer 
+
+    /**
+     * Transforms all elements from inputCollection with the given transformer
      * and adds them to the outputCollection.
      * <p>
-     * If the input collection or transformer is null, there is no change to the 
+     * If the input collection or transformer is null, there is no change to the
      * output collection.
      *
      * @param inputCollection  the collection to get the input from, may be null
@@ -715,11 +717,11 @@ public class CollectionUtils {
         return outputCollection;
     }
 
-    /** 
-     * Transforms all elements from the inputIterator with the given transformer 
+    /**
+     * Transforms all elements from the inputIterator with the given transformer
      * and adds them to the outputCollection.
      * <p>
-     * If the input iterator or transformer is null, there is no change to the 
+     * If the input iterator or transformer is null, there is no change to the
      * output collection.
      *
      * @param inputIterator  the iterator to get the input from, may be null
@@ -747,7 +749,7 @@ public class CollectionUtils {
     //-----------------------------------------------------------------------
     /**
      * Adds an element to the collection unless the element is null.
-     * 
+     *
      * @param collection  the collection to add to, must not be null
      * @param object  the object to add, if null it will not be added
      * @return true if the collection changed
@@ -762,7 +764,7 @@ public class CollectionUtils {
      * Adds all elements in the {@link Iterable} to the given collection. If the
      * {@link Iterable} is a {@link Collection} then it is cast and will be
      * added using {@link Collection#addAll(Collection)} instead of iterating.
-     * 
+     *
      * @param collection
      *            the collection to add to, must not be null
      * @param iterable
@@ -780,7 +782,7 @@ public class CollectionUtils {
 
     /**
      * Adds all elements in the iteration to the given collection.
-     * 
+     *
      * @param collection
      *            the collection to add to, must not be null
      * @param iterator
@@ -799,7 +801,7 @@ public class CollectionUtils {
 
     /**
      * Adds all elements in the enumeration to the given collection.
-     * 
+     *
      * @param collection  the collection to add to, must not be null
      * @param enumeration  the enumeration of elements to add, must not be null
      * @throws NullPointerException if the collection or enumeration is null
@@ -813,7 +815,7 @@ public class CollectionUtils {
 
     /**
      * Adds all elements in the array to the given collection.
-     * 
+     *
      * @param collection
      *            the collection to add to, must not be null
      * @param elements
@@ -830,10 +832,10 @@ public class CollectionUtils {
     /**
      * Returns the <code>index</code>-th value in {@link Iterator}, throwing
      * <code>IndexOutOfBoundsException</code> if there is no such element.
-     * The Iterator is advanced to 
-     *      <code>index</code> (or to the end, if <code>index</code> exceeds the 
+     * The Iterator is advanced to
+     *      <code>index</code> (or to the end, if <code>index</code> exceeds the
      *      number of entries) as a side effect of this method.</li>
-     * 
+     *
      * @param iterator  the iterator to get a value from
      * @param index  the index to get
      * @param <T> the type of object in the {@link Iterator}
@@ -864,13 +866,13 @@ public class CollectionUtils {
             throw new IndexOutOfBoundsException("Index cannot be negative: " + index);
         }
     }
-    
+
     /**
      * Returns the <code>index</code>-th value in the <code>iterable</code>'s {@link Iterator}, throwing
      * <code>IndexOutOfBoundsException</code> if there is no such element.
      * <p>
      * If the {@link Iterable} is a {@link List}, then it will use {@link List#get(int)}.
-     * 
+     *
      * @param iterable  the {@link Iterable} to get a value from
      * @param index  the index to get
      * @param <T> the type of object in the {@link Iterable}.
@@ -884,31 +886,31 @@ public class CollectionUtils {
         }
         return get(iterable.iterator(), index);
     }
-    
+
     /**
      * Returns the <code>index</code>-th value in <code>object</code>, throwing
-     * <code>IndexOutOfBoundsException</code> if there is no such element or 
-     * <code>IllegalArgumentException</code> if <code>object</code> is not an 
+     * <code>IndexOutOfBoundsException</code> if there is no such element or
+     * <code>IllegalArgumentException</code> if <code>object</code> is not an
      * instance of one of the supported types.
      * <p>
      * The supported types, and associated semantics are:
      * <ul>
-     * <li> Map -- the value returned is the <code>Map.Entry</code> in position 
-     *      <code>index</code> in the map's <code>entrySet</code> iterator, 
+     * <li> Map -- the value returned is the <code>Map.Entry</code> in position
+     *      <code>index</code> in the map's <code>entrySet</code> iterator,
      *      if there is such an entry.</li>
      * <li> List -- this method is equivalent to the list's get method.</li>
-     * <li> Array -- the <code>index</code>-th array entry is returned, 
+     * <li> Array -- the <code>index</code>-th array entry is returned,
      *      if there is such an entry; otherwise an <code>IndexOutOfBoundsException</code>
      *      is thrown.</li>
-     * <li> Collection -- the value returned is the <code>index</code>-th object 
+     * <li> Collection -- the value returned is the <code>index</code>-th object
      *      returned by the collection's default iterator, if there is such an element.</li>
      * <li> Iterator or Enumeration -- the value returned is the
      *      <code>index</code>-th object in the Iterator/Enumeration, if there
-     *      is such an element.  The Iterator/Enumeration is advanced to 
-     *      <code>index</code> (or to the end, if <code>index</code> exceeds the 
+     *      is such an element.  The Iterator/Enumeration is advanced to
+     *      <code>index</code> (or to the end, if <code>index</code> exceeds the
      *      number of entries) as a side effect of this method.</li>
      * </ul>
-     * 
+     *
      * @param object  the object to get a value from
      * @param index  the index to get
      * @return the object at the specified index
@@ -964,7 +966,7 @@ public class CollectionUtils {
     /**
      * Returns the <code>index</code>-th <code>Map.Entry</code> in the <code>map</code>'s <code>entrySet</code>, throwing
      * <code>IndexOutOfBoundsException</code> if there is no such element.
-     * 
+     *
      * @param map  the object to get a value from
      * @param index  the index to get
      * @return the object at the specified index
@@ -974,8 +976,8 @@ public class CollectionUtils {
         checkIndexBounds(index);
         return get(map.entrySet(), index);
     }
-    
-    /** 
+
+    /**
      * Gets the size of the collection/iterator specified.
      * <p>
      * This method can handles objects as follows
@@ -986,7 +988,7 @@ public class CollectionUtils {
      * <li>Iterator - the number of elements remaining in the iterator
      * <li>Enumeration - the number of elements remaining in the enumeration
      * </ul>
-     * 
+     *
      * @param object  the object to get the size of
      * @return the size of the specified collection
      * @throws IllegalArgumentException thrown if object is not recognised or null
@@ -1038,7 +1040,7 @@ public class CollectionUtils {
      * <p>
      * Note: This method is named to avoid clashing with
      * {@link #isEmpty(Collection)}.
-     * 
+     *
      * @param object  the object to get the size of, not null
      * @return true if empty
      * @throws IllegalArgumentException thrown if object is not recognised or null
@@ -1071,7 +1073,7 @@ public class CollectionUtils {
      * Null-safe check if the specified collection is empty.
      * <p>
      * Null returns true.
-     * 
+     *
      * @param coll  the collection to check, may be null
      * @return true if empty or null
      * @since Commons Collections 3.2
@@ -1084,7 +1086,7 @@ public class CollectionUtils {
      * Null-safe check if the specified collection is not empty.
      * <p>
      * Null returns false.
-     * 
+     *
      * @param coll  the collection to check, may be null
      * @return true if non-null and non-empty
      * @since Commons Collections 3.2
@@ -1096,7 +1098,7 @@ public class CollectionUtils {
     //-----------------------------------------------------------------------
     /**
      * Reverses the order of the given array.
-     * 
+     *
      * @param array  the array to reverse
      */
     public static void reverseArray(Object[] array) {
@@ -1183,7 +1185,7 @@ public class CollectionUtils {
      * in <code>collection</code> unless <code>retain</code> does not contain <code>e</code>, in which
      * case the cardinality is zero. This method is useful if you do not wish to modify
      * the collection <code>c</code> and thus cannot call <code>c.retainAll(retain);</code>.
-     * 
+     *
      * @param collection  the collection whose contents are the target of the #retailAll operation
      * @param retain  the collection containing the elements to be retained in the returned collection
      * @return a <code>Collection</code> containing all the elements of <code>collection</code>
@@ -1203,7 +1205,7 @@ public class CollectionUtils {
      * in <code>collection</code> unless <code>remove</code> contains <code>e</code>, in which
      * case the cardinality is zero. This method is useful if you do not wish to modify
      * the collection <code>c</code> and thus cannot call <code>collection.removeAll(remove);</code>.
-     * 
+     *
      * @param collection  the collection from which items are removed (in the returned collection)
      * @param remove  the items to be removed from the returned <code>collection</code>
      * @return a <code>Collection</code> containing all the elements of <code>collection</code> except
@@ -1219,9 +1221,9 @@ public class CollectionUtils {
     /**
      * Returns a synchronized collection backed by the given collection.
      * <p>
-     * You must manually synchronize on the returned buffer's iterator to 
+     * You must manually synchronize on the returned buffer's iterator to
      * avoid non-deterministic behavior:
-     *  
+     *
      * <pre>
      * Collection c = CollectionUtils.synchronizedCollection(myCollection);
      * synchronized (c) {
@@ -1231,9 +1233,9 @@ public class CollectionUtils {
      *     }
      * }
      * </pre>
-     * 
+     *
      * This method uses the implementation in the decorators subpackage.
-     * 
+     *
      * @param collection  the collection to synchronize, must not be null
      * @return a synchronized collection backed by the given collection
      * @throws IllegalArgumentException  if the collection is null
@@ -1277,7 +1279,7 @@ public class CollectionUtils {
      * Returns a transformed bag backed by the given collection.
      * <p>
      * Each object is passed through the transformer as it is added to the
-     * Collection. It is important not to use the original collection after invoking this 
+     * Collection. It is important not to use the original collection after invoking this
      * method, as it is a backdoor for adding untransformed objects.
      *
      * @param collection  the collection to predicate, must not be null

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/dabd2401/src/test/org/apache/commons/collections/TestCollectionUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestCollectionUtils.java b/src/test/org/apache/commons/collections/TestCollectionUtils.java
index 02732fc..7b613e6 100644
--- a/src/test/org/apache/commons/collections/TestCollectionUtils.java
+++ b/src/test/org/apache/commons/collections/TestCollectionUtils.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.
@@ -21,6 +21,7 @@ import static org.apache.commons.collections.functors.EqualPredicate.equalPredic
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.fail;
 
 import java.util.*;
@@ -36,7 +37,7 @@ import org.junit.Test;
 
 /**
  * Tests for CollectionUtils.
- * 
+ *
  * @author Rodney Waldhoff
  * @author Matthew Hawthorne
  * @author Stephen Colebourne
@@ -503,11 +504,13 @@ public class TestCollectionUtils extends MockTestCase {
         Collection<List<? extends Number>> col = new ArrayList<List<? extends Number>>();
         col.add(collectionA);
         col.add(collectionB);
-        CollectionUtils.forAllDo(col, testClosure);
+        Closure<List<? extends Number>> resultClosure = CollectionUtils.forAllDo(col, testClosure);
+        assertSame(testClosure, resultClosure);
         assertTrue(collectionA.isEmpty() && collectionB.isEmpty());
-        CollectionUtils.forAllDo(col, null);
+        resultClosure = CollectionUtils.forAllDo(col, null);
+        assertNull(resultClosure);
         assertTrue(collectionA.isEmpty() && collectionB.isEmpty());
-        CollectionUtils.forAllDo(null, testClosure);
+        resultClosure = CollectionUtils.forAllDo(null, testClosure);
         col.add(null);
         // null should be OK
         CollectionUtils.forAllDo(col, testClosure);
@@ -642,7 +645,7 @@ public class TestCollectionUtils extends MockTestCase {
         // ArrayIndexOutOfBoundsException
         CollectionUtils.get(objArray, 2);
     }
-    
+
     @Test(expected = IndexOutOfBoundsException.class)
     public void getFromPrimativeArray() throws Exception {
         // Primitive array, entry exists
@@ -884,7 +887,7 @@ public class TestCollectionUtils extends MockTestCase {
         assertEquals(1, (int) ints.size());
         assertEquals(2, (int) ints.get(0));
     }
-    
+
     @Test
     public void filterNullParameters() throws Exception {
         List<Long> longs = Collections.nCopies(4, 10L);
@@ -962,7 +965,7 @@ public class TestCollectionUtils extends MockTestCase {
         Collection<Number> collection = CollectionUtils.<Integer, Number>collect(iterableA, transformer);
         assertTrue(collection.size() == collectionA.size());
         assertCollectResult(collection);
-        
+
         ArrayList<Number> list;
         list = CollectionUtils.collect(collectionA, transformer, new ArrayList<Number>());
         assertTrue(list.size() == collectionA.size());
@@ -1144,7 +1147,7 @@ public class TestCollectionUtils extends MockTestCase {
         // Let elta and eltb be objects...
         Integer elta = new Integer(17);
         Integer eltb = new Integer(17);
-        
+
         // ...which are equal...
         assertEquals(elta, eltb);
         assertEquals(eltb, elta);


[69/77] [abbrv] commons-collections git commit: Javadoc typos; fix internal raw types

Posted by ch...@apache.org.
Javadoc typos; fix internal raw types

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@814063 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/2b056936
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/2b056936
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/2b056936

Branch: refs/heads/collections_jdk5_branch
Commit: 2b056936e6cea3f1ed37fcd52b38fdad247e8aca
Parents: c673ab5
Author: Sebastian Bazley <se...@apache.org>
Authored: Fri Sep 11 22:25:29 2009 +0000
Committer: Sebastian Bazley <se...@apache.org>
Committed: Fri Sep 11 22:25:29 2009 +0000

----------------------------------------------------------------------
 .../commons/collections/CollectionUtils.java    | 38 ++++++++++----------
 1 file changed, 19 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/2b056936/src/java/org/apache/commons/collections/CollectionUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/CollectionUtils.java b/src/java/org/apache/commons/collections/CollectionUtils.java
index 4d26462..1d674f5 100644
--- a/src/java/org/apache/commons/collections/CollectionUtils.java
+++ b/src/java/org/apache/commons/collections/CollectionUtils.java
@@ -386,10 +386,10 @@ public class CollectionUtils {
      * @return the the number of occurrences of obj in coll
      */
     public static <O> int cardinality(O obj, final Iterable<? super O> coll) {
-        if (coll instanceof Set) {
+        if (coll instanceof Set<?>) {
             return (((Set<? super O>) coll).contains(obj) ? 1 : 0);
         }
-        if (coll instanceof Bag) {
+        if (coll instanceof Bag<?>) {
             return ((Bag<? super O>) coll).getCount(obj);
         }
         int count = 0;
@@ -492,7 +492,7 @@ public class CollectionUtils {
     public static <C> void transform(Collection<C> collection,
             Transformer<? super C, ? extends C> transformer) {
         if (collection != null && transformer != null) {
-            if (collection instanceof List) {
+            if (collection instanceof List<?>) {
                 List<C> list = (List<C>) collection;
                 for (ListIterator<C> it = list.listIterator(); it.hasNext();) {
                     it.set(transformer.transform(it.next()));
@@ -703,7 +703,7 @@ public class CollectionUtils {
      * @param outputCollection  the collection to output into, may not be null
      * @param <I> the type of object in the input collection
      * @param <O> the type of object in the output collection
-     * @param <T> the output type of the transformer - this extends O.
+     * @param <R> the output type of the transformer - this extends O.
      * @return the outputCollection with the transformed input added
      * @throws NullPointerException if the output collection is null
      */
@@ -727,7 +727,7 @@ public class CollectionUtils {
      * @param outputCollection  the collection to output into, may not be null
      * @param <I> the type of object in the input collection
      * @param <O> the type of object in the output collection
-     * @param <T> the output type of the transformer - this extends O.
+     * @param <R> the output type of the transformer - this extends O.
      * @return the outputCollection with the transformed input added
      * @throws NullPointerException if the output collection is null
      */
@@ -772,7 +772,7 @@ public class CollectionUtils {
      *             if the collection or iterator is null
      */
     public static <C> boolean addAll(Collection<C> collection, Iterable<? extends C> iterable) {
-        if (iterable instanceof Collection) {
+        if (iterable instanceof Collection<?>) {
             return collection.addAll((Collection<? extends C>) iterable);
         }
         return addAll(collection, iterable.iterator());
@@ -879,7 +879,7 @@ public class CollectionUtils {
      */
     public static <T> T get(Iterable<T> iterable, int index) {
         checkIndexBounds(index);
-        if (iterable instanceof List) {
+        if (iterable instanceof List<?>) {
             return ((List<T>) iterable).get(index);
         }
         return get(iterable.iterator(), index);
@@ -920,13 +920,13 @@ public class CollectionUtils {
         if (i < 0) {
             throw new IndexOutOfBoundsException("Index cannot be negative: " + i);
         }
-        if (object instanceof Map) {
+        if (object instanceof Map<?,?>) {
             Map<?, ?> map = (Map<?, ?>) object;
             Iterator<?> iterator = map.entrySet().iterator();
             return get(iterator, i);
         } else if (object instanceof Object[]) {
             return ((Object[]) object)[i];
-        } else if (object instanceof Iterator) {
+        } else if (object instanceof Iterator<?>) {
             Iterator<?> it = (Iterator<?>) object;
             while (it.hasNext()) {
                 i--;
@@ -936,10 +936,10 @@ public class CollectionUtils {
                 it.next();
             }
             throw new IndexOutOfBoundsException("Entry does not exist: " + i);
-        } else if (object instanceof Collection) {
+        } else if (object instanceof Collection<?>) {
             Iterator<?> iterator = ((Collection<?>) object).iterator();
             return get(iterator, i);
-        } else if (object instanceof Enumeration) {
+        } else if (object instanceof Enumeration<?>) {
             Enumeration<?> it = (Enumeration<?>) object;
             while (it.hasMoreElements()) {
                 i--;
@@ -994,19 +994,19 @@ public class CollectionUtils {
      */
     public static int size(Object object) {
         int total = 0;
-        if (object instanceof Map) {
+        if (object instanceof Map<?,?>) {
             total = ((Map<?, ?>) object).size();
-        } else if (object instanceof Collection) {
+        } else if (object instanceof Collection<?>) {
             total = ((Collection<?>) object).size();
         } else if (object instanceof Object[]) {
             total = ((Object[]) object).length;
-        } else if (object instanceof Iterator) {
+        } else if (object instanceof Iterator<?>) {
             Iterator<?> it = (Iterator<?>) object;
             while (it.hasNext()) {
                 total++;
                 it.next();
             }
-        } else if (object instanceof Enumeration) {
+        } else if (object instanceof Enumeration<?>) {
             Enumeration<?> it = (Enumeration<?>) object;
             while (it.hasMoreElements()) {
                 total++;
@@ -1045,15 +1045,15 @@ public class CollectionUtils {
      * @since Commons Collections 3.2
      */
     public static boolean sizeIsEmpty(Object object) {
-        if (object instanceof Collection) {
+        if (object instanceof Collection<?>) {
             return ((Collection<?>) object).isEmpty();
-        } else if (object instanceof Map) {
+        } else if (object instanceof Map<?, ?>) {
             return ((Map<?, ?>) object).isEmpty();
         } else if (object instanceof Object[]) {
             return ((Object[]) object).length == 0;
-        } else if (object instanceof Iterator) {
+        } else if (object instanceof Iterator<?>) {
             return ((Iterator<?>) object).hasNext() == false;
-        } else if (object instanceof Enumeration) {
+        } else if (object instanceof Enumeration<?>) {
             return ((Enumeration<?>) object).hasMoreElements() == false;
         } else if (object == null) {
             throw new IllegalArgumentException("Unsupported object type: null");


[36/77] [abbrv] commons-collections git commit: kw

Posted by ch...@apache.org.
kw

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@739370 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/0b64e12d
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/0b64e12d
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/0b64e12d

Branch: refs/heads/collections_jdk5_branch
Commit: 0b64e12df8a9b778c3fc86b4a8f90e0b542b72a1
Parents: 47fe500
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Fri Jan 30 18:40:12 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Fri Jan 30 18:40:12 2009 +0000

----------------------------------------------------------------------

----------------------------------------------------------------------



[55/77] [abbrv] commons-collections git commit: add splitmap package whose original goal is to provide a more versatile TransformedMap implementation

Posted by ch...@apache.org.
add splitmap package whose original goal is to provide a more versatile TransformedMap implementation

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@751894 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/87ac9390
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/87ac9390
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/87ac9390

Branch: refs/heads/collections_jdk5_branch
Commit: 87ac93908a02d75dab464f400b9d3887d3c0e04b
Parents: 86b30a0
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Mon Mar 9 22:48:07 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Mon Mar 9 22:48:07 2009 +0000

----------------------------------------------------------------------
 .../AbstractIterableGetMapDecorator.java        | 161 +++++++++++++
 .../collections/splitmap/SplitMapUtils.java     | 233 ++++++++++++++++++
 .../collections/splitmap/TransformedMap.java    | 208 ++++++++++++++++
 .../commons/collections/splitmap/package.html   |  39 +++
 .../commons/collections/TestAllPackages.java    |   3 +-
 .../commons/collections/splitmap/TestAll.java   |  42 ++++
 .../collections/splitmap/TestSplitMapUtils.java | 241 +++++++++++++++++++
 .../splitmap/TestTransformedMap.java            | 134 +++++++++++
 8 files changed, 1060 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/87ac9390/src/java/org/apache/commons/collections/splitmap/AbstractIterableGetMapDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/splitmap/AbstractIterableGetMapDecorator.java b/src/java/org/apache/commons/collections/splitmap/AbstractIterableGetMapDecorator.java
new file mode 100644
index 0000000..d11e4c7
--- /dev/null
+++ b/src/java/org/apache/commons/collections/splitmap/AbstractIterableGetMapDecorator.java
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections.splitmap;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.collections.Get;
+import org.apache.commons.collections.IterableGet;
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.map.EntrySetToMapIteratorAdapter;
+
+/**
+ * {@link IterableGet} that uses a {@link Map}<K, V> for the {@link Get}<K, V>
+ * implementation.
+ *
+ * @since Commons Collections 5
+ * @TODO fix version
+ * @version $Revision$ $Date$
+ *
+ * @author Matt Benson
+ */
+public class AbstractIterableGetMapDecorator<K, V> implements IterableGet<K, V> {
+    /** The map to decorate */
+    protected transient Map<K, V> map;
+
+    /**
+     * Create a new AbstractSplitMapDecorator.
+     * @param decorated the Map to decorate
+     */
+    public AbstractIterableGetMapDecorator(Map<K, V> decorated) {
+        this.map = decorated;
+    }
+
+    /**
+     * Gets the map being decorated.
+     *
+     * @return the decorated map
+     */
+    protected Map<K, V> decorated() {
+        return map;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void clear() {
+        decorated().clear();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean containsKey(Object key) {
+        return decorated().containsKey(key);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean containsValue(Object value) {
+        return decorated().containsValue(value);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Set<Map.Entry<K, V>> entrySet() {
+        return decorated().entrySet();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public V get(Object key) {
+        return decorated().get(key);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public V remove(Object key) {
+        return decorated().remove(key);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEmpty() {
+        return decorated().isEmpty();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Set<K> keySet() {
+        return decorated().keySet();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int size() {
+        return decorated().size();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Collection<V> values() {
+        return decorated().values();
+    }
+
+    /**
+     * Get a MapIterator over this Get.
+     * @return MapIterator<K, V>
+     */
+    public MapIterator<K, V> mapIterator() {
+        return new EntrySetToMapIteratorAdapter<K, V>(entrySet());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean equals(Object object) {
+        if (object == this) {
+            return true;
+        }
+        return decorated().equals(object);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int hashCode() {
+        return decorated().hashCode();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String toString() {
+        return decorated().toString();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/87ac9390/src/java/org/apache/commons/collections/splitmap/SplitMapUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/splitmap/SplitMapUtils.java b/src/java/org/apache/commons/collections/splitmap/SplitMapUtils.java
new file mode 100644
index 0000000..f018dbf
--- /dev/null
+++ b/src/java/org/apache/commons/collections/splitmap/SplitMapUtils.java
@@ -0,0 +1,233 @@
+package org.apache.commons.collections.splitmap;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.collections.Get;
+import org.apache.commons.collections.IterableGet;
+import org.apache.commons.collections.IterableMap;
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.MapUtils;
+import org.apache.commons.collections.Put;
+import org.apache.commons.collections.Unmodifiable;
+import org.apache.commons.collections.collection.UnmodifiableCollection;
+import org.apache.commons.collections.iterators.UnmodifiableMapIterator;
+import org.apache.commons.collections.map.EntrySetToMapIteratorAdapter;
+import org.apache.commons.collections.map.UnmodifiableEntrySet;
+import org.apache.commons.collections.set.UnmodifiableSet;
+
+/**
+ * Utilities for working with "split maps:" objects that implement {@link Put}
+ * and/or {@link Get} but not {@link Map}.
+ *
+ * @since Commons Collections 5
+ * @TODO fix version
+ * @version $Revision$ $Date$
+ * @see Get
+ * @see Put
+ * @author Matt Benson
+ */
+public class SplitMapUtils {
+
+    /**
+     * <code>SplitMapUtils</code> should not normally be instantiated.
+     */
+    public SplitMapUtils() {
+    }
+
+    private static class WrappedGet<K, V> implements IterableMap<K, V>, Unmodifiable {
+        private Get<K, V> get;
+
+        private WrappedGet(Get<K, V> get) {
+            this.get = get;
+        }
+
+        public void clear() {
+            throw new UnsupportedOperationException();
+        }
+
+        public boolean containsKey(Object key) {
+            return get.containsKey(key);
+        }
+
+        public boolean containsValue(Object value) {
+            return get.containsValue(value);
+        }
+
+        public Set<java.util.Map.Entry<K, V>> entrySet() {
+            return UnmodifiableEntrySet.decorate(get.entrySet());
+        }
+
+        @Override
+        public boolean equals(Object arg0) {
+            if (arg0 == this) {
+                return true;
+            }
+            return arg0 instanceof WrappedGet && ((WrappedGet<?, ?>) arg0).get.equals(this.get);
+        }
+
+        public V get(Object key) {
+            return get.get(key);
+        }
+
+        @Override
+        public int hashCode() {
+            return ("WrappedGet".hashCode() << 4) | get.hashCode();
+        }
+
+        public boolean isEmpty() {
+            return get.isEmpty();
+        }
+
+        public Set<K> keySet() {
+            return UnmodifiableSet.decorate(get.keySet());
+        }
+
+        public V put(K key, V value) {
+            throw new UnsupportedOperationException();
+        };
+
+        public void putAll(Map<? extends K, ? extends V> t) {
+            throw new UnsupportedOperationException();
+        }
+
+        public V remove(Object key) {
+            return get.remove(key);
+        }
+
+        public int size() {
+            return get.size();
+        }
+
+        public Collection<V> values() {
+            return UnmodifiableCollection.decorate(get.values());
+        }
+
+        public MapIterator<K, V> mapIterator() {
+            MapIterator<K, V> it;
+            if (get instanceof IterableGet) {
+                it = ((IterableGet<K, V>) get).mapIterator();
+            } else {
+                it = new EntrySetToMapIteratorAdapter<K, V>(get.entrySet());
+            }
+            return UnmodifiableMapIterator.decorate(it);
+        }
+    }
+
+    private static class WrappedPut<K, V> implements Map<K, V>, Put<K, V> {
+        private Put<K, V> put;
+
+        private WrappedPut(Put<K, V> put) {
+            this.put = put;
+        }
+
+        public void clear() {
+            put.clear();
+        }
+
+        public boolean containsKey(Object key) {
+            throw new UnsupportedOperationException();
+        }
+
+        public boolean containsValue(Object value) {
+            throw new UnsupportedOperationException();
+        }
+
+        public Set<java.util.Map.Entry<K, V>> entrySet() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (obj == this) {
+                return true;
+            }
+            return obj instanceof WrappedPut && ((WrappedPut<?, ?>) obj).put.equals(this.put);
+        }
+
+        public V get(Object key) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public int hashCode() {
+            return ("WrappedPut".hashCode() << 4) | put.hashCode();
+        }
+
+        public boolean isEmpty() {
+            throw new UnsupportedOperationException();
+        }
+
+        public Set<K> keySet() {
+            throw new UnsupportedOperationException();
+        }
+
+        @SuppressWarnings("unchecked")
+        public V put(K key, V value) {
+            return (V) put.put(key, value);
+        };
+
+        public void putAll(Map<? extends K, ? extends V> t) {
+            put.putAll(t);
+        }
+
+        public V remove(Object key) {
+            throw new UnsupportedOperationException();
+        }
+
+        public int size() {
+            throw new UnsupportedOperationException();
+        }
+
+        public Collection<V> values() {
+            throw new UnsupportedOperationException();
+        }
+    }
+
+    /**
+     * Get the specified {@link Get} as an instance of {@link IterableMap}.
+     * If <code>get</code> implements {@link IterableMap} directly, no conversion will take place.
+     * If <code>get</code> implements {@link Map} but not {@link IterableMap} it will be decorated.
+     * Otherwise an {@link Unmodifiable} {@link IterableMap} will be returned.
+     * @param <K>
+     * @param <V>
+     * @param get to wrap, must not be null
+     * @return {@link IterableMap}
+     */
+    @SuppressWarnings("unchecked")
+    public static <K, V> IterableMap<K, V> readableMap(Get<K, V> get) {
+        if (get == null) {
+            throw new IllegalArgumentException("Get must not be null");
+        }
+        if (get instanceof Map) {
+            return get instanceof IterableMap ? ((IterableMap<K, V>) get) : MapUtils
+                    .iterableMap((Map<K, V>) get);
+        }
+        return new WrappedGet<K, V>(get);
+    }
+
+    /**
+     * Get the specified {@link Put} as an instanceof {@link Map}.
+     * If <code>put</code> implements {@link Map} directly, no conversion will take place.
+     * Otherwise a <em>write-only</em> {@link Map} will be returned.  On such a {@link Map}
+     * it is recommended that the result of #put(K, V) be discarded as it likely will not
+     * match <code>V</code> at runtime.
+     *
+     * @param <K>
+     * @param <V>
+     * @param put to wrap, must not be null
+     * @return {@link Map}
+     */
+    @SuppressWarnings("unchecked")
+    public static <K, V> Map<K, V> writableMap(Put<K, V> put) {
+        if (put == null) {
+            throw new IllegalArgumentException("Put must not be null");
+        }
+        if (put instanceof Map) {
+            return (Map<K, V>) put;
+        }
+        return new WrappedPut<K, V>(put);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/87ac9390/src/java/org/apache/commons/collections/splitmap/TransformedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/splitmap/TransformedMap.java b/src/java/org/apache/commons/collections/splitmap/TransformedMap.java
new file mode 100644
index 0000000..4ef627f
--- /dev/null
+++ b/src/java/org/apache/commons/collections/splitmap/TransformedMap.java
@@ -0,0 +1,208 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections.splitmap;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Map;
+
+import org.apache.commons.collections.Put;
+import org.apache.commons.collections.Transformer;
+import org.apache.commons.collections.map.LinkedMap;
+
+/**
+ * Decorates another <code>Map</code> to transform objects that are added.
+ * <p>
+ * The Map put methods and Map.Entry setValue method are affected by this class.
+ * Thus objects must be removed or searched for using their transformed form.
+ * For example, if the transformation converts Strings to Integers, you must use
+ * the Integer form to remove objects.
+ * <p>
+ * <strong>Note that TransformedMap is not synchronized and is not
+ * thread-safe.</strong> If you wish to use this map from multiple threads
+ * concurrently, you must use appropriate synchronization. The simplest approach
+ * is to wrap this map using {@link java.util.Collections#synchronizedMap(Map)}.
+ * This class may throw exceptions when accessed by concurrent threads without
+ * synchronization.
+ * 
+ * @since Commons Collections 5
+ * @TODO fix version
+ * @version $Revision$ $Date$
+ * 
+ * @author Stephen Colebourne
+ * @author Matt Benson
+ */
+public class TransformedMap<J, K, U, V> extends AbstractIterableGetMapDecorator<K, V> implements
+        Put<J, U>, Serializable {
+
+    /** Serialization version */
+    private static final long serialVersionUID = 5966875321133456994L;
+
+    /** The decorated map */
+    private Map<K, V> decorated;
+    /** The transformer to use for the key */
+    private final Transformer<? super J, ? extends K> keyTransformer;
+    /** The transformer to use for the value */
+    private final Transformer<? super U, ? extends V> valueTransformer;
+
+    /**
+     * Factory method to create a transforming map.
+     * <p>
+     * If there are any elements already in the map being decorated, they are
+     * NOT transformed.
+     * 
+     * @param map the map to decorate, must not be null
+     * @param keyTransformer the transformer to use for key conversion, null
+     * means no transformation
+     * @param valueTransformer the transformer to use for value conversion, null
+     * means no transformation
+     * @throws IllegalArgumentException if map is null
+     */
+    public static <J, K, U, V> TransformedMap<J, K, U, V> decorate(Map<K, V> map,
+            Transformer<? super J, ? extends K> keyTransformer,
+            Transformer<? super U, ? extends V> valueTransformer) {
+        return new TransformedMap<J, K, U, V>(map, keyTransformer, valueTransformer);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Constructor that wraps (not copies).
+     * <p>
+     * If there are any elements already in the collection being decorated, they
+     * are NOT transformed.
+     * 
+     * @param map the map to decorate, must not be null
+     * @param keyTransformer the transformer to use for key conversion, null
+     * means no conversion
+     * @param valueTransformer the transformer to use for value conversion, null
+     * means no conversion
+     * @throws IllegalArgumentException if map is null
+     */
+    protected TransformedMap(Map<K, V> map, Transformer<? super J, ? extends K> keyTransformer,
+            Transformer<? super U, ? extends V> valueTransformer) {
+        super(map);
+        if (keyTransformer == null) {
+            throw new IllegalArgumentException("keyTransformer cannot be null");
+        }
+        this.keyTransformer = keyTransformer;
+        if (valueTransformer == null) {
+            throw new IllegalArgumentException("valueTransformer cannot be null");
+        }
+        this.valueTransformer = valueTransformer;
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Write the map out using a custom routine.
+     * 
+     * @param out the output stream
+     * @throws IOException
+     */
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        out.defaultWriteObject();
+        out.writeObject(decorated);
+    }
+
+    /**
+     * Read the map in using a custom routine.
+     * 
+     * @param in the input stream
+     * @throws IOException
+     * @throws ClassNotFoundException
+     * @since Commons Collections 3.1
+     */
+    @SuppressWarnings("unchecked")
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        in.defaultReadObject();
+        decorated = (Map) in.readObject();
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Transforms a key.
+     * <p>
+     * The transformer itself may throw an exception if necessary.
+     * 
+     * @param object the object to transform
+     * @throws the transformed object
+     */
+    protected K transformKey(J object) {
+        return keyTransformer.transform(object);
+    }
+
+    /**
+     * Transforms a value.
+     * <p>
+     * The transformer itself may throw an exception if necessary.
+     * 
+     * @param object the object to transform
+     * @throws the transformed object
+     */
+    protected V transformValue(U object) {
+        return valueTransformer.transform(object);
+    }
+
+    /**
+     * Transforms a map.
+     * <p>
+     * The transformer itself may throw an exception if necessary.
+     * 
+     * @param map the map to transform
+     * @throws the transformed object
+     */
+    @SuppressWarnings("unchecked")
+    protected Map<K, V> transformMap(Map<? extends J, ? extends U> map) {
+        if (map.isEmpty()) {
+            return (Map<K, V>) map;
+        }
+        Map<K, V> result = new LinkedMap<K, V>(map.size());
+
+        for (Map.Entry<? extends J, ? extends U> entry : map.entrySet()) {
+            result.put((K) transformKey(entry.getKey()), transformValue(entry.getValue()));
+        }
+        return result;
+    }
+
+    /**
+     * Override to transform the value when using <code>setValue</code>.
+     * 
+     * @param value the value to transform
+     * @return the transformed value
+     */
+    protected V checkSetValue(U value) {
+        return valueTransformer.transform(value);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
+    public V put(J key, U value) {
+        return decorated().put(transformKey(key), transformValue(value));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void putAll(Map<? extends J, ? extends U> mapToCopy) {
+        decorated().putAll(transformMap(mapToCopy));
+    }
+
+    
+}

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/87ac9390/src/java/org/apache/commons/collections/splitmap/package.html
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/splitmap/package.html b/src/java/org/apache/commons/collections/splitmap/package.html
new file mode 100644
index 0000000..464ae43
--- /dev/null
+++ b/src/java/org/apache/commons/collections/splitmap/package.html
@@ -0,0 +1,39 @@
+<!-- $Id$ -->
+ <!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   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.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+  -->
+<BODY>
+<p>The "split map" concept is that of an object that implements
+the {@link org.apache.commons.collections.Put Put} and
+{@link org.apache.commons.collections.Get Get} interfaces,
+with <i>differing</i> generic types. This is like a pre-generics
+{@link java.util.Map Map} whose input key/value constraints are
+different than its output key/value constraints.  While it would
+be possible to declare a "split map" with matching input/output
+key/value constraints, this would be a {@link java.util.Map Map}
+and would therefore make little sense (any Commons Collections
+{@link java.util.Map Map} implementation will also implement
+{@link org.apache.commons.collections.Put Put} and
+{@link org.apache.commons.collections.Get Get} with matching
+generic parameters).
+
+<p>
+The following decorators are provided:
+<ul>
+<li>Transformed - transforms each element added
+</ul>
+</pre>
+</BODY>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/87ac9390/src/test/org/apache/commons/collections/TestAllPackages.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestAllPackages.java b/src/test/org/apache/commons/collections/TestAllPackages.java
index 36a56f5..a67ca5a 100644
--- a/src/test/org/apache/commons/collections/TestAllPackages.java
+++ b/src/test/org/apache/commons/collections/TestAllPackages.java
@@ -41,7 +41,8 @@ import org.junit.runners.Suite.SuiteClasses;
     org.apache.commons.collections.keyvalue.TestAll.class,
     org.apache.commons.collections.list.TestAll.class,
     org.apache.commons.collections.map.TestAll.class,
-    org.apache.commons.collections.set.TestAll.class
+    org.apache.commons.collections.set.TestAll.class,
+    org.apache.commons.collections.splitmap.TestAll.class
 })
 public class TestAllPackages {
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/87ac9390/src/test/org/apache/commons/collections/splitmap/TestAll.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/splitmap/TestAll.java b/src/test/org/apache/commons/collections/splitmap/TestAll.java
new file mode 100644
index 0000000..c3e54a4
--- /dev/null
+++ b/src/test/org/apache/commons/collections/splitmap/TestAll.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections.splitmap;
+
+import junit.framework.TestCase;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * Entry point for tests.
+ *
+ * @since Commons Collections 5
+ * @TODO fix version
+ * @version $Revision$ $Date$
+ *
+ * @author Stephen Colebourne
+ * @author Stephen Kestle
+ * @author Matt Benson
+ */
+@RunWith(Suite.class)
+@SuiteClasses({
+    TestSplitMapUtils.class,
+	TestTransformedMap.class
+})
+public class TestAll extends TestCase {
+}

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/87ac9390/src/test/org/apache/commons/collections/splitmap/TestSplitMapUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/splitmap/TestSplitMapUtils.java b/src/test/org/apache/commons/collections/splitmap/TestSplitMapUtils.java
new file mode 100644
index 0000000..c09cb5f
--- /dev/null
+++ b/src/test/org/apache/commons/collections/splitmap/TestSplitMapUtils.java
@@ -0,0 +1,241 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections.splitmap;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.commons.collections.BulkTest;
+import org.apache.commons.collections.IterableMap;
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.Put;
+import org.apache.commons.collections.Transformer;
+import org.apache.commons.collections.Unmodifiable;
+import org.apache.commons.collections.functors.NOPTransformer;
+import org.apache.commons.collections.map.HashedMap;
+
+/**
+ * Tests for {@link TransformedMap}
+ *
+ * @since Commons Collections 5
+ * @TODO fix version
+ * @version $Revision$ $Date$
+ *
+ * @author Stephen Colebourne
+ * @author Matt Benson
+ */
+public class TestSplitMapUtils extends BulkTest {
+    private Map<String, Integer> backingMap;
+    private TransformedMap<String, String, String, Integer> transformedMap;
+
+    private Transformer<String, Integer> stringToInt = new Transformer<String, Integer>() {
+        public Integer transform(String input) {
+            return Integer.valueOf(input);
+        }
+    };
+
+    public TestSplitMapUtils(String testName) {
+        super(testName);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        backingMap = new HashMap<String, Integer>();
+        transformedMap = TransformedMap.decorate(backingMap, NOPTransformer.<String> getInstance(),
+                stringToInt);
+        for (int i = 0; i < 10; i++) {
+            transformedMap.put(String.valueOf(i), String.valueOf(i));
+        }
+    }
+
+    public static Test suite() {
+        return new TestSuite(TestSplitMapUtils.class);
+    }
+
+    public static void main(String args[]) {
+        String[] testCaseName = { TestSplitMapUtils.class.getName() };
+        junit.textui.TestRunner.main(testCaseName);
+    }
+
+    // -----------------------------------------------------------------------
+
+    public void testReadableMap() {
+        final IterableMap<String, Integer> map = SplitMapUtils.readableMap(transformedMap);
+
+        // basic
+        for (int i = 0; i < 10; i++) {
+            assertFalse(map.containsValue(String.valueOf(i)));
+            assertEquals(i, map.get(String.valueOf(i)).intValue());
+        }
+
+        // mapIterator
+        MapIterator<String, Integer> it = map.mapIterator();
+        while (it.hasNext()) {
+            String k = it.next();
+            assertEquals(k, it.getKey());
+            assertEquals(Integer.valueOf(k), it.getValue());
+        }
+
+        // unmodifiable
+        assertTrue(map instanceof Unmodifiable);
+
+        // check individual operations
+        int sz = map.size();
+
+        attemptPutOperation(new Runnable() {
+            public void run() {
+                map.clear();
+            }
+        });
+
+        assertEquals(sz, map.size());
+
+        attemptPutOperation(new Runnable() {
+            public void run() {
+                map.put("foo", 100);
+            }
+        });
+
+        final HashMap<String, Integer> m = new HashMap<String, Integer>();
+        m.put("foo", 100);
+        m.put("bar", 200);
+        m.put("baz", 300);
+        attemptPutOperation(new Runnable() {
+            public void run() {
+                map.putAll(m);
+            }
+        });
+
+        // equals, hashcode
+        IterableMap<String, Integer> other = SplitMapUtils.readableMap(transformedMap);
+        assertEquals(other, map);
+        assertEquals(other.hashCode(), map.hashCode());
+
+        // remove
+        for (int i = 0; i < 10; i++) {
+            assertEquals(i, map.remove(String.valueOf(i)).intValue());
+            assertEquals(--sz, map.size());
+        }
+        assertTrue(map.isEmpty());
+        assertSame(map, SplitMapUtils.readableMap(map));
+    }
+
+    public void testAlreadyReadableMap() {
+        HashedMap<String, Integer> hashedMap = new HashedMap<String, Integer>();
+        assertSame(hashedMap, SplitMapUtils.readableMap(hashedMap));
+    }
+
+    @SuppressWarnings("unchecked")
+    public void testWritableMap() {
+        final Map<String, String> map = SplitMapUtils.writableMap(transformedMap);
+        attemptGetOperation(new Runnable() {
+            public void run() {
+                map.get(null);
+            }
+        });
+        attemptGetOperation(new Runnable() {
+            public void run() {
+                map.entrySet();
+            }
+        });
+        attemptGetOperation(new Runnable() {
+            public void run() {
+                map.keySet();
+            }
+        });
+        attemptGetOperation(new Runnable() {
+            public void run() {
+                map.values();
+            }
+        });
+        attemptGetOperation(new Runnable() {
+            public void run() {
+                map.size();
+            }
+        });
+        attemptGetOperation(new Runnable() {
+            public void run() {
+                map.isEmpty();
+            }
+        });
+        attemptGetOperation(new Runnable() {
+            public void run() {
+                map.containsKey(null);
+            }
+        });
+        attemptGetOperation(new Runnable() {
+            public void run() {
+                map.containsValue(null);
+            }
+        });
+        attemptGetOperation(new Runnable() {
+            public void run() {
+                map.remove(null);
+            }
+        });
+
+        // equals, hashcode
+        Map<String, String> other = SplitMapUtils.writableMap(transformedMap);
+        assertEquals(other, map);
+        assertEquals(other.hashCode(), map.hashCode());
+
+        // put
+        int sz = backingMap.size();
+        assertFalse(backingMap.containsKey("foo"));
+        map.put("new", "66");
+        assertEquals(++sz, backingMap.size());
+
+        // putall
+        Map<String, String> more = new HashMap<String, String>();
+        more.put("foo", "77");
+        more.put("bar", "88");
+        more.put("baz", "99");
+        map.putAll(more);
+        assertEquals(sz + more.size(), backingMap.size());
+
+        // clear
+        map.clear();
+        assertTrue(backingMap.isEmpty());
+        assertSame(map, SplitMapUtils.writableMap((Put<String, String>) map));
+    }
+
+    public void testAlreadyWritableMap() {
+        HashedMap<String, String> hashedMap = new HashedMap<String, String>();
+        assertSame(hashedMap, SplitMapUtils.writableMap(hashedMap));
+    }
+
+    private void attemptGetOperation(Runnable r) {
+        attemptMapOperation("Put exposed as writable Map must not allow Get operations", r);
+    }
+
+    private void attemptPutOperation(Runnable r) {
+        attemptMapOperation("Get exposed as writable Map must not allow Put operations", r);
+    }
+
+    private void attemptMapOperation(String s, Runnable r) {
+        try {
+            r.run();
+            fail(s);
+        } catch (UnsupportedOperationException e) {
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/87ac9390/src/test/org/apache/commons/collections/splitmap/TestTransformedMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/splitmap/TestTransformedMap.java b/src/test/org/apache/commons/collections/splitmap/TestTransformedMap.java
new file mode 100644
index 0000000..b77fa4c
--- /dev/null
+++ b/src/test/org/apache/commons/collections/splitmap/TestTransformedMap.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections.splitmap;
+
+import java.math.BigInteger;
+import java.util.HashMap;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.commons.collections.BulkTest;
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.Transformer;
+import org.apache.commons.collections.functors.NOPTransformer;
+
+/**
+ * Tests for {@link TransformedMap}
+ *
+ * @since Commons Collections 5
+ * @TODO fix version, add Serialization tests
+ * @version $Revision$ $Date$
+ *
+ * @author Stephen Colebourne
+ * @author Matt Benson
+ */
+public class TestTransformedMap extends BulkTest {
+
+    private Transformer<Integer, String> intToString = new Transformer<Integer, String>() {
+        public String transform(Integer input) {
+            return String.valueOf(input);
+        };
+    };
+
+    private Transformer<Object, Class<?>> objectToClass = new Transformer<Object, Class<?>>() {
+        public java.lang.Class<?> transform(Object input) {
+            return input == null ? null : input.getClass();
+        }
+    };
+
+    private Transformer<String, Integer> stringToInt = new Transformer<String, Integer>() {
+        public Integer transform(String input) {
+            return Integer.valueOf(input);
+        }
+    };
+
+    public TestTransformedMap(String testName) {
+        super(testName);
+    }
+
+    public static Test suite() {
+        return new TestSuite(TestTransformedMap.class);
+    }
+
+    public static void main(String args[]) {
+        String[] testCaseName = { TestTransformedMap.class.getName() };
+        junit.textui.TestRunner.main(testCaseName);
+    }
+
+    // -----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
+    public void testTransformedMap() {
+        TransformedMap<Integer, String, Object, Class<?>> map = TransformedMap.decorate(
+                new HashMap<String, Class<?>>(), intToString, objectToClass);
+
+        Integer[] k = new Integer[] { 0, 1, 2, 3, 4, 5, 6 };
+        Object[] v = new Object[] { "", new Object(), new HashMap(), 0, BigInteger.TEN, null,
+                new Object[0] };
+
+        assertEquals(0, map.size());
+        for (int i = 0; i < k.length; i++) {
+            map.put(k[i], v[i]);
+            assertEquals(i + 1, map.size());
+            assertTrue(map.containsKey(intToString.transform(k[i])));
+            assertFalse(map.containsKey(k[i]));
+            assertTrue(map.containsValue(objectToClass.transform(v[i])));
+            assertTrue(objectToClass.transform(v[i]) != v[i] ^ map.containsValue(v[i]));
+            assertEquals(objectToClass.transform(v[i]), map.get(intToString.transform(k[i])));
+        }
+
+        int sz = map.size();
+        assertEquals(null, map.remove(k[0]));
+        assertEquals(sz, map.size());
+        assertEquals(objectToClass.transform(v[0]), map.remove(intToString.transform(k[0])));
+        assertEquals(--sz, map.size());
+
+        TransformedMap<String, String, String, Integer> map2 = TransformedMap.decorate(
+                new HashMap<String, Integer>(), NOPTransformer.<String> getInstance(), stringToInt);
+        assertEquals(0, map2.size());
+        for (int i = 0; i < 6; i++) {
+            map2.put(String.valueOf(i), String.valueOf(i));
+            assertEquals(i + 1, map2.size());
+            assertTrue(map2.containsValue(i));
+            assertFalse(map2.containsValue(String.valueOf(i)));
+            assertTrue(map2.containsKey(String.valueOf(i)));
+            assertEquals(i, map2.get(String.valueOf(i)).intValue());
+        }
+
+        int sz2 = map2.size();
+        assertEquals(Integer.valueOf(0), map2.remove("0"));
+        assertEquals(--sz2, map2.size());
+    }
+
+    // -----------------------------------------------------------------------
+
+    public void testMapIterator() {
+        TransformedMap<String, String, String, Integer> map = TransformedMap.decorate(
+                new HashMap<String, Integer>(), NOPTransformer.<String> getInstance(), stringToInt);
+        assertEquals(0, map.size());
+        for (int i = 0; i < 6; i++) {
+            map.put(String.valueOf(i), String.valueOf(i));
+        }
+
+        for (MapIterator<String, Integer> it = map.mapIterator(); it.hasNext();) {
+            String k = it.next();
+            assertEquals(k, it.getKey());
+            assertEquals(map.get(k), it.getValue());
+        }
+    }
+
+}


[74/77] [abbrv] commons-collections git commit: Replacing '^ \* $' with '^ \*$' - to help with merging to trunk

Posted by ch...@apache.org.
Replacing '^ \* $' with '^ \*$' - to help with merging to trunk

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@814127 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/c10ea5b9
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/c10ea5b9
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/c10ea5b9

Branch: refs/heads/collections_jdk5_branch
Commit: c10ea5b94b00834a37cd7eafe02afd0151334183
Parents: 2b05693
Author: Henri Yandell <ba...@apache.org>
Authored: Sat Sep 12 09:45:33 2009 +0000
Committer: Henri Yandell <ba...@apache.org>
Committed: Sat Sep 12 09:45:33 2009 +0000

----------------------------------------------------------------------
 src/java/org/apache/commons/collections/ArrayStack.java      | 6 +++---
 src/java/org/apache/commons/collections/Bag.java             | 6 +++---
 src/java/org/apache/commons/collections/BagUtils.java        | 8 ++++----
 src/java/org/apache/commons/collections/BidiMap.java         | 6 +++---
 .../org/apache/commons/collections/BoundedCollection.java    | 6 +++---
 src/java/org/apache/commons/collections/BoundedMap.java      | 6 +++---
 src/java/org/apache/commons/collections/Buffer.java          | 6 +++---
 .../apache/commons/collections/BufferOverflowException.java  | 6 +++---
 .../apache/commons/collections/BufferUnderflowException.java | 6 +++---
 src/java/org/apache/commons/collections/BufferUtils.java     | 4 ++--
 src/java/org/apache/commons/collections/Closure.java         | 6 +++---
 src/java/org/apache/commons/collections/ClosureUtils.java    | 6 +++---
 src/java/org/apache/commons/collections/ComparatorUtils.java | 6 +++---
 .../org/apache/commons/collections/EnumerationUtils.java     | 8 ++++----
 .../org/apache/commons/collections/ExtendedProperties.java   | 8 ++++----
 src/java/org/apache/commons/collections/Factory.java         | 6 +++---
 src/java/org/apache/commons/collections/FactoryUtils.java    | 6 +++---
 .../org/apache/commons/collections/FunctorException.java     | 6 +++---
 src/java/org/apache/commons/collections/Get.java             | 4 ++--
 src/java/org/apache/commons/collections/IterableGet.java     | 4 ++--
 src/java/org/apache/commons/collections/IterableMap.java     | 6 +++---
 .../org/apache/commons/collections/IterableSortedMap.java    | 4 ++--
 src/java/org/apache/commons/collections/KeyValue.java        | 6 +++---
 src/java/org/apache/commons/collections/ListUtils.java       | 6 +++---
 src/java/org/apache/commons/collections/MapIterator.java     | 4 ++--
 src/java/org/apache/commons/collections/MultiMap.java        | 6 +++---
 src/java/org/apache/commons/collections/OrderedBidiMap.java  | 6 +++---
 src/java/org/apache/commons/collections/OrderedMap.java      | 6 +++---
 .../org/apache/commons/collections/OrderedMapIterator.java   | 4 ++--
 src/java/org/apache/commons/collections/Predicate.java       | 8 ++++----
 src/java/org/apache/commons/collections/Put.java             | 4 ++--
 .../org/apache/commons/collections/ResettableIterator.java   | 6 +++---
 .../apache/commons/collections/ResettableListIterator.java   | 6 +++---
 src/java/org/apache/commons/collections/SetUtils.java        | 6 +++---
 src/java/org/apache/commons/collections/SortedBag.java       | 6 +++---
 src/java/org/apache/commons/collections/SortedBidiMap.java   | 4 ++--
 src/java/org/apache/commons/collections/Transformer.java     | 8 ++++----
 .../org/apache/commons/collections/TransformerUtils.java     | 6 +++---
 src/java/org/apache/commons/collections/Unmodifiable.java    | 4 ++--
 .../apache/commons/collections/bag/AbstractBagDecorator.java | 6 +++---
 .../org/apache/commons/collections/bag/AbstractMapBag.java   | 8 ++++----
 .../commons/collections/bag/AbstractSortedBagDecorator.java  | 6 +++---
 src/java/org/apache/commons/collections/bag/HashBag.java     | 6 +++---
 .../org/apache/commons/collections/bag/PredicatedBag.java    | 6 +++---
 .../apache/commons/collections/bag/PredicatedSortedBag.java  | 6 +++---
 .../org/apache/commons/collections/bag/SynchronizedBag.java  | 6 +++---
 .../commons/collections/bag/SynchronizedSortedBag.java       | 6 +++---
 .../org/apache/commons/collections/bag/TransformedBag.java   | 6 +++---
 .../apache/commons/collections/bag/TransformedSortedBag.java | 6 +++---
 src/java/org/apache/commons/collections/bag/TreeBag.java     | 8 ++++----
 .../org/apache/commons/collections/bag/UnmodifiableBag.java  | 6 +++---
 .../commons/collections/bag/UnmodifiableSortedBag.java       | 6 +++---
 .../collections/bidimap/AbstractBidiMapDecorator.java        | 6 +++---
 .../collections/bidimap/AbstractOrderedBidiMapDecorator.java | 6 +++---
 .../collections/bidimap/AbstractSortedBidiMapDecorator.java  | 6 +++---
 .../apache/commons/collections/bidimap/DualHashBidiMap.java  | 8 ++++----
 .../commons/collections/buffer/AbstractBufferDecorator.java  | 6 +++---
 .../apache/commons/collections/buffer/BlockingBuffer.java    | 4 ++--
 .../org/apache/commons/collections/buffer/BoundedBuffer.java | 4 ++--
 .../apache/commons/collections/buffer/PredicatedBuffer.java  | 6 +++---
 .../apache/commons/collections/buffer/PriorityBuffer.java    | 6 +++---
 .../commons/collections/buffer/SynchronizedBuffer.java       | 6 +++---
 .../apache/commons/collections/buffer/TransformedBuffer.java | 6 +++---
 .../commons/collections/buffer/UnmodifiableBuffer.java       | 6 +++---
 .../collections/collection/AbstractCollectionDecorator.java  | 6 +++---
 .../collection/AbstractUntypedCollectionDecorator.java       | 8 ++++----
 .../commons/collections/collection/PredicatedCollection.java | 6 +++---
 .../collections/collection/SynchronizedCollection.java       | 6 +++---
 .../collections/collection/TransformedCollection.java        | 6 +++---
 .../collections/collection/UnmodifiableCollection.java       | 6 +++---
 .../commons/collections/comparators/BooleanComparator.java   | 8 ++++----
 .../collections/comparators/ComparableComparator.java        | 4 ++--
 .../commons/collections/comparators/NullComparator.java      | 4 ++--
 .../commons/collections/comparators/ReverseComparator.java   | 8 ++++----
 .../collections/comparators/TransformingComparator.java      | 8 ++++----
 .../apache/commons/collections/functors/AllPredicate.java    | 4 ++--
 .../apache/commons/collections/functors/ChainedClosure.java  | 6 +++---
 .../commons/collections/functors/ChainedTransformer.java     | 6 +++---
 .../commons/collections/functors/CloneTransformer.java       | 6 +++---
 .../commons/collections/functors/ClosureTransformer.java     | 6 +++---
 .../apache/commons/collections/functors/ConstantFactory.java | 6 +++---
 .../commons/collections/functors/ConstantTransformer.java    | 6 +++---
 .../apache/commons/collections/functors/EqualPredicate.java  | 6 +++---
 .../commons/collections/functors/ExceptionClosure.java       | 6 +++---
 .../commons/collections/functors/ExceptionFactory.java       | 6 +++---
 .../commons/collections/functors/FactoryTransformer.java     | 6 +++---
 .../org/apache/commons/collections/functors/ForClosure.java  | 6 +++---
 .../org/apache/commons/collections/functors/IfClosure.java   | 6 +++---
 .../commons/collections/functors/InstantiateFactory.java     | 6 +++---
 .../commons/collections/functors/InvokerTransformer.java     | 6 +++---
 .../org/apache/commons/collections/functors/NOPClosure.java  | 6 +++---
 .../apache/commons/collections/functors/NOPTransformer.java  | 6 +++---
 .../commons/collections/functors/NotNullPredicate.java       | 6 +++---
 .../apache/commons/collections/functors/NotPredicate.java    | 6 +++---
 .../collections/functors/NullIsExceptionPredicate.java       | 6 +++---
 .../commons/collections/functors/NullIsTruePredicate.java    | 6 +++---
 .../apache/commons/collections/functors/NullPredicate.java   | 6 +++---
 .../apache/commons/collections/functors/OnePredicate.java    | 4 ++--
 .../commons/collections/functors/PredicateDecorator.java     | 8 ++++----
 .../commons/collections/functors/PredicateTransformer.java   | 6 +++---
 .../commons/collections/functors/PrototypeFactory.java       | 6 +++---
 .../commons/collections/functors/StringValueTransformer.java | 4 ++--
 .../commons/collections/functors/SwitchTransformer.java      | 6 +++---
 .../commons/collections/functors/TransformerClosure.java     | 6 +++---
 .../apache/commons/collections/functors/TruePredicate.java   | 6 +++---
 .../apache/commons/collections/functors/WhileClosure.java    | 6 +++---
 .../commons/collections/iterators/AbstractEmptyIterator.java | 6 +++---
 .../collections/iterators/AbstractEmptyMapIterator.java      | 6 +++---
 .../collections/iterators/AbstractIteratorDecorator.java     | 6 +++---
 .../collections/iterators/AbstractListIteratorDecorator.java | 6 +++---
 .../collections/iterators/AbstractMapIteratorDecorator.java  | 6 +++---
 .../iterators/AbstractOrderedMapIteratorDecorator.java       | 6 +++---
 .../iterators/AbstractUntypedIteratorDecorator.java          | 6 +++---
 .../apache/commons/collections/iterators/ArrayIterator.java  | 4 ++--
 .../commons/collections/iterators/ArrayListIterator.java     | 6 +++---
 .../commons/collections/iterators/CollatingIterator.java     | 8 ++++----
 .../apache/commons/collections/iterators/EmptyIterator.java  | 6 +++---
 .../commons/collections/iterators/EmptyListIterator.java     | 8 ++++----
 .../commons/collections/iterators/EmptyMapIterator.java      | 6 +++---
 .../commons/collections/iterators/EmptyOrderedIterator.java  | 6 +++---
 .../collections/iterators/EmptyOrderedMapIterator.java       | 6 +++---
 .../commons/collections/iterators/EntrySetMapIterator.java   | 4 ++--
 .../commons/collections/iterators/EnumerationIterator.java   | 6 +++---
 .../apache/commons/collections/iterators/FilterIterator.java | 6 +++---
 .../commons/collections/iterators/FilterListIterator.java    | 6 +++---
 .../apache/commons/collections/iterators/IteratorChain.java  | 8 ++++----
 .../commons/collections/iterators/IteratorEnumeration.java   | 8 ++++----
 .../commons/collections/iterators/ListIteratorWrapper.java   | 4 ++--
 .../commons/collections/iterators/LoopingIterator.java       | 4 ++--
 .../commons/collections/iterators/LoopingListIterator.java   | 4 ++--
 .../commons/collections/iterators/ObjectArrayIterator.java   | 6 +++---
 .../collections/iterators/ObjectArrayListIterator.java       | 6 +++---
 .../commons/collections/iterators/ObjectGraphIterator.java   | 8 ++++----
 .../commons/collections/iterators/ReverseListIterator.java   | 4 ++--
 .../commons/collections/iterators/SingletonIterator.java     | 6 +++---
 .../commons/collections/iterators/SingletonListIterator.java | 6 +++---
 .../commons/collections/iterators/TransformIterator.java     | 6 +++---
 .../commons/collections/iterators/UnmodifiableIterator.java  | 6 +++---
 .../collections/iterators/UnmodifiableListIterator.java      | 6 +++---
 .../collections/iterators/UnmodifiableMapIterator.java       | 6 +++---
 .../commons/collections/keyvalue/AbstractKeyValue.java       | 6 +++---
 .../commons/collections/keyvalue/AbstractMapEntry.java       | 6 +++---
 .../collections/keyvalue/AbstractMapEntryDecorator.java      | 6 +++---
 .../apache/commons/collections/keyvalue/DefaultKeyValue.java | 6 +++---
 .../apache/commons/collections/keyvalue/DefaultMapEntry.java | 6 +++---
 .../org/apache/commons/collections/keyvalue/MultiKey.java    | 8 ++++----
 .../apache/commons/collections/keyvalue/TiedMapEntry.java    | 6 +++---
 .../commons/collections/keyvalue/UnmodifiableMapEntry.java   | 6 +++---
 .../commons/collections/list/AbstractListDecorator.java      | 6 +++---
 .../collections/list/AbstractSerializableListDecorator.java  | 6 +++---
 .../commons/collections/list/CursorableLinkedList.java       | 6 +++---
 .../org/apache/commons/collections/list/FixedSizeList.java   | 6 +++---
 src/java/org/apache/commons/collections/list/GrowthList.java | 4 ++--
 src/java/org/apache/commons/collections/list/LazyList.java   | 6 +++---
 .../commons/collections/list/NodeCachingLinkedList.java      | 8 ++++----
 .../org/apache/commons/collections/list/PredicatedList.java  | 6 +++---
 .../apache/commons/collections/list/SynchronizedList.java    | 6 +++---
 .../org/apache/commons/collections/list/TransformedList.java | 6 +++---
 .../apache/commons/collections/list/UnmodifiableList.java    | 6 +++---
 .../collections/map/AbstractInputCheckedMapDecorator.java    | 6 +++---
 .../apache/commons/collections/map/AbstractIterableMap.java  | 6 +++---
 .../apache/commons/collections/map/AbstractLinkedMap.java    | 6 +++---
 .../apache/commons/collections/map/AbstractMapDecorator.java | 6 +++---
 .../commons/collections/map/AbstractOrderedMapDecorator.java | 6 +++---
 .../commons/collections/map/AbstractSortedMapDecorator.java  | 6 +++---
 .../apache/commons/collections/map/CaseInsensitiveMap.java   | 4 ++--
 .../org/apache/commons/collections/map/DefaultedMap.java     | 6 +++---
 .../collections/map/EntrySetToMapIteratorAdapter.java        | 8 ++++----
 .../org/apache/commons/collections/map/FixedSizeMap.java     | 6 +++---
 .../apache/commons/collections/map/FixedSizeSortedMap.java   | 6 +++---
 src/java/org/apache/commons/collections/map/LazyMap.java     | 6 +++---
 .../org/apache/commons/collections/map/LazySortedMap.java    | 6 +++---
 src/java/org/apache/commons/collections/map/LinkedMap.java   | 4 ++--
 .../org/apache/commons/collections/map/ListOrderedMap.java   | 6 +++---
 src/java/org/apache/commons/collections/map/MultiKeyMap.java | 6 +++---
 .../org/apache/commons/collections/map/MultiValueMap.java    | 4 ++--
 .../org/apache/commons/collections/map/PredicatedMap.java    | 6 +++---
 .../apache/commons/collections/map/PredicatedSortedMap.java  | 6 +++---
 .../apache/commons/collections/map/ReferenceIdentityMap.java | 8 ++++----
 .../org/apache/commons/collections/map/ReferenceMap.java     | 8 ++++----
 .../org/apache/commons/collections/map/SingletonMap.java     | 6 +++---
 .../org/apache/commons/collections/map/StaticBucketMap.java  | 6 +++---
 .../apache/commons/collections/map/TransformedSortedMap.java | 6 +++---
 .../apache/commons/collections/map/UnmodifiableEntrySet.java | 6 +++---
 .../org/apache/commons/collections/map/UnmodifiableMap.java  | 6 +++---
 .../commons/collections/map/UnmodifiableOrderedMap.java      | 6 +++---
 .../commons/collections/map/UnmodifiableSortedMap.java       | 6 +++---
 .../collections/set/AbstractSerializableSetDecorator.java    | 6 +++---
 .../apache/commons/collections/set/AbstractSetDecorator.java | 6 +++---
 .../commons/collections/set/AbstractSortedSetDecorator.java  | 6 +++---
 .../org/apache/commons/collections/set/MapBackedSet.java     | 6 +++---
 .../org/apache/commons/collections/set/PredicatedSet.java    | 6 +++---
 .../apache/commons/collections/set/PredicatedSortedSet.java  | 6 +++---
 .../org/apache/commons/collections/set/SynchronizedSet.java  | 6 +++---
 .../org/apache/commons/collections/set/TransformedSet.java   | 8 ++++----
 .../apache/commons/collections/set/TransformedSortedSet.java | 8 ++++----
 .../org/apache/commons/collections/set/UnmodifiableSet.java  | 6 +++---
 .../commons/collections/set/UnmodifiableSortedSet.java       | 6 +++---
 .../org/apache/commons/collections/AbstractTestObject.java   | 6 +++---
 src/test/org/apache/commons/collections/BulkTest.java        | 4 ++--
 src/test/org/apache/commons/collections/LocalTestNode.java   | 6 +++---
 src/test/org/apache/commons/collections/MapPerformance.java  | 4 ++--
 src/test/org/apache/commons/collections/TestAll.java         | 8 ++++----
 src/test/org/apache/commons/collections/TestAllPackages.java | 8 ++++----
 src/test/org/apache/commons/collections/TestArrayStack.java  | 8 ++++----
 src/test/org/apache/commons/collections/TestBufferUtils.java | 8 ++++----
 .../org/apache/commons/collections/TestEnumerationUtils.java | 6 +++---
 .../apache/commons/collections/TestExtendedProperties.java   | 8 ++++----
 .../org/apache/commons/collections/TestFactoryUtils.java     | 6 +++---
 src/test/org/apache/commons/collections/TestLinkedList.java  | 6 +++---
 src/test/org/apache/commons/collections/TestMapUtils.java    | 4 ++--
 .../org/apache/commons/collections/TestTypedCollection.java  | 8 ++++----
 .../org/apache/commons/collections/bag/AbstractTestBag.java  | 6 +++---
 .../commons/collections/bag/AbstractTestSortedBag.java       | 6 +++---
 src/test/org/apache/commons/collections/bag/TestAll.java     | 8 ++++----
 src/test/org/apache/commons/collections/bag/TestHashBag.java | 6 +++---
 src/test/org/apache/commons/collections/bag/TestTreeBag.java | 4 ++--
 src/test/org/apache/commons/collections/bidimap/TestAll.java | 8 ++++----
 .../commons/collections/bidimap/TestDualHashBidiMap.java     | 8 ++++----
 .../commons/collections/bidimap/TestDualTreeBidiMap.java     | 8 ++++----
 .../commons/collections/bidimap/TestDualTreeBidiMap2.java    | 8 ++++----
 .../apache/commons/collections/bidimap/TestTreeBidiMap.java  | 8 ++++----
 src/test/org/apache/commons/collections/buffer/TestAll.java  | 8 ++++----
 .../commons/collections/buffer/TestBlockingBuffer.java       | 6 +++---
 .../apache/commons/collections/buffer/TestBoundedBuffer.java | 4 ++--
 .../commons/collections/buffer/TestBoundedFifoBuffer2.java   | 8 ++++----
 .../commons/collections/buffer/TestTransformedBuffer.java    | 6 +++---
 .../commons/collections/buffer/TestUnboundedFifoBuffer.java  | 8 ++++----
 .../org/apache/commons/collections/collection/TestAll.java   | 8 ++++----
 .../collections/collection/TestTransformedCollection.java    | 6 +++---
 .../collections/comparators/AbstractTestComparator.java      | 6 +++---
 .../org/apache/commons/collections/comparators/TestAll.java  | 8 ++++----
 .../collections/comparators/TestComparableComparator.java    | 8 ++++----
 .../commons/collections/iterators/AbstractTestIterator.java  | 8 ++++----
 .../org/apache/commons/collections/iterators/TestAll.java    | 8 ++++----
 .../commons/collections/iterators/TestArrayIterator.java     | 8 ++++----
 .../commons/collections/iterators/TestArrayListIterator.java | 6 +++---
 .../collections/iterators/TestArrayListIterator2.java        | 6 +++---
 .../collections/iterators/TestFilterListIterator.java        | 8 ++++----
 .../commons/collections/iterators/TestIteratorChain.java     | 8 ++++----
 .../collections/iterators/TestListIteratorWrapper.java       | 4 ++--
 .../collections/iterators/TestListIteratorWrapper2.java      | 4 ++--
 .../commons/collections/iterators/TestLoopingIterator.java   | 8 ++++----
 .../collections/iterators/TestLoopingListIterator.java       | 4 ++--
 .../collections/iterators/TestObjectArrayIterator.java       | 8 ++++----
 .../collections/iterators/TestObjectArrayListIterator.java   | 8 ++++----
 .../collections/iterators/TestObjectGraphIterator.java       | 8 ++++----
 .../collections/iterators/TestSingletonIterator2.java        | 6 +++---
 .../collections/iterators/TestSingletonListIterator.java     | 6 +++---
 .../collections/iterators/TestUniqueFilterIterator.java      | 8 ++++----
 .../collections/iterators/TestUnmodifiableMapIterator.java   | 4 ++--
 .../commons/collections/keyvalue/AbstractTestMapEntry.java   | 8 ++++----
 .../org/apache/commons/collections/keyvalue/TestAll.java     | 8 ++++----
 .../commons/collections/keyvalue/TestDefaultKeyValue.java    | 8 ++++----
 .../commons/collections/keyvalue/TestDefaultMapEntry.java    | 8 ++++----
 src/test/org/apache/commons/collections/list/TestAll.java    | 8 ++++----
 .../org/apache/commons/collections/list/TestGrowthList.java  | 6 +++---
 src/test/org/apache/commons/collections/map/TestAll.java     | 8 ++++----
 .../org/apache/commons/collections/map/TestCompositeMap.java | 4 ++--
 .../apache/commons/collections/map/TestLazySortedMap.java    | 6 +++---
 .../org/apache/commons/collections/set/AbstractTestSet.java  | 6 +++---
 .../commons/collections/set/AbstractTestSortedSet.java       | 6 +++---
 src/test/org/apache/commons/collections/set/TestAll.java     | 8 ++++----
 .../org/apache/commons/collections/set/TestMapBackedSet.java | 6 +++---
 .../commons/collections/set/TestTransformedSortedSet.java    | 4 ++--
 265 files changed, 818 insertions(+), 818 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/ArrayStack.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/ArrayStack.java b/src/java/org/apache/commons/collections/ArrayStack.java
index 891fc70..67127b8 100644
--- a/src/java/org/apache/commons/collections/ArrayStack.java
+++ b/src/java/org/apache/commons/collections/ArrayStack.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.
@@ -37,7 +37,7 @@ import java.util.EmptyStackException;
  * @see java.util.Stack
  * @since Commons Collections 1.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Craig R. McClanahan
  * @author Paul Jack
  * @author Stephen Colebourne

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/Bag.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/Bag.java b/src/java/org/apache/commons/collections/Bag.java
index cb2cbad..05e6f3e 100644
--- a/src/java/org/apache/commons/collections/Bag.java
+++ b/src/java/org/apache/commons/collections/Bag.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.
@@ -41,7 +41,7 @@ import java.util.Set;
  * @param <E> the type held in the bag
  * @since Commons Collections 2.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Chuck Burdick
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/BagUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/BagUtils.java b/src/java/org/apache/commons/collections/BagUtils.java
index af3b02e..3e77056 100644
--- a/src/java/org/apache/commons/collections/BagUtils.java
+++ b/src/java/org/apache/commons/collections/BagUtils.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,11 +30,11 @@ import org.apache.commons.collections.bag.UnmodifiableSortedBag;
 /**
  * Provides utility methods and decorators for {@link Bag} and {@link SortedBag}
  * instances.
- * 
+ *
  * @since Commons Collections 2.1
  * @version $Revision$ $Date: 2007-07-13 05:39:24 -0500 (Fri, 13 Jul
  * 2007) $
- * 
+ *
  * @author Paul Jack
  * @author Stephen Colebourne
  * @author Andrew Freeman

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/BidiMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/BidiMap.java b/src/java/org/apache/commons/collections/BidiMap.java
index 860b81c..cb903cb 100644
--- a/src/java/org/apache/commons/collections/BidiMap.java
+++ b/src/java/org/apache/commons/collections/BidiMap.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.
@@ -32,7 +32,7 @@ package org.apache.commons.collections;
  * keys and values, meaning that multiple keys cannot map to the same value. 
  * This is required so that "inverting" the map results in a map without 
  * duplicate keys. See the {@link #put} method description for more information.
- * 
+ *
  * @param <K> the type of the keys in the map
  * @param <V> the type of the values in the map
  * @since Commons Collections 3.0

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/BoundedCollection.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/BoundedCollection.java b/src/java/org/apache/commons/collections/BoundedCollection.java
index 1eb78a3..8f02f2b 100644
--- a/src/java/org/apache/commons/collections/BoundedCollection.java
+++ b/src/java/org/apache/commons/collections/BoundedCollection.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,7 +30,7 @@ import java.util.Collection;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Herve Quiroz
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/BoundedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/BoundedMap.java b/src/java/org/apache/commons/collections/BoundedMap.java
index 9f8ea67..7b278ed 100644
--- a/src/java/org/apache/commons/collections/BoundedMap.java
+++ b/src/java/org/apache/commons/collections/BoundedMap.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.
@@ -25,7 +25,7 @@ package org.apache.commons.collections;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public interface BoundedMap<K, V> extends IterableMap<K, V> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/Buffer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/Buffer.java b/src/java/org/apache/commons/collections/Buffer.java
index fda388c..89c0b2c 100644
--- a/src/java/org/apache/commons/collections/Buffer.java
+++ b/src/java/org/apache/commons/collections/Buffer.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.
@@ -38,7 +38,7 @@ import java.util.Collection;
  * @param <E> the type of the elements in the buffer
  * @since Commons Collections 2.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Avalon
  * @author Berin Loritsch
  * @author Paul Jack

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/BufferOverflowException.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/BufferOverflowException.java b/src/java/org/apache/commons/collections/BufferOverflowException.java
index 024f1b5..c3dd13e 100644
--- a/src/java/org/apache/commons/collections/BufferOverflowException.java
+++ b/src/java/org/apache/commons/collections/BufferOverflowException.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.
@@ -22,7 +22,7 @@ package org.apache.commons.collections;
  *
  * @since Commons Collections 2.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Avalon
  * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  * @author <a href="mailto:jefft@apache.org">Jeff Turner</a>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/BufferUnderflowException.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/BufferUnderflowException.java b/src/java/org/apache/commons/collections/BufferUnderflowException.java
index 79cb94e..9ecfeba 100644
--- a/src/java/org/apache/commons/collections/BufferUnderflowException.java
+++ b/src/java/org/apache/commons/collections/BufferUnderflowException.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.
@@ -22,7 +22,7 @@ import java.util.NoSuchElementException;
  * The BufferUnderflowException is used when the buffer is already empty.
  * <p>
  * NOTE: From version 3.0, this exception extends NoSuchElementException.
- * 
+ *
  * @since Commons Collections 2.1
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/BufferUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/BufferUtils.java b/src/java/org/apache/commons/collections/BufferUtils.java
index 0e09fe8..bd62241 100644
--- a/src/java/org/apache/commons/collections/BufferUtils.java
+++ b/src/java/org/apache/commons/collections/BufferUtils.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/Closure.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/Closure.java b/src/java/org/apache/commons/collections/Closure.java
index 4fc44ed..9df4b0c 100644
--- a/src/java/org/apache/commons/collections/Closure.java
+++ b/src/java/org/apache/commons/collections/Closure.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,7 +24,7 @@ package org.apache.commons.collections;
  * <p>
  * Standard implementations of common closures are provided by
  * {@link ClosureUtils}. These include method invokation and for/while loops.
- * 
+ *
  * @param <T> the type that the closure acts on
  * @since Commons Collections 1.0
  * @version $Revision$ $Date$

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/ClosureUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/ClosureUtils.java b/src/java/org/apache/commons/collections/ClosureUtils.java
index 750c284..0b8aba1 100644
--- a/src/java/org/apache/commons/collections/ClosureUtils.java
+++ b/src/java/org/apache/commons/collections/ClosureUtils.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.
@@ -46,7 +46,7 @@ import org.apache.commons.collections.functors.WhileClosure;
  * <li>Exception - always throws an exception
  * </ul>
  * All the supplied closures are Serializable.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/ComparatorUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/ComparatorUtils.java b/src/java/org/apache/commons/collections/ComparatorUtils.java
index c625745..e04ae12 100644
--- a/src/java/org/apache/commons/collections/ComparatorUtils.java
+++ b/src/java/org/apache/commons/collections/ComparatorUtils.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.
@@ -37,7 +37,7 @@ import org.apache.commons.collections.comparators.TransformingComparator;
  *
  * @since Commons Collections 2.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Paul Jack
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/EnumerationUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/EnumerationUtils.java b/src/java/org/apache/commons/collections/EnumerationUtils.java
index 1a7b52f..588860e 100644
--- a/src/java/org/apache/commons/collections/EnumerationUtils.java
+++ b/src/java/org/apache/commons/collections/EnumerationUtils.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.
@@ -25,10 +25,10 @@ import org.apache.commons.collections.iterators.EnumerationIterator;
 
 /**
  * Provides utility methods for {@link Enumeration} instances.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Id$
- * 
+ *
  * @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
  */
 public class EnumerationUtils {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/ExtendedProperties.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/ExtendedProperties.java b/src/java/org/apache/commons/collections/ExtendedProperties.java
index e3483db..0b8df93 100644
--- a/src/java/org/apache/commons/collections/ExtendedProperties.java
+++ b/src/java/org/apache/commons/collections/ExtendedProperties.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.
@@ -91,7 +91,7 @@ import java.util.Vector;
  *
  *   Then "additional.properties" is expected to be in the same
  *   directory as the parent configuration file.
- * 
+ *
  *   Duplicate name values will be replaced, so be careful.
  *
  *  </li>
@@ -129,7 +129,7 @@ import java.util.Vector;
  *
  * @since Commons Collections 1.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  * @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
  * @author <a href="mailto:daveb@miceda-data">Dave Bryson</a>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/Factory.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/Factory.java b/src/java/org/apache/commons/collections/Factory.java
index 6631e82..50db741 100644
--- a/src/java/org/apache/commons/collections/Factory.java
+++ b/src/java/org/apache/commons/collections/Factory.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.
@@ -25,7 +25,7 @@ package org.apache.commons.collections;
  * Standard implementations of common factories are provided by
  * {@link FactoryUtils}. These include factories that return a constant,
  * a copy of a prototype or a new instance.
- * 
+ *
  * @param <T> the type that the factory creates
  * @since Commons Collections 2.1
  * @version $Revision$ $Date$

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/FactoryUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/FactoryUtils.java b/src/java/org/apache/commons/collections/FactoryUtils.java
index 59b02fc..85382f2 100644
--- a/src/java/org/apache/commons/collections/FactoryUtils.java
+++ b/src/java/org/apache/commons/collections/FactoryUtils.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.
@@ -32,7 +32,7 @@ import org.apache.commons.collections.functors.PrototypeFactory;
  * <li>Exception - always throws an exception
  * </ul>
  * All the supplied factories are Serializable.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/FunctorException.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/FunctorException.java b/src/java/org/apache/commons/collections/FunctorException.java
index ce9166a..eb23776 100644
--- a/src/java/org/apache/commons/collections/FunctorException.java
+++ b/src/java/org/apache/commons/collections/FunctorException.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.
@@ -22,7 +22,7 @@ import java.io.PrintWriter;
 /**
  * Runtime exception thrown from functors.
  * If required, a root cause error can be wrapped within this one.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/Get.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/Get.java b/src/java/org/apache/commons/collections/Get.java
index 8447076..060787b 100644
--- a/src/java/org/apache/commons/collections/Get.java
+++ b/src/java/org/apache/commons/collections/Get.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/IterableGet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/IterableGet.java b/src/java/org/apache/commons/collections/IterableGet.java
index 0d10d7b..5d2cb71 100644
--- a/src/java/org/apache/commons/collections/IterableGet.java
+++ b/src/java/org/apache/commons/collections/IterableGet.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/IterableMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/IterableMap.java b/src/java/org/apache/commons/collections/IterableMap.java
index 91e6256..1df6cd4 100644
--- a/src/java/org/apache/commons/collections/IterableMap.java
+++ b/src/java/org/apache/commons/collections/IterableMap.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.
@@ -32,7 +32,7 @@ import java.util.Map;
  *   it.setValue(value + 1);
  * }
  * </pre>
- * 
+ *
  * @param <K> the type of the keys in the map
  * @param <V> the type of the values in the map
  * @since Commons Collections 3.0

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/IterableSortedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/IterableSortedMap.java b/src/java/org/apache/commons/collections/IterableSortedMap.java
index b987dba..b902dd3 100644
--- a/src/java/org/apache/commons/collections/IterableSortedMap.java
+++ b/src/java/org/apache/commons/collections/IterableSortedMap.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/KeyValue.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/KeyValue.java b/src/java/org/apache/commons/collections/KeyValue.java
index 023b5dd..631618b 100644
--- a/src/java/org/apache/commons/collections/KeyValue.java
+++ b/src/java/org/apache/commons/collections/KeyValue.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.
@@ -27,7 +27,7 @@ package org.apache.commons.collections;
  * @param <V> the type of the value
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public interface KeyValue<K, V> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/ListUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/ListUtils.java b/src/java/org/apache/commons/collections/ListUtils.java
index fc5868d..d6a68d2 100644
--- a/src/java/org/apache/commons/collections/ListUtils.java
+++ b/src/java/org/apache/commons/collections/ListUtils.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.
@@ -34,7 +34,7 @@ import org.apache.commons.collections.list.UnmodifiableList;
  *
  * @since Commons Collections 1.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Federico Barbieri
  * @author Peter Donald
  * @author Paul Jack

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/MapIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/MapIterator.java b/src/java/org/apache/commons/collections/MapIterator.java
index b09d424..64592f3 100644
--- a/src/java/org/apache/commons/collections/MapIterator.java
+++ b/src/java/org/apache/commons/collections/MapIterator.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/MultiMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/MultiMap.java b/src/java/org/apache/commons/collections/MultiMap.java
index 2b7333e..a3f8311 100644
--- a/src/java/org/apache/commons/collections/MultiMap.java
+++ b/src/java/org/apache/commons/collections/MultiMap.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.
@@ -41,7 +41,7 @@ import java.util.Collection;
  *
  * @since Commons Collections 2.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Christopher Berry
  * @author James Strachan
  * @author Stephen Colebourne

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/OrderedBidiMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/OrderedBidiMap.java b/src/java/org/apache/commons/collections/OrderedBidiMap.java
index 642d9df..75bd588 100644
--- a/src/java/org/apache/commons/collections/OrderedBidiMap.java
+++ b/src/java/org/apache/commons/collections/OrderedBidiMap.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.
@@ -22,7 +22,7 @@ package org.apache.commons.collections;
  * <p>
  * Implementations should allow a value to be looked up from a key and
  * a key to be looked up from a value with equal performance.
- * 
+ *
  * @param <K> the type of the keys in the map
  * @param <V> the type of the values in the map
  * @since Commons Collections 3.0

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/OrderedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/OrderedMap.java b/src/java/org/apache/commons/collections/OrderedMap.java
index 7a45392..49b8658 100644
--- a/src/java/org/apache/commons/collections/OrderedMap.java
+++ b/src/java/org/apache/commons/collections/OrderedMap.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.
@@ -19,7 +19,7 @@ package org.apache.commons.collections;
 /**
  * Defines a map that maintains order and allows both forward and backward
  * iteration through that order.
- * 
+ *
  * @param <K> the type of the keys in the map
  * @param <V> the type of the values in the map
  * @since Commons Collections 3.0

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/OrderedMapIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/OrderedMapIterator.java b/src/java/org/apache/commons/collections/OrderedMapIterator.java
index add205e..832529a 100644
--- a/src/java/org/apache/commons/collections/OrderedMapIterator.java
+++ b/src/java/org/apache/commons/collections/OrderedMapIterator.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/Predicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/Predicate.java b/src/java/org/apache/commons/collections/Predicate.java
index 9004629..7a69820 100644
--- a/src/java/org/apache/commons/collections/Predicate.java
+++ b/src/java/org/apache/commons/collections/Predicate.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.
@@ -27,11 +27,11 @@ package org.apache.commons.collections;
  * Standard implementations of common predicates are provided by
  * {@link PredicateUtils}. These include true, false, instanceof, equals, and,
  * or, not, method invokation and null testing.
- * 
+ *
  * @param <T> the type that the predicate queries
  * @since Commons Collections 1.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author James Strachan
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/Put.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/Put.java b/src/java/org/apache/commons/collections/Put.java
index ee55a28..fb61fa7 100644
--- a/src/java/org/apache/commons/collections/Put.java
+++ b/src/java/org/apache/commons/collections/Put.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/ResettableIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/ResettableIterator.java b/src/java/org/apache/commons/collections/ResettableIterator.java
index 8a58f48..7fa6e59 100644
--- a/src/java/org/apache/commons/collections/ResettableIterator.java
+++ b/src/java/org/apache/commons/collections/ResettableIterator.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.
@@ -26,7 +26,7 @@ import java.util.Iterator;
  * @param <E> the type to iterate over
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public interface ResettableIterator<E> extends Iterator<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/ResettableListIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/ResettableListIterator.java b/src/java/org/apache/commons/collections/ResettableListIterator.java
index deffb6a..9c574d1 100644
--- a/src/java/org/apache/commons/collections/ResettableListIterator.java
+++ b/src/java/org/apache/commons/collections/ResettableListIterator.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.
@@ -26,7 +26,7 @@ import java.util.ListIterator;
  * @param <E> the type to iterate over
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public interface ResettableListIterator<E> extends ListIterator<E>, ResettableIterator<E>, OrderedIterator<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/SetUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/SetUtils.java b/src/java/org/apache/commons/collections/SetUtils.java
index 683be0e..a3b3050 100644
--- a/src/java/org/apache/commons/collections/SetUtils.java
+++ b/src/java/org/apache/commons/collections/SetUtils.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.
@@ -38,7 +38,7 @@ import org.apache.commons.collections.set.UnmodifiableSortedSet;
  *
  * @since Commons Collections 2.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Paul Jack
  * @author Stephen Colebourne
  * @author Neil O'Toole

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/SortedBag.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/SortedBag.java b/src/java/org/apache/commons/collections/SortedBag.java
index c5128bf..e12e6d2 100644
--- a/src/java/org/apache/commons/collections/SortedBag.java
+++ b/src/java/org/apache/commons/collections/SortedBag.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.
@@ -25,7 +25,7 @@ import java.util.Comparator;
  * @param <E> the type to iterate over
  * @since Commons Collections 2.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Chuck Burdick
  */
 public interface SortedBag<E> extends Bag<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/SortedBidiMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/SortedBidiMap.java b/src/java/org/apache/commons/collections/SortedBidiMap.java
index b56d7cf..2bba500 100644
--- a/src/java/org/apache/commons/collections/SortedBidiMap.java
+++ b/src/java/org/apache/commons/collections/SortedBidiMap.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/Transformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/Transformer.java b/src/java/org/apache/commons/collections/Transformer.java
index f73df73..25f4d4f 100644
--- a/src/java/org/apache/commons/collections/Transformer.java
+++ b/src/java/org/apache/commons/collections/Transformer.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.
@@ -28,12 +28,12 @@ package org.apache.commons.collections;
  * Standard implementations of common transformers are provided by
  * {@link TransformerUtils}. These include method invokation, returning a constant,
  * cloning and returning the string value.
- * 
+ *
  * @param <I> the input type to the transformer
  * @param <O> the output type from the transformer
  * @since Commons Collections 1.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author James Strachan
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/TransformerUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/TransformerUtils.java b/src/java/org/apache/commons/collections/TransformerUtils.java
index e602fbf..9ba91f1 100644
--- a/src/java/org/apache/commons/collections/TransformerUtils.java
+++ b/src/java/org/apache/commons/collections/TransformerUtils.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.
@@ -58,7 +58,7 @@ import org.apache.commons.collections.functors.SwitchTransformer;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author James Carman
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/Unmodifiable.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/Unmodifiable.java b/src/java/org/apache/commons/collections/Unmodifiable.java
index ba6258c..86fc129 100644
--- a/src/java/org/apache/commons/collections/Unmodifiable.java
+++ b/src/java/org/apache/commons/collections/Unmodifiable.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java b/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java
index ae0f55d..96a743c 100644
--- a/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java
+++ b/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.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.
@@ -28,7 +28,7 @@ import org.apache.commons.collections.collection.AbstractCollectionDecorator;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public abstract class AbstractBagDecorator<E>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/bag/AbstractMapBag.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/AbstractMapBag.java b/src/java/org/apache/commons/collections/bag/AbstractMapBag.java
index f61c9cc..e0be774 100644
--- a/src/java/org/apache/commons/collections/bag/AbstractMapBag.java
+++ b/src/java/org/apache/commons/collections/bag/AbstractMapBag.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.
@@ -36,11 +36,11 @@ import org.apache.commons.collections.set.UnmodifiableSet;
  * Subclasses specify a Map implementation to use as the internal storage. The
  * map will be used to map bag elements to a number; the number represents the
  * number of occurrences of that element in the bag.
- * 
+ *
  * @since Commons Collections 3.0 (previously DefaultMapBag v2.0)
  * @version $Revision$ $Date: 2006-10-27 19:52:37 -0500 (Fri, 27 Oct
  * 2006) $
- * 
+ *
  * @author Chuck Burdick
  * @author Michael A. Smith
  * @author Stephen Colebourne

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/bag/AbstractSortedBagDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/AbstractSortedBagDecorator.java b/src/java/org/apache/commons/collections/bag/AbstractSortedBagDecorator.java
index 5446842..cc82ebe 100644
--- a/src/java/org/apache/commons/collections/bag/AbstractSortedBagDecorator.java
+++ b/src/java/org/apache/commons/collections/bag/AbstractSortedBagDecorator.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.
@@ -27,7 +27,7 @@ import org.apache.commons.collections.SortedBag;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public abstract class AbstractSortedBagDecorator<E>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/bag/HashBag.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/HashBag.java b/src/java/org/apache/commons/collections/bag/HashBag.java
index b92b0bd..814b11b 100644
--- a/src/java/org/apache/commons/collections/bag/HashBag.java
+++ b/src/java/org/apache/commons/collections/bag/HashBag.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.
@@ -37,7 +37,7 @@ import org.apache.commons.collections.Bag;
  *
  * @since Commons Collections 3.0 (previously in main package v2.0)
  * @version $Revision$ $Date$
- * 
+ *
  * @author Chuck Burdick
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/bag/PredicatedBag.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/PredicatedBag.java b/src/java/org/apache/commons/collections/bag/PredicatedBag.java
index 89f2d70..3af6bc6 100644
--- a/src/java/org/apache/commons/collections/bag/PredicatedBag.java
+++ b/src/java/org/apache/commons/collections/bag/PredicatedBag.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.
@@ -37,7 +37,7 @@ import org.apache.commons.collections.collection.PredicatedCollection;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Paul Jack
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/bag/PredicatedSortedBag.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/PredicatedSortedBag.java b/src/java/org/apache/commons/collections/bag/PredicatedSortedBag.java
index 68f7a6a..c146013 100644
--- a/src/java/org/apache/commons/collections/bag/PredicatedSortedBag.java
+++ b/src/java/org/apache/commons/collections/bag/PredicatedSortedBag.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.
@@ -36,7 +36,7 @@ import org.apache.commons.collections.SortedBag;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Paul Jack
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/bag/SynchronizedBag.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/SynchronizedBag.java b/src/java/org/apache/commons/collections/bag/SynchronizedBag.java
index cd4958f..1df1cf5 100644
--- a/src/java/org/apache/commons/collections/bag/SynchronizedBag.java
+++ b/src/java/org/apache/commons/collections/bag/SynchronizedBag.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.set.SynchronizedSet;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class SynchronizedBag<E>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java b/src/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java
index 86bfc09..394050f 100644
--- a/src/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java
+++ b/src/java/org/apache/commons/collections/bag/SynchronizedSortedBag.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.
@@ -32,7 +32,7 @@ import org.apache.commons.collections.SortedBag;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class SynchronizedSortedBag<E>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/bag/TransformedBag.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/TransformedBag.java b/src/java/org/apache/commons/collections/bag/TransformedBag.java
index 8663d8b..4376d8e 100644
--- a/src/java/org/apache/commons/collections/bag/TransformedBag.java
+++ b/src/java/org/apache/commons/collections/bag/TransformedBag.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.
@@ -35,7 +35,7 @@ import org.apache.commons.collections.set.TransformedSet;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TransformedBag<E>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/bag/TransformedSortedBag.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/TransformedSortedBag.java b/src/java/org/apache/commons/collections/bag/TransformedSortedBag.java
index 9bdb922..e4af975 100644
--- a/src/java/org/apache/commons/collections/bag/TransformedSortedBag.java
+++ b/src/java/org/apache/commons/collections/bag/TransformedSortedBag.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.Transformer;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TransformedSortedBag<E>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/bag/TreeBag.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/TreeBag.java b/src/java/org/apache/commons/collections/bag/TreeBag.java
index f2091a5..81a7908 100644
--- a/src/java/org/apache/commons/collections/bag/TreeBag.java
+++ b/src/java/org/apache/commons/collections/bag/TreeBag.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.
@@ -39,11 +39,11 @@ import org.apache.commons.collections.SortedBag;
  * object to be added or removed at once. It is important to read the interface
  * javadoc carefully as several methods violate the <code>Collection</code>
  * interface specification.
- * 
+ *
  * @since Commons Collections 3.0 (previously in main package v2.0)
  * @version $Revision$ $Date: 2006-10-27 19:52:37 -0500 (Fri, 27 Oct
  * 2006) $
- * 
+ *
  * @author Chuck Burdick
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/bag/UnmodifiableBag.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/UnmodifiableBag.java b/src/java/org/apache/commons/collections/bag/UnmodifiableBag.java
index b2c9609..4f1d4d0 100644
--- a/src/java/org/apache/commons/collections/bag/UnmodifiableBag.java
+++ b/src/java/org/apache/commons/collections/bag/UnmodifiableBag.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.
@@ -36,7 +36,7 @@ import org.apache.commons.collections.set.UnmodifiableSet;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public final class UnmodifiableBag<E>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java b/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java
index 023f470..3e5b66c 100644
--- a/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java
+++ b/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.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.
@@ -36,7 +36,7 @@ import org.apache.commons.collections.set.UnmodifiableSet;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public final class UnmodifiableSortedBag<E>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/bidimap/AbstractBidiMapDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bidimap/AbstractBidiMapDecorator.java b/src/java/org/apache/commons/collections/bidimap/AbstractBidiMapDecorator.java
index 393cc4e..68a2805 100644
--- a/src/java/org/apache/commons/collections/bidimap/AbstractBidiMapDecorator.java
+++ b/src/java/org/apache/commons/collections/bidimap/AbstractBidiMapDecorator.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.
@@ -34,7 +34,7 @@ import org.apache.commons.collections.map.AbstractMapDecorator;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public abstract class AbstractBidiMapDecorator<K, V> extends AbstractMapDecorator<K, V> implements

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/bidimap/AbstractOrderedBidiMapDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bidimap/AbstractOrderedBidiMapDecorator.java b/src/java/org/apache/commons/collections/bidimap/AbstractOrderedBidiMapDecorator.java
index 1602ef8..a02832a 100644
--- a/src/java/org/apache/commons/collections/bidimap/AbstractOrderedBidiMapDecorator.java
+++ b/src/java/org/apache/commons/collections/bidimap/AbstractOrderedBidiMapDecorator.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.OrderedMapIterator;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public abstract class AbstractOrderedBidiMapDecorator<K, V>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/bidimap/AbstractSortedBidiMapDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bidimap/AbstractSortedBidiMapDecorator.java b/src/java/org/apache/commons/collections/bidimap/AbstractSortedBidiMapDecorator.java
index 3fec108..29becea 100644
--- a/src/java/org/apache/commons/collections/bidimap/AbstractSortedBidiMapDecorator.java
+++ b/src/java/org/apache/commons/collections/bidimap/AbstractSortedBidiMapDecorator.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.
@@ -35,7 +35,7 @@ import org.apache.commons.collections.SortedBidiMap;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public abstract class AbstractSortedBidiMapDecorator<K, V> extends


[03/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestLazyMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestLazyMap.java b/src/test/org/apache/commons/collections/map/TestLazyMap.java
index ae3cb4f..d3394fb 100644
--- a/src/test/org/apache/commons/collections/map/TestLazyMap.java
+++ b/src/test/org/apache/commons/collections/map/TestLazyMap.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.
@@ -27,38 +27,38 @@ import org.apache.commons.collections.Transformer;
 import org.junit.Test;
 
 /**
- * Extension of {@link TestMap} for exercising the 
+ * Extension of {@link TestMap} for exercising the
  * {@link LazyMap} implementation.
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  */
-public class TestLazyMap extends AbstractTestMap {
-    
+public class TestLazyMap<K, V> extends AbstractTestMap<K, V> {
+
 	private static final Factory<Integer> oneFactory = FactoryUtils.constantFactory(1);
-    
+
     public TestLazyMap(String testName) {
         super(testName);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestLazyMap.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
 
     @Override
-	public <K,V> Map<K,V> makeEmptyMap() {
+	public LazyMap<K,V> makeObject() {
         return getLazyMap(new HashMap<K,V>(), FactoryUtils.<V>nullFactory());
     }
-    
+
     //-----------------------------------------------------------------------
     @Override
     public void testMapGet() {
     	//TODO eliminate need for this via superclass - see svn history.
     }
-    
+
     @Test
     public void mapGetWithFactory() {
         Map<Integer, Number> map = getLazyMap(new HashMap<Integer,Number>(), oneFactory);
@@ -70,13 +70,13 @@ public class TestLazyMap extends AbstractTestMap {
         assertEquals(1, i2);
         assertEquals(1, map.size());
         assertSame(i1, i2);
-        
+
         map = getLazyMap(new HashMap<Integer,Number>(), FactoryUtils.<Long>nullFactory());
         Object o = map.get("Five");
         assertEquals(null,o);
         assertEquals(1, map.size());
     }
-    
+
     @Test
     public void mapGetWithTransformer() {
     	Transformer<Number, Integer> intConverter = new Transformer<Number, Integer>(){
@@ -90,8 +90,8 @@ public class TestLazyMap extends AbstractTestMap {
     	assertEquals(123, i1);
     	assertEquals(1, map.size());
     }
-    
-    
+
+
     @Override
 	public String getCompatibilityVersion() {
         return "3.1";

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestLazySortedMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestLazySortedMap.java b/src/test/org/apache/commons/collections/map/TestLazySortedMap.java
index 2c56c46..c4841c4 100644
--- a/src/test/org/apache/commons/collections/map/TestLazySortedMap.java
+++ b/src/test/org/apache/commons/collections/map/TestLazySortedMap.java
@@ -38,7 +38,7 @@ import org.junit.Test;
  * 
  * @author Phil Steitz
  */
-public class TestLazySortedMap extends AbstractTestSortedMap {
+public class TestLazySortedMap<K, V> extends AbstractTestSortedMap<K, V> {
     
 	private static final Factory<Integer> oneFactory = FactoryUtils.constantFactory(1);
    
@@ -52,14 +52,10 @@ public class TestLazySortedMap extends AbstractTestSortedMap {
     }
 
     @Override
-	public <K,V> Map<K,V> makeEmptyMap() {
+	public SortedMap<K,V> makeObject() {
         return getLazySortedMap(new TreeMap<K,V>(), FactoryUtils.<V>nullFactory());
     }
     
-    private <K,V> SortedMap<K,V> makeTestSortedMap(Factory<V> factory) {
-        return getLazySortedMap(new TreeMap<K,V>(), factory);
-    }
-    
     @Override
 	public boolean isSubMapViewsSerializable() {
         // TODO TreeMap sub map views have a bug in deserialization.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestLinkedMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestLinkedMap.java b/src/test/org/apache/commons/collections/map/TestLinkedMap.java
index 326ce33..a298612 100644
--- a/src/test/org/apache/commons/collections/map/TestLinkedMap.java
+++ b/src/test/org/apache/commons/collections/map/TestLinkedMap.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.
@@ -32,12 +32,12 @@ import org.apache.commons.collections.list.AbstractTestList;
 
 /**
  * JUnit tests.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestLinkedMap extends AbstractTestOrderedMap {
+public class TestLinkedMap<K, V> extends AbstractTestOrderedMap<K, V> {
 
     public TestLinkedMap(String testName) {
         super(testName);
@@ -46,127 +46,137 @@ public class TestLinkedMap extends AbstractTestOrderedMap {
     public static void main(String[] args) {
         TestRunner.run(suite());
     }
-    
+
     public static Test suite() {
         return BulkTest.makeSuite(TestLinkedMap.class);
     }
 
-    public Map makeEmptyMap() {
-        return new LinkedMap();
+    public LinkedMap<K, V> makeObject() {
+        return new LinkedMap<K, V>();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public LinkedMap<K, V> makeFullMap() {
+        return (LinkedMap<K, V>) super.makeFullMap();
     }
 
     public String getCompatibilityVersion() {
         return "3";
     }
 
-    //-----------------------------------------------------------------------    
+    //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testReset() {
         resetEmpty();
-        OrderedMap ordered = (OrderedMap) map;
-        ((ResettableIterator) ordered.mapIterator()).reset();
-        
+        OrderedMap<K, V> ordered = getMap();
+        ((ResettableIterator<K>) ordered.mapIterator()).reset();
+
         resetFull();
-        ordered = (OrderedMap) map;
-        List list = new ArrayList(ordered.keySet());
-        ResettableIterator it = (ResettableIterator) ordered.mapIterator();
+        ordered = getMap();
+        List<K> list = new ArrayList<K>(ordered.keySet());
+        ResettableIterator<K> it = (ResettableIterator<K>) ordered.mapIterator();
         assertSame(list.get(0), it.next());
         assertSame(list.get(1), it.next());
         it.reset();
         assertSame(list.get(0), it.next());
     }
-    
+
     //-----------------------------------------------------------------------
     public void testInsertionOrder() {
         if (isPutAddSupported() == false || isPutChangeSupported() == false) return;
-        Object[] keys = getSampleKeys();
-        Object[] values = getSampleValues();
-        Iterator it = null;
-        
+        K[] keys = getSampleKeys();
+        V[] values = getSampleValues();
+        Iterator<K> keyIter;
+        Iterator<V> valueIter;
+
         resetEmpty();
         map.put(keys[0], values[0]);
         map.put(keys[1], values[1]);
-        it = map.keySet().iterator();
-        assertSame(keys[0], it.next());
-        assertSame(keys[1], it.next());
-        it = map.values().iterator();
-        assertSame(values[0], it.next());
-        assertSame(values[1], it.next());
+        keyIter = map.keySet().iterator();
+        assertSame(keys[0], keyIter.next());
+        assertSame(keys[1], keyIter.next());
+        valueIter = map.values().iterator();
+        assertSame(values[0], valueIter.next());
+        assertSame(values[1], valueIter.next());
 
         // no change to order
         map.put(keys[1], values[1]);
-        it = map.keySet().iterator();
-        assertSame(keys[0], it.next());
-        assertSame(keys[1], it.next());
-        it = map.values().iterator();
-        assertSame(values[0], it.next());
-        assertSame(values[1], it.next());
+        keyIter = map.keySet().iterator();
+        assertSame(keys[0], keyIter.next());
+        assertSame(keys[1], keyIter.next());
+        valueIter = map.values().iterator();
+        assertSame(values[0], valueIter.next());
+        assertSame(values[1], valueIter.next());
 
         // no change to order
         map.put(keys[1], values[2]);
-        it = map.keySet().iterator();
-        assertSame(keys[0], it.next());
-        assertSame(keys[1], it.next());
-        it = map.values().iterator();
-        assertSame(values[0], it.next());
-        assertSame(values[2], it.next());
+        keyIter = map.keySet().iterator();
+        assertSame(keys[0], keyIter.next());
+        assertSame(keys[1], keyIter.next());
+        valueIter = map.values().iterator();
+        assertSame(values[0], valueIter.next());
+        assertSame(values[2], valueIter.next());
 
         // no change to order
         map.put(keys[0], values[3]);
-        it = map.keySet().iterator();
-        assertSame(keys[0], it.next());
-        assertSame(keys[1], it.next());
-        it = map.values().iterator();
-        assertSame(values[3], it.next());
-        assertSame(values[2], it.next());
+        keyIter = map.keySet().iterator();
+        assertSame(keys[0], keyIter.next());
+        assertSame(keys[1], keyIter.next());
+        valueIter = map.values().iterator();
+        assertSame(values[3], valueIter.next());
+        assertSame(values[2], valueIter.next());
     }
-    
+
     //-----------------------------------------------------------------------
     public void testGetByIndex() {
         resetEmpty();
-        LinkedMap lm = (LinkedMap) map;
+        LinkedMap<K, V> lm = getMap();
         try {
             lm.get(0);
         } catch (IndexOutOfBoundsException ex) {}
         try {
             lm.get(-1);
         } catch (IndexOutOfBoundsException ex) {}
-        
+
         resetFull();
-        lm = (LinkedMap) map;
+        lm = getMap();
         try {
             lm.get(-1);
         } catch (IndexOutOfBoundsException ex) {}
         try {
             lm.get(lm.size());
         } catch (IndexOutOfBoundsException ex) {}
-        
+
         int i = 0;
-        for (MapIterator it = lm.mapIterator(); it.hasNext(); i++) {
+        for (MapIterator<K, V> it = lm.mapIterator(); it.hasNext(); i++) {
             assertSame(it.next(), lm.get(i));
         }
     }
 
     public void testGetValueByIndex() {
         resetEmpty();
-        LinkedMap lm = (LinkedMap) map;
+        LinkedMap<K, V> lm = getMap();
         try {
             lm.getValue(0);
         } catch (IndexOutOfBoundsException ex) {}
         try {
             lm.getValue(-1);
         } catch (IndexOutOfBoundsException ex) {}
-        
+
         resetFull();
-        lm = (LinkedMap) map;
+        lm = getMap();
         try {
             lm.getValue(-1);
         } catch (IndexOutOfBoundsException ex) {}
         try {
             lm.getValue(lm.size());
         } catch (IndexOutOfBoundsException ex) {}
-        
+
         int i = 0;
-        for (MapIterator it = lm.mapIterator(); it.hasNext(); i++) {
+        for (MapIterator<K, V> it = lm.mapIterator(); it.hasNext(); i++) {
             it.next();
             assertSame(it.getValue(), lm.getValue(i));
         }
@@ -174,13 +184,13 @@ public class TestLinkedMap extends AbstractTestOrderedMap {
 
     public void testIndexOf() {
         resetEmpty();
-        LinkedMap lm = (LinkedMap) map;
+        LinkedMap<K, V> lm = getMap();
         assertEquals(-1, lm.indexOf(getOtherKeys()));
-        
+
         resetFull();
-        lm = (LinkedMap) map;
-        List list = new ArrayList();
-        for (MapIterator it = lm.mapIterator(); it.hasNext();) {
+        lm = getMap();
+        List<K> list = new ArrayList<K>();
+        for (MapIterator<K, V> it = lm.mapIterator(); it.hasNext();) {
             list.add(it.next());
         }
         for (int i = 0; i < list.size(); i++) {
@@ -190,25 +200,25 @@ public class TestLinkedMap extends AbstractTestOrderedMap {
 
     public void testRemoveByIndex() {
         resetEmpty();
-        LinkedMap lm = (LinkedMap) map;
+        LinkedMap<K, V> lm = getMap();
         try {
             lm.remove(0);
         } catch (IndexOutOfBoundsException ex) {}
         try {
             lm.remove(-1);
         } catch (IndexOutOfBoundsException ex) {}
-        
+
         resetFull();
-        lm = (LinkedMap) map;
+        lm = getMap();
         try {
             lm.remove(-1);
         } catch (IndexOutOfBoundsException ex) {}
         try {
             lm.remove(lm.size());
         } catch (IndexOutOfBoundsException ex) {}
-        
-        List list = new ArrayList();
-        for (MapIterator it = lm.mapIterator(); it.hasNext();) {
+
+        List<K> list = new ArrayList<K>();
+        for (MapIterator<K, V> it = lm.mapIterator(); it.hasNext();) {
             list.add(it.next());
         }
         for (int i = 0; i < list.size(); i++) {
@@ -219,26 +229,26 @@ public class TestLinkedMap extends AbstractTestOrderedMap {
             assertEquals(false, lm.containsKey(key));
         }
     }
-    
+
     public BulkTest bulkTestListView() {
         return new TestListView();
     }
-    
-    public class TestListView extends AbstractTestList {
-        
+
+    public class TestListView extends AbstractTestList<K> {
+
         TestListView() {
             super("TestListView");
         }
 
-        public List makeEmptyList() {
-            return ((LinkedMap) TestLinkedMap.this.makeEmptyMap()).asList();
+        public List<K> makeObject() {
+            return TestLinkedMap.this.makeObject().asList();
         }
-        
-        public List makeFullList() {
-            return ((LinkedMap) TestLinkedMap.this.makeFullMap()).asList();
+
+        public List<K> makeFullCollection() {
+            return TestLinkedMap.this.makeFullMap().asList();
         }
-        
-        public Object[] getFullElements() {
+
+        public K[] getFullElements() {
             return TestLinkedMap.this.getSampleKeys();
         }
         public boolean isAddSupported() {
@@ -258,18 +268,27 @@ public class TestLinkedMap extends AbstractTestOrderedMap {
         }
     }
 
+    @SuppressWarnings("unchecked")
     public void testClone() {
-        LinkedMap map = new LinkedMap(10);
-        map.put("1", "1");
-        Map cloned = (Map) map.clone();
+        LinkedMap<K, V> map = new LinkedMap<K, V>(10);
+        map.put((K) "1", (V) "1");
+        Map<K, V> cloned = map.clone();
         assertEquals(map.size(), cloned.size());
         assertSame(map.get("1"), cloned.get("1"));
     }
-    
+
 //    public void testCreate() throws Exception {
 //        resetEmpty();
 //        writeExternalFormToDisk((java.io.Serializable) map, "D:/dev/collections/data/test/LinkedMap.emptyCollection.version3.obj");
 //        resetFull();
 //        writeExternalFormToDisk((java.io.Serializable) map, "D:/dev/collections/data/test/LinkedMap.fullCollection.version3.obj");
 //    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public LinkedMap<K, V> getMap() {
+        return (LinkedMap<K, V>) super.getMap();
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestListOrderedMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestListOrderedMap.java b/src/test/org/apache/commons/collections/map/TestListOrderedMap.java
index 2d4c3ab..7187d77 100644
--- a/src/test/org/apache/commons/collections/map/TestListOrderedMap.java
+++ b/src/test/org/apache/commons/collections/map/TestListOrderedMap.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.
@@ -19,7 +19,6 @@ package org.apache.commons.collections.map;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import junit.framework.Test;
 
@@ -33,12 +32,12 @@ import org.apache.commons.collections.list.AbstractTestList;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Henri Yandell
  * @author Stephen Colebourne
  * @author Matt Benson
  */
-public class TestListOrderedMap extends AbstractTestOrderedMap {
+public class TestListOrderedMap<K, V> extends AbstractTestOrderedMap<K, V> {
 
     public TestListOrderedMap(String testName) {
         super(testName);
@@ -53,57 +52,65 @@ public class TestListOrderedMap extends AbstractTestOrderedMap {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Map makeEmptyMap() {
-        return ListOrderedMap.decorate(new HashMap());
+    public ListOrderedMap<K, V> makeObject() {
+        return (ListOrderedMap<K, V>) ListOrderedMap.decorate(new HashMap<K, V>());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ListOrderedMap<K, V> makeFullMap() {
+        return (ListOrderedMap<K, V>) super.makeFullMap();
     }
-    
+
     //-----------------------------------------------------------------------
     public void testGetByIndex() {
         resetEmpty();
-        ListOrderedMap lom = (ListOrderedMap) map;
+        ListOrderedMap<K, V> lom = getMap();
         try {
             lom.get(0);
         } catch (IndexOutOfBoundsException ex) {}
         try {
             lom.get(-1);
         } catch (IndexOutOfBoundsException ex) {}
-        
+
         resetFull();
-        lom = (ListOrderedMap) map;
+        lom = getMap();
         try {
             lom.get(-1);
         } catch (IndexOutOfBoundsException ex) {}
         try {
             lom.get(lom.size());
         } catch (IndexOutOfBoundsException ex) {}
-        
+
         int i = 0;
-        for (MapIterator it = lom.mapIterator(); it.hasNext(); i++) {
+        for (MapIterator<K, V> it = lom.mapIterator(); it.hasNext(); i++) {
             assertSame(it.next(), lom.get(i));
         }
     }
 
     public void testGetValueByIndex() {
         resetEmpty();
-        ListOrderedMap lom = (ListOrderedMap) map;
+        ListOrderedMap<K, V> lom = getMap();
         try {
             lom.getValue(0);
         } catch (IndexOutOfBoundsException ex) {}
         try {
             lom.getValue(-1);
         } catch (IndexOutOfBoundsException ex) {}
-        
+
         resetFull();
-        lom = (ListOrderedMap) map;
+        lom = getMap();
         try {
             lom.getValue(-1);
         } catch (IndexOutOfBoundsException ex) {}
         try {
             lom.getValue(lom.size());
         } catch (IndexOutOfBoundsException ex) {}
-        
+
         int i = 0;
-        for (MapIterator it = lom.mapIterator(); it.hasNext(); i++) {
+        for (MapIterator<K, V> it = lom.mapIterator(); it.hasNext(); i++) {
             it.next();
             assertSame(it.getValue(), lom.getValue(i));
         }
@@ -111,13 +118,13 @@ public class TestListOrderedMap extends AbstractTestOrderedMap {
 
     public void testIndexOf() {
         resetEmpty();
-        ListOrderedMap lom = (ListOrderedMap) map;
+        ListOrderedMap<K, V> lom = getMap();
         assertEquals(-1, lom.indexOf(getOtherKeys()));
-        
+
         resetFull();
-        lom = (ListOrderedMap) map;
-        List list = new ArrayList();
-        for (MapIterator it = lom.mapIterator(); it.hasNext();) {
+        lom = getMap();
+        List<K> list = new ArrayList<K>();
+        for (MapIterator<K, V> it = lom.mapIterator(); it.hasNext();) {
             list.add(it.next());
         }
         for (int i = 0; i < list.size(); i++) {
@@ -125,54 +132,55 @@ public class TestListOrderedMap extends AbstractTestOrderedMap {
         }
     }
 
+    @SuppressWarnings("unchecked")
     public void testSetValueByIndex() {
         resetEmpty();
-        ListOrderedMap lom = (ListOrderedMap) map;
+        ListOrderedMap<K, V> lom = getMap();
         try {
-            lom.setValue(0, "");
+            lom.setValue(0, (V) "");
         } catch (IndexOutOfBoundsException ex) {}
         try {
-            lom.setValue(-1, "");
+            lom.setValue(-1, (V) "");
         } catch (IndexOutOfBoundsException ex) {}
-        
+
         resetFull();
-        lom = (ListOrderedMap) map;
+        lom = getMap();
         try {
-            lom.setValue(-1, "");
+            lom.setValue(-1, (V) "");
         } catch (IndexOutOfBoundsException ex) {}
         try {
-            lom.setValue(lom.size(), "");
+            lom.setValue(lom.size(), (V) "");
         } catch (IndexOutOfBoundsException ex) {}
-        
+
         for (int i = 0; i < lom.size(); i++) {
-            Object value = lom.getValue(i);
+            V value = lom.getValue(i);
             Object input = new Integer(i);
-            assertEquals(value, lom.setValue(i, input));
+            assertEquals(value, lom.setValue(i, (V) input));
             assertEquals(input, lom.getValue(i));
         }
     }
 
     public void testRemoveByIndex() {
         resetEmpty();
-        ListOrderedMap lom = (ListOrderedMap) map;
+        ListOrderedMap<K, V> lom = getMap();
         try {
             lom.remove(0);
         } catch (IndexOutOfBoundsException ex) {}
         try {
             lom.remove(-1);
         } catch (IndexOutOfBoundsException ex) {}
-        
+
         resetFull();
-        lom = (ListOrderedMap) map;
+        lom = getMap();
         try {
             lom.remove(-1);
         } catch (IndexOutOfBoundsException ex) {}
         try {
             lom.remove(lom.size());
         } catch (IndexOutOfBoundsException ex) {}
-        
-        List list = new ArrayList();
-        for (MapIterator it = lom.mapIterator(); it.hasNext();) {
+
+        List<K> list = new ArrayList<K>();
+        for (MapIterator<K, V> it = lom.mapIterator(); it.hasNext();) {
             list.add(it.next());
         }
         for (int i = 0; i < list.size(); i++) {
@@ -184,74 +192,75 @@ public class TestListOrderedMap extends AbstractTestOrderedMap {
         }
     }
 
+    @SuppressWarnings("unchecked")
     public void testPut_intObjectObject() {
         resetEmpty();
-        ListOrderedMap lom = (ListOrderedMap) map;
-        
+        ListOrderedMap<K, V> lom = getMap();
+
         try {
-            lom.put(1, "testInsert1", "testInsert1v");
+            lom.put(1, (K) "testInsert1", (V) "testInsert1v");
             fail("should not be able to insert at pos 1 in empty Map");
         } catch (IndexOutOfBoundsException ex) {}
         try {
-            lom.put(-1, "testInsert-1", "testInsert-1v");
+            lom.put(-1, (K) "testInsert-1", (V) "testInsert-1v");
             fail("should not be able to insert at pos -1 in empty Map");
         } catch (IndexOutOfBoundsException ex) {}
-        
+
         // put where key doesn't exist
-        lom.put(0, "testInsert1", "testInsert1v");
+        lom.put(0, (K) "testInsert1", (V) "testInsert1v");
         assertEquals("testInsert1v", lom.getValue(0));
-        
-        lom.put("testInsertPut", "testInsertPutv");
+
+        lom.put((K) "testInsertPut", (V) "testInsertPutv");
         assertEquals("testInsert1v", lom.getValue(0));
         assertEquals("testInsertPutv", lom.getValue(1));
-        
-        lom.put(0, "testInsert0", "testInsert0v");
+
+        lom.put(0, (K) "testInsert0", (V) "testInsert0v");
         assertEquals("testInsert0v", lom.getValue(0));
         assertEquals("testInsert1v", lom.getValue(1));
         assertEquals("testInsertPutv", lom.getValue(2));
-        
-        lom.put(3, "testInsert3", "testInsert3v");
+
+        lom.put(3, (K) "testInsert3", (V) "testInsert3v");
         assertEquals("testInsert0v", lom.getValue(0));
         assertEquals("testInsert1v", lom.getValue(1));
         assertEquals("testInsertPutv", lom.getValue(2));
         assertEquals("testInsert3v", lom.getValue(3));
-        
-        // put in a full map        
+
+        // put in a full map
         resetFull();
-        lom = (ListOrderedMap) map;
-        ListOrderedMap lom2 = new ListOrderedMap();
+        lom = getMap();
+        ListOrderedMap<K, V> lom2 = new ListOrderedMap<K, V>();
         lom2.putAll(lom);
-        
-        lom2.put(0, "testInsert0", "testInsert0v");
+
+        lom2.put(0, (K) "testInsert0", (V) "testInsert0v");
         assertEquals("testInsert0v", lom2.getValue(0));
         for (int i = 0; i < lom.size(); i++) {
             assertEquals(lom2.getValue(i + 1), lom.getValue(i));
         }
-        
+
         // put where key does exist
         Integer i1 = new Integer(1);
         Integer i1b = new Integer(1);
         Integer i2 = new Integer(2);
         Integer i3 = new Integer(3);
-        
+
         resetEmpty();
-        lom = (ListOrderedMap) map;
-        lom.put(i1, "1");
-        lom.put(i2, "2");
-        lom.put(i3, "3");
-        lom.put(0, i1, "One");
+        lom = getMap();
+        lom.put((K) i1, (V) "1");
+        lom.put((K) i2, (V) "2");
+        lom.put((K) i3, (V) "3");
+        lom.put(0, (K) i1, (V) "One");
         assertEquals(3, lom.size());
         assertEquals(3, lom.map.size());
         assertEquals(3, lom.insertOrder.size());
         assertEquals("One", lom.getValue(0));
         assertSame(i1, lom.get(0));
-        
+
         resetEmpty();
-        lom = (ListOrderedMap) map;
-        lom.put(i1, "1");
-        lom.put(i2, "2");
-        lom.put(i3, "3");
-        lom.put(0, i1b, "One");
+        lom = getMap();
+        lom.put((K) i1, (V) "1");
+        lom.put((K) i2, (V) "2");
+        lom.put((K) i3, (V) "3");
+        lom.put(0, (K) i1b, (V) "One");
         assertEquals(3, lom.size());
         assertEquals(3, lom.map.size());
         assertEquals(3, lom.insertOrder.size());
@@ -259,39 +268,39 @@ public class TestListOrderedMap extends AbstractTestOrderedMap {
         assertEquals("2", lom.getValue(1));
         assertEquals("3", lom.getValue(2));
         assertSame(i1b, lom.get(0));
-        
+
         resetEmpty();
-        lom = (ListOrderedMap) map;
-        lom.put(i1, "1");
-        lom.put(i2, "2");
-        lom.put(i3, "3");
-        lom.put(1, i1b, "One");
+        lom = getMap();
+        lom.put((K) i1, (V) "1");
+        lom.put((K) i2, (V) "2");
+        lom.put((K) i3, (V) "3");
+        lom.put(1, (K) i1b, (V) "One");
         assertEquals(3, lom.size());
         assertEquals(3, lom.map.size());
         assertEquals(3, lom.insertOrder.size());
         assertEquals("One", lom.getValue(0));
         assertEquals("2", lom.getValue(1));
         assertEquals("3", lom.getValue(2));
-        
+
         resetEmpty();
-        lom = (ListOrderedMap) map;
-        lom.put(i1, "1");
-        lom.put(i2, "2");
-        lom.put(i3, "3");
-        lom.put(2, i1b, "One");
+        lom = getMap();
+        lom.put((K) i1, (V) "1");
+        lom.put((K) i2, (V) "2");
+        lom.put((K) i3, (V) "3");
+        lom.put(2, (K) i1b, (V) "One");
         assertEquals(3, lom.size());
         assertEquals(3, lom.map.size());
         assertEquals(3, lom.insertOrder.size());
         assertEquals("2", lom.getValue(0));
         assertEquals("One", lom.getValue(1));
         assertEquals("3", lom.getValue(2));
-        
+
         resetEmpty();
-        lom = (ListOrderedMap) map;
-        lom.put(i1, "1");
-        lom.put(i2, "2");
-        lom.put(i3, "3");
-        lom.put(3, i1b, "One");
+        lom = getMap();
+        lom.put((K) i1, (V) "1");
+        lom.put((K) i2, (V) "2");
+        lom.put((K) i3, (V) "3");
+        lom.put(3, (K) i1b, (V) "One");
         assertEquals(3, lom.size());
         assertEquals(3, lom.map.size());
         assertEquals(3, lom.insertOrder.size());
@@ -303,20 +312,21 @@ public class TestListOrderedMap extends AbstractTestOrderedMap {
     //-----------------------------------------------------------------------
     public void testValueList_getByIndex() {
         resetFull();
-        ListOrderedMap lom = (ListOrderedMap) map;
+        ListOrderedMap<K, V> lom = getMap();
         for (int i = 0; i < lom.size(); i++) {
-            Object expected = lom.getValue(i);
+            V expected = lom.getValue(i);
             assertEquals(expected, lom.valueList().get(i));
         }
     }
 
+    @SuppressWarnings("unchecked")
     public void testValueList_setByIndex() {
         resetFull();
-        ListOrderedMap lom = (ListOrderedMap) map;
+        ListOrderedMap<K, V> lom = getMap();
         for (int i = 0; i < lom.size(); i++) {
             Object input = new Integer(i);
-            Object expected = lom.getValue(i);
-            assertEquals(expected, lom.valueList().set(i, input));
+            V expected = lom.getValue(i);
+            assertEquals(expected, lom.valueList().set(i, (V) input));
             assertEquals(input, lom.getValue(i));
             assertEquals(input, lom.valueList().get(i));
         }
@@ -324,9 +334,9 @@ public class TestListOrderedMap extends AbstractTestOrderedMap {
 
     public void testValueList_removeByIndex() {
         resetFull();
-        ListOrderedMap lom = (ListOrderedMap) map;
+        ListOrderedMap<K, V> lom = getMap();
         while (lom.size() > 1) {
-            Object expected = lom.getValue(1);
+            V expected = lom.getValue(1);
             assertEquals(expected, lom.valueList().remove(1));
         }
     }
@@ -341,19 +351,19 @@ public class TestListOrderedMap extends AbstractTestOrderedMap {
     }
 
     //-----------------------------------------------------------------------
-    public class TestKeyListView extends AbstractTestList {
+    public class TestKeyListView extends AbstractTestList<K> {
         TestKeyListView() {
             super("TestKeyListView");
         }
 
-        public List makeEmptyList() {
-            return ((ListOrderedMap) TestListOrderedMap.this.makeEmptyMap()).keyList();
+        public List<K> makeObject() {
+            return TestListOrderedMap.this.makeObject().keyList();
         }
-        public List makeFullList() {
-            return ((ListOrderedMap) TestListOrderedMap.this.makeFullMap()).keyList();
+        public List<K> makeFullCollection() {
+            return TestListOrderedMap.this.makeFullMap().keyList();
         }
 
-        public Object[] getFullElements() {
+        public K[] getFullElements() {
             return TestListOrderedMap.this.getSampleKeys();
         }
         public boolean isAddSupported() {
@@ -374,19 +384,19 @@ public class TestListOrderedMap extends AbstractTestOrderedMap {
     }
 
     //-----------------------------------------------------------------------
-    public class TestValueListView extends AbstractTestList {
+    public class TestValueListView extends AbstractTestList<V> {
         TestValueListView() {
             super("TestValueListView");
         }
 
-        public List makeEmptyList() {
-            return ((ListOrderedMap) TestListOrderedMap.this.makeEmptyMap()).valueList();
+        public List<V> makeObject() {
+            return TestListOrderedMap.this.makeObject().valueList();
         }
-        public List makeFullList() {
-            return ((ListOrderedMap) TestListOrderedMap.this.makeFullMap()).valueList();
+        public List<V> makeFullCollection() {
+            return TestListOrderedMap.this.makeFullMap().valueList();
         }
 
-        public Object[] getFullElements() {
+        public V[] getFullElements() {
             return TestListOrderedMap.this.getSampleValues();
         }
         public boolean isAddSupported() {
@@ -421,4 +431,12 @@ public class TestListOrderedMap extends AbstractTestOrderedMap {
 //            (java.io.Serializable) map,
 //            "D:/dev/collections/data/test/ListOrderedMap.fullCollection.version3.1.obj");
 //    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ListOrderedMap<K, V> getMap() {
+        return (ListOrderedMap<K, V>) super.getMap();
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestListOrderedMap2.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestListOrderedMap2.java b/src/test/org/apache/commons/collections/map/TestListOrderedMap2.java
index c7e0bb6..a45fa76 100644
--- a/src/test/org/apache/commons/collections/map/TestListOrderedMap2.java
+++ b/src/test/org/apache/commons/collections/map/TestListOrderedMap2.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.map;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
 
 import junit.framework.Test;
 
@@ -32,11 +31,11 @@ import org.apache.commons.collections.list.AbstractTestList;
  *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Henri Yandell
  * @author Stephen Colebourne
  */
-public class TestListOrderedMap2 extends AbstractTestOrderedMap {
+public class TestListOrderedMap2<K, V> extends AbstractTestOrderedMap<K, V> {
 
     public TestListOrderedMap2(String testName) {
         super(testName);
@@ -51,57 +50,65 @@ public class TestListOrderedMap2 extends AbstractTestOrderedMap {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Map makeEmptyMap() {
-        return new ListOrderedMap();
+    public ListOrderedMap<K, V> makeObject() {
+        return new ListOrderedMap<K, V>();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ListOrderedMap<K, V> makeFullMap() {
+        return (ListOrderedMap<K, V>) super.makeFullMap();
     }
-    
+
     //-----------------------------------------------------------------------
     public void testGetByIndex() {
         resetEmpty();
-        ListOrderedMap lom = (ListOrderedMap) map;
+        ListOrderedMap<K, V> lom = getMap();
         try {
             lom.get(0);
         } catch (IndexOutOfBoundsException ex) {}
         try {
             lom.get(-1);
         } catch (IndexOutOfBoundsException ex) {}
-        
+
         resetFull();
-        lom = (ListOrderedMap) map;
+        lom = getMap();
         try {
             lom.get(-1);
         } catch (IndexOutOfBoundsException ex) {}
         try {
             lom.get(lom.size());
         } catch (IndexOutOfBoundsException ex) {}
-        
+
         int i = 0;
-        for (MapIterator it = lom.mapIterator(); it.hasNext(); i++) {
+        for (MapIterator<K, V> it = lom.mapIterator(); it.hasNext(); i++) {
             assertSame(it.next(), lom.get(i));
         }
     }
 
     public void testGetValueByIndex() {
         resetEmpty();
-        ListOrderedMap lom = (ListOrderedMap) map;
+        ListOrderedMap<K, V> lom = getMap();
         try {
             lom.getValue(0);
         } catch (IndexOutOfBoundsException ex) {}
         try {
             lom.getValue(-1);
         } catch (IndexOutOfBoundsException ex) {}
-        
+
         resetFull();
-        lom = (ListOrderedMap) map;
+        lom = getMap();
         try {
             lom.getValue(-1);
         } catch (IndexOutOfBoundsException ex) {}
         try {
             lom.getValue(lom.size());
         } catch (IndexOutOfBoundsException ex) {}
-        
+
         int i = 0;
-        for (MapIterator it = lom.mapIterator(); it.hasNext(); i++) {
+        for (MapIterator<K, V> it = lom.mapIterator(); it.hasNext(); i++) {
             it.next();
             assertSame(it.getValue(), lom.getValue(i));
         }
@@ -109,13 +116,13 @@ public class TestListOrderedMap2 extends AbstractTestOrderedMap {
 
     public void testIndexOf() {
         resetEmpty();
-        ListOrderedMap lom = (ListOrderedMap) map;
+        ListOrderedMap<K, V> lom = getMap();
         assertEquals(-1, lom.indexOf(getOtherKeys()));
-        
+
         resetFull();
-        lom = (ListOrderedMap) map;
-        List list = new ArrayList();
-        for (MapIterator it = lom.mapIterator(); it.hasNext();) {
+        lom = getMap();
+        List<K> list = new ArrayList<K>();
+        for (MapIterator<K, V> it = lom.mapIterator(); it.hasNext();) {
             list.add(it.next());
         }
         for (int i = 0; i < list.size(); i++) {
@@ -125,25 +132,25 @@ public class TestListOrderedMap2 extends AbstractTestOrderedMap {
 
     public void testRemoveByIndex() {
         resetEmpty();
-        ListOrderedMap lom = (ListOrderedMap) map;
+        ListOrderedMap<K, V> lom = getMap();
         try {
             lom.remove(0);
         } catch (IndexOutOfBoundsException ex) {}
         try {
             lom.remove(-1);
         } catch (IndexOutOfBoundsException ex) {}
-        
+
         resetFull();
-        lom = (ListOrderedMap) map;
+        lom = getMap();
         try {
             lom.remove(-1);
         } catch (IndexOutOfBoundsException ex) {}
         try {
             lom.remove(lom.size());
         } catch (IndexOutOfBoundsException ex) {}
-        
-        List list = new ArrayList();
-        for (MapIterator it = lom.mapIterator(); it.hasNext();) {
+
+        List<K> list = new ArrayList<K>();
+        for (MapIterator<K, V> it = lom.mapIterator(); it.hasNext();) {
             list.add(it.next());
         }
         for (int i = 0; i < list.size(); i++) {
@@ -154,26 +161,26 @@ public class TestListOrderedMap2 extends AbstractTestOrderedMap {
             assertEquals(false, lom.containsKey(key));
         }
     }
-    
+
     public BulkTest bulkTestListView() {
         return new TestListView();
     }
-    
-    public class TestListView extends AbstractTestList {
-        
+
+    public class TestListView extends AbstractTestList<K> {
+
         TestListView() {
             super("TestListView");
         }
 
-        public List makeEmptyList() {
-            return ((ListOrderedMap) TestListOrderedMap2.this.makeEmptyMap()).asList();
+        public List<K> makeObject() {
+            return TestListOrderedMap2.this.makeObject().asList();
         }
-        
-        public List makeFullList() {
-            return ((ListOrderedMap) TestListOrderedMap2.this.makeFullMap()).asList();
+
+        public List<K> makeFullCollection() {
+            return TestListOrderedMap2.this.makeFullMap().asList();
         }
-        
-        public Object[] getFullElements() {
+
+        public K[] getFullElements() {
             return TestListOrderedMap2.this.getSampleKeys();
         }
         public boolean isAddSupported() {
@@ -207,4 +214,13 @@ public class TestListOrderedMap2 extends AbstractTestOrderedMap {
 //            (java.io.Serializable) map,
 //            "D:/dev/collections/data/test/ListOrderedMap.fullCollection.version3.1.obj");
 //    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ListOrderedMap<K, V> getMap() {
+        // TODO Auto-generated method stub
+        return (ListOrderedMap<K, V>) super.getMap();
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java b/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java
index 01747e3..b86db2c 100644
--- a/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java
+++ b/src/test/org/apache/commons/collections/map/TestMultiKeyMap.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.
@@ -27,13 +27,13 @@ import org.apache.commons.collections.keyvalue.MultiKey;
 
 /**
  * JUnit tests.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestMultiKeyMap extends AbstractTestIterableMap {
-    
+public class TestMultiKeyMap<K, V> extends AbstractTestIterableMap<MultiKey<? extends K>, V> {
+
     static final Integer I1 = new Integer(1);
     static final Integer I2 = new Integer(2);
     static final Integer I3 = new Integer(3);
@@ -55,15 +55,16 @@ public class TestMultiKeyMap extends AbstractTestIterableMap {
         return BulkTest.makeSuite(TestMultiKeyMap.class);
     }
 
-    public Map makeEmptyMap() {
-        return new MultiKeyMap();
+    public MultiKeyMap<K, V> makeObject() {
+        return new MultiKeyMap<K, V>();
     }
 
-    public Object[] getSampleKeys() {
+    public MultiKey<K>[] getSampleKeys() {
         return getMultiKeyKeys();
     }
 
-    private MultiKey[] getMultiKeyKeys() {
+    @SuppressWarnings("unchecked")
+    private MultiKey<K>[] getMultiKeyKeys() {
         return new MultiKey[] {
             new MultiKey(I1, I2),
             new MultiKey(I2, I3),
@@ -80,8 +81,9 @@ public class TestMultiKeyMap extends AbstractTestIterableMap {
         };
     }
 
-    public Object[] getSampleValues() {
-        return new Object[] {
+    @SuppressWarnings("unchecked")
+    public V[] getSampleValues() {
+        return (V[]) new Object[] {
             "2A", "2B", "2C",
             "3D", "3E", "3F",
             "4G", "4H", "4I",
@@ -89,8 +91,9 @@ public class TestMultiKeyMap extends AbstractTestIterableMap {
         };
     }
 
-    public Object[] getNewSampleValues() {
-        return new Object[] {
+    @SuppressWarnings("unchecked")
+    public V[] getNewSampleValues() {
+        return (V[]) new Object[] {
             "1a", "1b", "1c",
             "2d", "2e", "2f",
             "3g", "3h", "3i",
@@ -98,20 +101,22 @@ public class TestMultiKeyMap extends AbstractTestIterableMap {
         };
     }
 
-    public Object[] getOtherKeys() {
-        return new Object[] {
+    @SuppressWarnings("unchecked")
+    public MultiKey<K>[] getOtherKeys() {
+        return (MultiKey<K>[]) new MultiKey[] {
             new MultiKey(I1, I7),
             new MultiKey(I1, I8),
             new MultiKey(I2, I4),
             new MultiKey(I2, I5),
         };
     }
-    
+
     public boolean isAllowNullKey() {
         return false;
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testNullHandling() {
         resetFull();
         assertEquals(null, map.get(null));
@@ -125,9 +130,9 @@ public class TestMultiKeyMap extends AbstractTestIterableMap {
             map.put(null, null);
             fail();
         } catch (NullPointerException ex) {}
-        assertEquals(null, map.put(new MultiKey(null, null), null));
+        assertEquals(null, map.put(new MultiKey<K>(null, null), null));
         try {
-            map.put(null, new Object());
+            map.put(null, (V) new Object());
             fail();
         } catch (NullPointerException ex) {}
     }
@@ -135,14 +140,14 @@ public class TestMultiKeyMap extends AbstractTestIterableMap {
     //-----------------------------------------------------------------------
     public void testMultiKeyGet() {
         resetFull();
-        MultiKeyMap multimap = (MultiKeyMap) map;
-        MultiKey[] keys = getMultiKeyKeys();
-        Object[] values = getSampleValues();
-        
+        MultiKeyMap<K, V> multimap = getMap();
+        MultiKey<K>[] keys = getMultiKeyKeys();
+        V[] values = getSampleValues();
+
         for (int i = 0; i < keys.length; i++) {
-            MultiKey key = keys[i];
-            Object value = values[i];
-            
+            MultiKey<K> key = keys[i];
+            V value = values[i];
+
             switch (key.size()) {
                 case 2:
                 assertEquals(value, multimap.get(key.getKey(0), key.getKey(1)));
@@ -185,17 +190,15 @@ public class TestMultiKeyMap extends AbstractTestIterableMap {
             }
         }
     }
-    
+
     public void testMultiKeyContainsKey() {
         resetFull();
-        MultiKeyMap multimap = (MultiKeyMap) map;
-        MultiKey[] keys = getMultiKeyKeys();
-        Object[] values = getSampleValues();
-        
+        MultiKeyMap<K, V> multimap = getMap();
+        MultiKey<K>[] keys = getMultiKeyKeys();
+
         for (int i = 0; i < keys.length; i++) {
-            MultiKey key = keys[i];
-            Object value = values[i];
-            
+            MultiKey<K> key = keys[i];
+
             switch (key.size()) {
                 case 2:
                 assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1)));
@@ -238,24 +241,24 @@ public class TestMultiKeyMap extends AbstractTestIterableMap {
             }
         }
     }
-    
+
     public void testMultiKeyPut() {
-        MultiKey[] keys = getMultiKeyKeys();
-        Object[] values = getSampleValues();
-        
+        MultiKey<K>[] keys = getMultiKeyKeys();
+        V[] values = getSampleValues();
+
         for (int i = 0; i < keys.length; i++) {
-            MultiKeyMap multimap = new MultiKeyMap();
-            
-            MultiKey key = keys[i];
-            Object value = values[i];
-            
+            MultiKeyMap<K, V> multimap = new MultiKeyMap<K, V>();
+
+            MultiKey<K> key = keys[i];
+            V value = values[i];
+
             switch (key.size()) {
                 case 2:
                 assertEquals(null, multimap.put(key.getKey(0), key.getKey(1), value));
                 assertEquals(1, multimap.size());
                 assertEquals(value, multimap.get(key.getKey(0), key.getKey(1)));
                 assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1)));
-                assertEquals(true, multimap.containsKey(new MultiKey(key.getKey(0), key.getKey(1))));
+                assertEquals(true, multimap.containsKey(new MultiKey<K>(key.getKey(0), key.getKey(1))));
                 assertEquals(value, multimap.put(key.getKey(0), key.getKey(1), null));
                 assertEquals(1, multimap.size());
                 assertEquals(null, multimap.get(key.getKey(0), key.getKey(1)));
@@ -266,7 +269,7 @@ public class TestMultiKeyMap extends AbstractTestIterableMap {
                 assertEquals(1, multimap.size());
                 assertEquals(value, multimap.get(key.getKey(0), key.getKey(1), key.getKey(2)));
                 assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2)));
-                assertEquals(true, multimap.containsKey(new MultiKey(key.getKey(0), key.getKey(1), key.getKey(2))));
+                assertEquals(true, multimap.containsKey(new MultiKey<K>(key.getKey(0), key.getKey(1), key.getKey(2))));
                 assertEquals(value, multimap.put(key.getKey(0), key.getKey(1), key.getKey(2), null));
                 assertEquals(1, multimap.size());
                 assertEquals(null, multimap.get(key.getKey(0), key.getKey(1), key.getKey(2)));
@@ -277,7 +280,7 @@ public class TestMultiKeyMap extends AbstractTestIterableMap {
                 assertEquals(1, multimap.size());
                 assertEquals(value, multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3)));
                 assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3)));
-                assertEquals(true, multimap.containsKey(new MultiKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3))));
+                assertEquals(true, multimap.containsKey(new MultiKey<K>(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3))));
                 assertEquals(value, multimap.put(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), null));
                 assertEquals(1, multimap.size());
                 assertEquals(null, multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3)));
@@ -288,7 +291,7 @@ public class TestMultiKeyMap extends AbstractTestIterableMap {
                 assertEquals(1, multimap.size());
                 assertEquals(value, multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
                 assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
-                assertEquals(true, multimap.containsKey(new MultiKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4))));
+                assertEquals(true, multimap.containsKey(new MultiKey<K>(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4))));
                 assertEquals(value, multimap.put(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4), null));
                 assertEquals(1, multimap.size());
                 assertEquals(null, multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
@@ -299,19 +302,19 @@ public class TestMultiKeyMap extends AbstractTestIterableMap {
             }
         }
     }
-    
+
     public void testMultiKeyRemove() {
-        MultiKey[] keys = getMultiKeyKeys();
-        Object[] values = getSampleValues();
-        
+        MultiKey<K>[] keys = getMultiKeyKeys();
+        V[] values = getSampleValues();
+
         for (int i = 0; i < keys.length; i++) {
             resetFull();
-            MultiKeyMap multimap = (MultiKeyMap) map;
+            MultiKeyMap<K, V> multimap = getMap();
             int size = multimap.size();
-            
-            MultiKey key = keys[i];
-            Object value = values[i];
-            
+
+            MultiKey<K> key = keys[i];
+            V value = values[i];
+
             switch (key.size()) {
                 case 2:
                 assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1)));
@@ -350,86 +353,88 @@ public class TestMultiKeyMap extends AbstractTestIterableMap {
             }
         }
     }
-    
+
     public void testMultiKeyRemoveAll1() {
         resetFull();
-        MultiKeyMap multimap = (MultiKeyMap) map;
+        MultiKeyMap<K, V> multimap = getMap();
         assertEquals(12, multimap.size());
-        
+
         multimap.removeAll(I1);
         assertEquals(8, multimap.size());
-        for (MapIterator it = multimap.mapIterator(); it.hasNext();) {
-            MultiKey key = (MultiKey) it.next();
+        for (MapIterator<MultiKey<? extends K>, V> it = multimap.mapIterator(); it.hasNext();) {
+            MultiKey<? extends K> key = it.next();
             assertEquals(false, I1.equals(key.getKey(0)));
         }
     }
-    
+
     public void testMultiKeyRemoveAll2() {
         resetFull();
-        MultiKeyMap multimap = (MultiKeyMap) map;
+        MultiKeyMap<K, V> multimap = getMap();
         assertEquals(12, multimap.size());
-        
+
         multimap.removeAll(I2, I3);
         assertEquals(9, multimap.size());
-        for (MapIterator it = multimap.mapIterator(); it.hasNext();) {
-            MultiKey key = (MultiKey) it.next();
+        for (MapIterator<MultiKey<? extends K>, V> it = multimap.mapIterator(); it.hasNext();) {
+            MultiKey<? extends K> key = it.next();
             assertEquals(false, I2.equals(key.getKey(0)) && I3.equals(key.getKey(1)));
         }
     }
-    
+
     public void testMultiKeyRemoveAll3() {
         resetFull();
-        MultiKeyMap multimap = (MultiKeyMap) map;
+        MultiKeyMap<K, V> multimap = getMap();
         assertEquals(12, multimap.size());
-        
+
         multimap.removeAll(I1, I1, I2);
         assertEquals(9, multimap.size());
-        for (MapIterator it = multimap.mapIterator(); it.hasNext();) {
-            MultiKey key = (MultiKey) it.next();
+        for (MapIterator<MultiKey<? extends K>, V> it = multimap.mapIterator(); it.hasNext();) {
+            MultiKey<? extends K> key = it.next();
             assertEquals(false, I1.equals(key.getKey(0)) && I1.equals(key.getKey(1)) && I2.equals(key.getKey(2)));
         }
     }
-    
+
     public void testMultiKeyRemoveAll4() {
         resetFull();
-        MultiKeyMap multimap = (MultiKeyMap) map;
+        MultiKeyMap<K, V> multimap = getMap();
         assertEquals(12, multimap.size());
-        
+
         multimap.removeAll(I1, I1, I2, I3);
         assertEquals(10, multimap.size());
-        for (MapIterator it = multimap.mapIterator(); it.hasNext();) {
-            MultiKey key = (MultiKey) it.next();
+        for (MapIterator<MultiKey<? extends K>, V> it = multimap.mapIterator(); it.hasNext();) {
+            MultiKey<? extends K> key = it.next();
             assertEquals(false, I1.equals(key.getKey(0)) && I1.equals(key.getKey(1)) && I2.equals(key.getKey(2)) && key.size() >= 4 && I3.equals(key.getKey(3)));
         }
     }
-    
+
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testClone() {
-        MultiKeyMap map = new MultiKeyMap();
-        map.put(new MultiKey(I1, I2), "1-2");
-        Map cloned = (Map) map.clone();
+        MultiKeyMap<K, V> map = new MultiKeyMap<K, V>();
+        map.put(new MultiKey<K>((K) I1, (K) I2), (V) "1-2");
+        Map<MultiKey<? extends K>, V> cloned = map.clone();
         assertEquals(map.size(), cloned.size());
-        assertSame(map.get(new MultiKey(I1, I2)), cloned.get(new MultiKey(I1, I2)));
+        assertSame(map.get(new MultiKey<K>((K) I1, (K) I2)), cloned.get(new MultiKey<K>((K) I1, (K) I2)));
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testLRUMultiKeyMap() {
-        MultiKeyMap map = MultiKeyMap.decorate(new LRUMap(2));
-        map.put(I1, I2, "1-2");
-        map.put(I1, I3, "1-3");
+        MultiKeyMap<K, V> map = MultiKeyMap.decorate(new LRUMap<MultiKey<? extends K>, V>(2));
+        map.put((K) I1, (K) I2, (V) "1-2");
+        map.put((K) I1, (K) I3, (V) "1-1");
         assertEquals(2, map.size());
-        map.put(I1, I4, "1-4");
+        map.put((K) I1, (K) I4, (V) "1-4");
         assertEquals(2, map.size());
         assertEquals(true, map.containsKey(I1, I3));
         assertEquals(true, map.containsKey(I1, I4));
         assertEquals(false, map.containsKey(I1, I2));
-        
-        MultiKeyMap cloned = (MultiKeyMap) map.clone();
+
+        MultiKeyMap<K, V> cloned = map.clone();
         assertEquals(2, map.size());
         assertEquals(true, cloned.containsKey(I1, I3));
         assertEquals(true, cloned.containsKey(I1, I4));
         assertEquals(false, cloned.containsKey(I1, I2));
-        cloned.put(I1, I5, "1-5");
+        cloned.put((K) I1, (K) I5, (V) "1-5");
         assertEquals(2, cloned.size());
         assertEquals(true, cloned.containsKey(I1, I4));
         assertEquals(true, cloned.containsKey(I1, I5));
@@ -450,4 +455,12 @@ public class TestMultiKeyMap extends AbstractTestIterableMap {
 //            (java.io.Serializable) map,
 //            "D:/dev/collections/data/test/MultiKeyMap.fullCollection.version3.1.obj");
 //    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public MultiKeyMap<K, V> getMap() {
+        return (MultiKeyMap<K, V>) super.getMap();
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestMultiValueMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestMultiValueMap.java b/src/test/org/apache/commons/collections/map/TestMultiValueMap.java
index bd25c44..cf85ddf 100644
--- a/src/test/org/apache/commons/collections/map/TestMultiValueMap.java
+++ b/src/test/org/apache/commons/collections/map/TestMultiValueMap.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.
@@ -39,7 +39,7 @@ import org.apache.commons.collections.MultiMap;
  * @author Stephen Colebourne
  * @since Commons Collections 3.2
  */
-public class TestMultiValueMap extends TestCase {
+public class TestMultiValueMap<K, V> extends TestCase {
 
     public TestMultiValueMap(String testName) {
         super(testName);
@@ -55,25 +55,28 @@ public class TestMultiValueMap extends TestCase {
     }
 
     public void testNoMappingReturnsNull() {
-        final MultiValueMap map = createTestMap();
+        final MultiValueMap<K, V> map = createTestMap();
         assertNull(map.get("whatever"));
     }
 
+    @SuppressWarnings("unchecked")
     public void testValueCollectionType() {
-        final MultiValueMap map = createTestMap(LinkedList.class);
+        final MultiValueMap<K, V> map = createTestMap(LinkedList.class);
         assertTrue(map.get("one") instanceof LinkedList);
     }
 
+    @SuppressWarnings("unchecked")
     public void testMultipleValues() {
-        final MultiValueMap map = createTestMap(HashSet.class);
-        final HashSet expected = new HashSet();
-        expected.add("uno");
-        expected.add("un");
+        final MultiValueMap<K, V> map = createTestMap(HashSet.class);
+        final HashSet<V> expected = new HashSet<V>();
+        expected.add((V) "uno");
+        expected.add((V) "un");
         assertEquals(expected, map.get("one"));
     }
 
+    @SuppressWarnings("unchecked")
     public void testContainsValue() {
-        final MultiValueMap map = createTestMap(HashSet.class);
+        final MultiValueMap<K, V> map = createTestMap(HashSet.class);
         assertTrue(map.containsValue("uno"));
         assertTrue(map.containsValue("un"));
         assertTrue(map.containsValue("dos"));
@@ -83,56 +86,60 @@ public class TestMultiValueMap extends TestCase {
         assertFalse(map.containsValue("quatro"));
     }
 
+    @SuppressWarnings("unchecked")
     public void testKeyContainsValue() {
-        final MultiValueMap map = createTestMap(HashSet.class);
-        assertTrue(map.containsValue("one", "uno"));
-        assertTrue(map.containsValue("one", "un"));
-        assertTrue(map.containsValue("two", "dos"));
-        assertTrue(map.containsValue("two", "deux"));
-        assertTrue(map.containsValue("three", "tres"));
-        assertTrue(map.containsValue("three", "trois"));
-        assertFalse(map.containsValue("four", "quatro"));
+        final MultiValueMap<K, V> map = createTestMap(HashSet.class);
+        assertTrue(map.containsValue((K) "one", "uno"));
+        assertTrue(map.containsValue((K) "one", "un"));
+        assertTrue(map.containsValue((K) "two", "dos"));
+        assertTrue(map.containsValue((K) "two", "deux"));
+        assertTrue(map.containsValue((K) "three", "tres"));
+        assertTrue(map.containsValue((K) "three", "trois"));
+        assertFalse(map.containsValue((K) "four", "quatro"));
     }
 
+    @SuppressWarnings("unchecked")
     public void testValues() {
-        final MultiValueMap map = createTestMap(HashSet.class);
-        final HashSet expected = new HashSet();
-        expected.add("uno");
-        expected.add("dos");
-        expected.add("tres");
-        expected.add("un");
-        expected.add("deux");
-        expected.add("trois");
-        final Collection c = map.values();
+        final MultiValueMap<K, V> map = createTestMap(HashSet.class);
+        final HashSet<V> expected = new HashSet<V>();
+        expected.add((V) "uno");
+        expected.add((V) "dos");
+        expected.add((V) "tres");
+        expected.add((V) "un");
+        expected.add((V) "deux");
+        expected.add((V) "trois");
+        final Collection<Object> c = map.values();
         assertEquals(6, c.size());
-        assertEquals(expected, new HashSet(c));
+        assertEquals(expected, new HashSet<Object>(c));
     }
 
-    private MultiValueMap createTestMap() {
+    @SuppressWarnings("unchecked")
+    private MultiValueMap<K, V> createTestMap() {
         return createTestMap(ArrayList.class);
     }
 
-    private MultiValueMap createTestMap(Class collectionClass) {
-        final MultiValueMap map = MultiValueMap.decorate(new HashMap(), collectionClass);
-        map.put("one", "uno");
-        map.put("one", "un");
-        map.put("two", "dos");
-        map.put("two", "deux");
-        map.put("three", "tres");
-        map.put("three", "trois");
+    @SuppressWarnings("unchecked")
+    private <C extends Collection<V>> MultiValueMap<K, V> createTestMap(Class<C> collectionClass) {
+        final MultiValueMap<K, V> map = MultiValueMap.decorate(new HashMap<K, C>(), collectionClass);
+        map.put((K) "one", (V) "uno");
+        map.put((K) "one", (V) "un");
+        map.put((K) "two", (V) "dos");
+        map.put((K) "two", (V) "deux");
+        map.put((K) "three", (V) "tres");
+        map.put((K) "three", (V) "trois");
         return map;
     }
 
     public void testKeyedIterator() {
-        final MultiValueMap map = createTestMap();
-        final ArrayList actual = new ArrayList(IteratorUtils.toList(map.iterator("one")));
-        final ArrayList expected = new ArrayList(Arrays.asList(new String[]{"uno", "un"}));
+        final MultiValueMap<K, V> map = createTestMap();
+        final ArrayList<Object> actual = new ArrayList<Object>(IteratorUtils.toList(map.iterator("one")));
+        final ArrayList<Object> expected = new ArrayList<Object>(Arrays.asList(new String[]{ "uno", "un" }));
         assertEquals(expected, actual);
     }
 
     public void testRemoveAllViaIterator() {
-        final MultiValueMap map = createTestMap();
-        for(Iterator i = map.values().iterator(); i.hasNext();) {
+        final MultiValueMap<K, V> map = createTestMap();
+        for (Iterator<?> i = map.values().iterator(); i.hasNext();) {
             i.next();
             i.remove();
         }
@@ -141,8 +148,8 @@ public class TestMultiValueMap extends TestCase {
     }
 
     public void testRemoveAllViaKeyedIterator() {
-        final MultiValueMap map = createTestMap();
-        for(Iterator i = map.iterator("one"); i.hasNext();) {
+        final MultiValueMap<K, V> map = createTestMap();
+        for (Iterator<?> i = map.iterator("one"); i.hasNext();) {
             i.next();
             i.remove();
         }
@@ -155,71 +162,76 @@ public class TestMultiValueMap extends TestCase {
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testMapEquals() {
-        MultiValueMap one = new MultiValueMap();
+        MultiValueMap<K, V> one = new MultiValueMap<K, V>();
         Integer value = new Integer(1);
-        one.put("One", value);
+        one.put((K) "One", value);
         one.remove("One", value);
-        
-        MultiValueMap two = new MultiValueMap();
+
+        MultiValueMap<K, V> two = new MultiValueMap<K, V>();
         assertEquals(two, one);
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testGetCollection() {
-        MultiValueMap map = new MultiValueMap();
-        map.put("A", "AA");
+        MultiValueMap<K, V> map = new MultiValueMap<K, V>();
+        map.put((K) "A", "AA");
         assertSame(map.get("A"), map.getCollection("A"));
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testTotalSize() {
-        MultiValueMap map = new MultiValueMap();
+        MultiValueMap<K, V> map = new MultiValueMap<K, V>();
         assertEquals(0, map.totalSize());
-        map.put("A", "AA");
+        map.put((K) "A", "AA");
         assertEquals(1, map.totalSize());
-        map.put("B", "BA");
+        map.put((K) "B", "BA");
         assertEquals(2, map.totalSize());
-        map.put("B", "BB");
+        map.put((K) "B", "BB");
         assertEquals(3, map.totalSize());
-        map.put("B", "BC");
+        map.put((K) "B", "BC");
         assertEquals(4, map.totalSize());
         map.remove("A");
         assertEquals(3, map.totalSize());
         map.remove("B", "BC");
         assertEquals(2, map.totalSize());
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testSize() {
-        MultiValueMap map = new MultiValueMap();
+        MultiValueMap<K, V> map = new MultiValueMap<K, V>();
         assertEquals(0, map.size());
-        map.put("A", "AA");
+        map.put((K) "A", "AA");
         assertEquals(1, map.size());
-        map.put("B", "BA");
+        map.put((K) "B", "BA");
         assertEquals(2, map.size());
-        map.put("B", "BB");
+        map.put((K) "B", "BB");
         assertEquals(2, map.size());
-        map.put("B", "BC");
+        map.put((K) "B", "BC");
         assertEquals(2, map.size());
         map.remove("A");
         assertEquals(1, map.size());
         map.remove("B", "BC");
         assertEquals(1, map.size());
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testSize_Key() {
-        MultiValueMap map = new MultiValueMap();
+        MultiValueMap<K, V> map = new MultiValueMap<K, V>();
         assertEquals(0, map.size("A"));
         assertEquals(0, map.size("B"));
-        map.put("A", "AA");
+        map.put((K) "A", "AA");
         assertEquals(1, map.size("A"));
         assertEquals(0, map.size("B"));
-        map.put("B", "BA");
+        map.put((K) "B", "BA");
         assertEquals(1, map.size("A"));
         assertEquals(1, map.size("B"));
-        map.put("B", "BB");
+        map.put((K) "B", "BB");
         assertEquals(1, map.size("A"));
         assertEquals(2, map.size("B"));
-        map.put("B", "BC");
+        map.put((K) "B", "BC");
         assertEquals(1, map.size("A"));
         assertEquals(3, map.size("B"));
         map.remove("A");
@@ -229,53 +241,58 @@ public class TestMultiValueMap extends TestCase {
         assertEquals(0, map.size("A"));
         assertEquals(2, map.size("B"));
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testIterator_Key() {
-        MultiValueMap map = new MultiValueMap();
+        MultiValueMap<K, V> map = new MultiValueMap<K, V>();
         assertEquals(false, map.iterator("A").hasNext());
-        map.put("A", "AA");
-        Iterator it = map.iterator("A");
+        map.put((K) "A", "AA");
+        Iterator<?> it = map.iterator("A");
         assertEquals(true, it.hasNext());
         it.next();
         assertEquals(false, it.hasNext());
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testContainsValue_Key() {
-        MultiValueMap map = new MultiValueMap();
+        MultiValueMap<K, V> map = new MultiValueMap<K, V>();
         assertEquals(false, map.containsValue("A", "AA"));
         assertEquals(false, map.containsValue("B", "BB"));
-        map.put("A", "AA");
+        map.put((K) "A", "AA");
         assertEquals(true, map.containsValue("A", "AA"));
         assertEquals(false, map.containsValue("A", "AB"));
     }
 
+    @SuppressWarnings("unchecked")
     public void testPutWithList() {
-        MultiValueMap test = MultiValueMap.decorate(new HashMap(), ArrayList.class);
-        assertEquals("a", test.put("A", "a"));
-        assertEquals("b", test.put("A", "b"));
+        MultiValueMap<K, V> test = MultiValueMap.decorate(new HashMap<K, Collection>(), ArrayList.class);
+        assertEquals("a", test.put((K) "A", "a"));
+        assertEquals("b", test.put((K) "A", "b"));
         assertEquals(1, test.size());
         assertEquals(2, test.size("A"));
         assertEquals(2, test.totalSize());
     }
 
+    @SuppressWarnings("unchecked")
     public void testPutWithSet() {
-        MultiValueMap test = MultiValueMap.decorate(new HashMap(), HashSet.class);
-        assertEquals("a", test.put("A", "a"));
-        assertEquals("b", test.put("A", "b"));
-        assertEquals(null, test.put("A", "a"));
+        MultiValueMap<K, V> test = MultiValueMap.decorate(new HashMap<K, HashSet>(), HashSet.class);
+        assertEquals("a", test.put((K) "A", "a"));
+        assertEquals("b", test.put((K) "A", "b"));
+        assertEquals(null, test.put((K) "A", "a"));
         assertEquals(1, test.size());
         assertEquals(2, test.size("A"));
         assertEquals(2, test.totalSize());
     }
 
+    @SuppressWarnings("unchecked")
     public void testPutAll_Map1() {
-        MultiMap original = new MultiValueMap();
-        original.put("key", "object1");
-        original.put("key", "object2");
+        MultiMap<K, V> original = new MultiValueMap<K, V>();
+        original.put((K) "key", "object1");
+        original.put((K) "key", "object2");
 
-        MultiValueMap test = new MultiValueMap();
-        test.put("keyA", "objectA");
-        test.put("key", "object0");
+        MultiValueMap<K, V> test = new MultiValueMap<K, V>();
+        test.put((K) "keyA", "objectA");
+        test.put((K) "key", "object0");
         test.putAll(original);
 
         assertEquals(2, test.size());
@@ -288,14 +305,15 @@ public class TestMultiValueMap extends TestCase {
         assertEquals(true, test.containsValue("object2"));
     }
 
+    @SuppressWarnings("unchecked")
     public void testPutAll_Map2() {
-        Map original = new HashMap();
-        original.put("keyX", "object1");
-        original.put("keyY", "object2");
+        Map<K, V> original = new HashMap<K, V>();
+        original.put((K) "keyX", (V) "object1");
+        original.put((K) "keyY", (V) "object2");
 
-        MultiValueMap test = new MultiValueMap();
-        test.put("keyA", "objectA");
-        test.put("keyX", "object0");
+        MultiValueMap<K, V> test = new MultiValueMap<K, V>();
+        test.put((K) "keyA", "objectA");
+        test.put((K) "keyX", "object0");
         test.putAll(original);
 
         assertEquals(3, test.size());
@@ -309,30 +327,31 @@ public class TestMultiValueMap extends TestCase {
         assertEquals(true, test.containsValue("object2"));
     }
 
+    @SuppressWarnings("unchecked")
     public void testPutAll_KeyCollection() {
-        MultiValueMap map = new MultiValueMap();
-        Collection coll = Arrays.asList(new Object[] {"X", "Y", "Z"});
-        
-        assertEquals(true, map.putAll("A", coll));
+        MultiValueMap<K, V> map = new MultiValueMap<K, V>();
+        Collection<V> coll = (Collection<V>) Arrays.asList(new Object[] { "X", "Y", "Z" });
+
+        assertEquals(true, map.putAll((K) "A", coll));
         assertEquals(3, map.size("A"));
         assertEquals(true, map.containsValue("A", "X"));
         assertEquals(true, map.containsValue("A", "Y"));
         assertEquals(true, map.containsValue("A", "Z"));
-        
-        assertEquals(false, map.putAll("A", null));
+
+        assertEquals(false, map.putAll((K) "A", null));
         assertEquals(3, map.size("A"));
         assertEquals(true, map.containsValue("A", "X"));
         assertEquals(true, map.containsValue("A", "Y"));
         assertEquals(true, map.containsValue("A", "Z"));
-        
-        assertEquals(false, map.putAll("A", new ArrayList()));
+
+        assertEquals(false, map.putAll((K) "A", new ArrayList<V>()));
         assertEquals(3, map.size("A"));
         assertEquals(true, map.containsValue("A", "X"));
         assertEquals(true, map.containsValue("A", "Y"));
         assertEquals(true, map.containsValue("A", "Z"));
-        
-        coll = Arrays.asList(new Object[] {"M"});
-        assertEquals(true, map.putAll("A", coll));
+
+        coll = (Collection<V>) Arrays.asList(new Object[] { "M" });
+        assertEquals(true, map.putAll((K) "A", coll));
         assertEquals(4, map.size("A"));
         assertEquals(true, map.containsValue("A", "X"));
         assertEquals(true, map.containsValue("A", "Y"));
@@ -340,17 +359,18 @@ public class TestMultiValueMap extends TestCase {
         assertEquals(true, map.containsValue("A", "M"));
     }
 
+    @SuppressWarnings("unchecked")
     public void testRemove_KeyItem() {
-        MultiValueMap map = new MultiValueMap();
-        map.put("A", "AA");
-        map.put("A", "AB");
-        map.put("A", "AC");
+        MultiValueMap<K, V> map = new MultiValueMap<K, V>();
+        map.put((K) "A", "AA");
+        map.put((K) "A", "AB");
+        map.put((K) "A", "AC");
         assertEquals(null, map.remove("C", "CA"));
         assertEquals(null, map.remove("A", "AD"));
         assertEquals("AC", map.remove("A", "AC"));
         assertEquals("AB", map.remove("A", "AB"));
         assertEquals("AA", map.remove("A", "AA"));
-        assertEquals(new MultiValueMap(), map);
+        assertEquals(new MultiValueMap<K, V>(), map);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestPredicatedMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestPredicatedMap.java b/src/test/org/apache/commons/collections/map/TestPredicatedMap.java
index 6956aca..9edb140 100644
--- a/src/test/org/apache/commons/collections/map/TestPredicatedMap.java
+++ b/src/test/org/apache/commons/collections/map/TestPredicatedMap.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,77 +24,79 @@ import junit.framework.Test;
 import junit.framework.TestSuite;
 
 import org.apache.commons.collections.Predicate;
-import org.apache.commons.collections.PredicateUtils;
+import org.apache.commons.collections.functors.TruePredicate;
 
 /**
- * Extension of {@link TestMap} for exercising the 
+ * Extension of {@link TestMap} for exercising the
  * {@link PredicatedMap} implementation.
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  */
-public class TestPredicatedMap extends AbstractTestMap{
-    
-    protected static final Predicate truePredicate = PredicateUtils.truePredicate();
-    protected static final Predicate testPredicate = new Predicate() {
+public class TestPredicatedMap<K, V> extends AbstractTestMap<K, V> {
+
+    protected static final Predicate<Object> truePredicate = TruePredicate.<Object>truePredicate();
+
+    protected static final Predicate<Object> testPredicate = new Predicate<Object>() {
         public boolean evaluate(Object o) {
             return (o instanceof String);
         }
     };
-    
-    
+
     public TestPredicatedMap(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return new TestSuite(TestPredicatedMap.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestPredicatedMap.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
 
     //-----------------------------------------------------------------------
-    protected Map decorateMap(Map map, Predicate keyPredicate, 
-        Predicate valuePredicate) {
+    protected Map<K, V> decorateMap(Map<K, V> map, Predicate<? super K> keyPredicate,
+        Predicate<? super V> valuePredicate) {
         return PredicatedMap.decorate(map, keyPredicate, valuePredicate);
     }
-    
-    public Map makeEmptyMap() {
-        return decorateMap(new HashMap(), truePredicate, truePredicate);
+
+    public Map<K, V> makeObject() {
+        return decorateMap(new HashMap<K, V>(), truePredicate, truePredicate);
     }
-    
-    public Map makeTestMap() {
-        return decorateMap(new HashMap(), testPredicate, testPredicate);
+
+    public Map<K, V> makeTestMap() {
+        return decorateMap(new HashMap<K, V>(), testPredicate, testPredicate);
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testEntrySet() {
-        Map map = makeTestMap();
+        Map<K, V> map = makeTestMap();
         assertTrue("returned entryset should not be null",
             map.entrySet() != null);
-        map = decorateMap(new HashMap(), null, null);
-        map.put("oneKey", "oneValue");
+        map = decorateMap(new HashMap<K, V>(), null, null);
+        map.put((K) "oneKey", (V) "oneValue");
         assertTrue("returned entryset should contain one entry",
-            map.entrySet().size() == 1); 
+            map.entrySet().size() == 1);
         map = decorateMap(map, null, null);
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testPut() {
-        Map map = makeTestMap();
+        Map<K, V> map = makeTestMap();
         try {
-            map.put("Hi", new Integer(3));
+            map.put((K) "Hi", (V) new Integer(3));
             fail("Illegal value should raise IllegalArgument");
         } catch (IllegalArgumentException e) {
             // expected
         }
 
         try {
-            map.put(new Integer(3), "Hi");
+            map.put((K) new Integer(3), (V) "Hi");
             fail("Illegal key should raise IllegalArgument");
         } catch (IllegalArgumentException e) {
             // expected
@@ -103,11 +105,11 @@ public class TestPredicatedMap extends AbstractTestMap{
         assertTrue(!map.containsKey(new Integer(3)));
         assertTrue(!map.containsValue(new Integer(3)));
 
-        Map map2 = new HashMap();
-        map2.put("A", "a");
-        map2.put("B", "b");
-        map2.put("C", "c");
-        map2.put("c", new Integer(3));
+        Map<K, V> map2 = new HashMap<K, V>();
+        map2.put((K) "A", (V) "a");
+        map2.put((K) "B", (V) "b");
+        map2.put((K) "C", (V) "c");
+        map2.put((K) "c", (V) new Integer(3));
 
         try {
             map.putAll(map2);
@@ -116,21 +118,21 @@ public class TestPredicatedMap extends AbstractTestMap{
             // expected
         }
 
-        map.put("E", "e");
-        Iterator iterator = map.entrySet().iterator();
+        map.put((K) "E", (V) "e");
+        Iterator<Map.Entry<K, V>> iterator = map.entrySet().iterator();
         try {
-            Map.Entry entry = (Map.Entry)iterator.next();
-            entry.setValue(new Integer(3));
+            Map.Entry<K, V> entry = iterator.next();
+            entry.setValue((V) new Integer(3));
             fail("Illegal value should raise IllegalArgument");
         } catch (IllegalArgumentException e) {
             // expected
         }
-        
-        map.put("F", "f");
+
+        map.put((K) "F", (V) "f");
         iterator = map.entrySet().iterator();
-        Map.Entry entry = (Map.Entry)iterator.next();
-        entry.setValue("x");
-        
+        Map.Entry<K, V> entry = iterator.next();
+        entry.setValue((V) "x");
+
     }
 
     public String getCompatibilityVersion() {


[50/77] [abbrv] commons-collections git commit: return type narrowing

Posted by ch...@apache.org.
return type narrowing

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@751869 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/68e12b97
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/68e12b97
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/68e12b97

Branch: refs/heads/collections_jdk5_branch
Commit: 68e12b979ee37045a152805e4165acaca896a585
Parents: 783aa51
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Mon Mar 9 22:10:00 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Mon Mar 9 22:10:00 2009 +0000

----------------------------------------------------------------------
 .../commons/collections/set/ListOrderedSet.java | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/68e12b97/src/java/org/apache/commons/collections/set/ListOrderedSet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/ListOrderedSet.java b/src/java/org/apache/commons/collections/set/ListOrderedSet.java
index beb3990..82ed03c 100644
--- a/src/java/org/apache/commons/collections/set/ListOrderedSet.java
+++ b/src/java/org/apache/commons/collections/set/ListOrderedSet.java
@@ -21,8 +21,10 @@ import java.util.Collection;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.ListIterator;
 import java.util.Set;
 
+import org.apache.commons.collections.OrderedIterator;
 import org.apache.commons.collections.iterators.AbstractIteratorDecorator;
 import org.apache.commons.collections.list.UnmodifiableList;
 
@@ -171,8 +173,8 @@ public class ListOrderedSet<E> extends AbstractSerializableSetDecorator<E> imple
         setOrder.clear();
     }
 
-    public Iterator<E> iterator() {
-        return new OrderedSetIterator<E>(setOrder.iterator(), collection);
+    public OrderedIterator<E> iterator() {
+        return new OrderedSetIterator<E>(setOrder.listIterator(), collection);
     }
 
     public boolean add(E object) {
@@ -279,14 +281,15 @@ public class ListOrderedSet<E> extends AbstractSerializableSetDecorator<E> imple
     /**
      * Internal iterator handle remove.
      */
-    static class OrderedSetIterator<E> extends AbstractIteratorDecorator<E> {
+    static class OrderedSetIterator<E> extends AbstractIteratorDecorator<E> implements OrderedIterator<E> {
 
         /** Object we iterate on */
         protected final Collection<E> set;
+
         /** Last object retrieved */
         protected E last;
 
-        private OrderedSetIterator(Iterator<E> iterator, Collection<E> set) {
+        private OrderedSetIterator(ListIterator<E> iterator, Collection<E> set) {
             super(iterator);
             this.set = set;
         }
@@ -301,6 +304,15 @@ public class ListOrderedSet<E> extends AbstractSerializableSetDecorator<E> imple
             iterator.remove();
             last = null;
         }
+
+        public boolean hasPrevious() {
+            return ((ListIterator<E>) iterator).hasPrevious();
+        }
+
+        public E previous() {
+            last = ((ListIterator<E>) iterator).previous();
+            return last;
+        }
     }
 
 }


[28/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/comparators/ComparatorChain.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/comparators/ComparatorChain.java b/src/java/org/apache/commons/collections/comparators/ComparatorChain.java
index 32dcd21..cbb6c89 100644
--- a/src/java/org/apache/commons/collections/comparators/ComparatorChain.java
+++ b/src/java/org/apache/commons/collections/comparators/ComparatorChain.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.
@@ -34,33 +34,33 @@ import java.util.List;
  * to multi-column sorting in SQL, and this class
  * allows Java classes to emulate that kind of behaviour
  * when sorting a List.</p>
- * 
+ *
  * <p>To further facilitate SQL-like sorting, the order of
  * any single Comparator in the list can be reversed.</p>
- * 
+ *
  * <p>Calling a method that adds new Comparators or
  * changes the ascend/descend sort <i>after compare(Object,
  * Object) has been called</i> will result in an
  * UnsupportedOperationException.  However, <i>take care</i>
  * to not alter the underlying List of Comparators
  * or the BitSet that defines the sort order.</p>
- * 
+ *
  * <p>Instances of ComparatorChain are not synchronized.
  * The class is not thread-safe at construction time, but
  * it <i>is</i> thread-safe to perform multiple comparisons
  * after all the setup operations are complete.</p>
- * 
+ *
  * @since Commons Collections 2.0
  * @author Morgan Delagrange
  * @version $Revision$ $Date$
  */
-public class ComparatorChain implements Comparator, Serializable {
+public class ComparatorChain<E> implements Comparator<E>, Serializable {
 
     /** Serialization version from Collections 2.0. */
     private static final long serialVersionUID = -721644942746081630L;
-    
+
     /** The list of comparators in the chain. */
-    protected List comparatorChain = null;
+    protected List<Comparator<E>> comparatorChain = null;
     /** Order - false (clear) = ascend; true (set) = descend. */
     protected BitSet orderingBits = null;
    /** Whether the chain has been "locked". */
@@ -70,32 +70,32 @@ public class ComparatorChain implements Comparator, Serializable {
     /**
      * Construct a ComparatorChain with no Comparators.
      * You must add at least one Comparator before calling
-     * the compare(Object,Object) method, or an 
+     * the compare(Object,Object) method, or an
      * UnsupportedOperationException is thrown
      */
     public ComparatorChain() {
-        this(new ArrayList(),new BitSet());
+        this(new ArrayList<Comparator<E>>(), new BitSet());
     }
 
     /**
      * Construct a ComparatorChain with a single Comparator,
      * sorting in the forward order
-     * 
+     *
      * @param comparator First comparator in the Comparator chain
      */
-    public ComparatorChain(Comparator comparator) {
-        this(comparator,false);
+    public ComparatorChain(Comparator<E> comparator) {
+        this(comparator, false);
     }
 
     /**
      * Construct a Comparator chain with a single Comparator,
      * sorting in the given order
-     * 
+     *
      * @param comparator First Comparator in the ComparatorChain
      * @param reverse    false = forward sort; true = reverse sort
      */
-    public ComparatorChain(Comparator comparator, boolean reverse) {
-        comparatorChain = new ArrayList();
+    public ComparatorChain(Comparator<E> comparator, boolean reverse) {
+        comparatorChain = new ArrayList<Comparator<E>>();
         comparatorChain.add(comparator);
         orderingBits = new BitSet(1);
         if (reverse == true) {
@@ -105,14 +105,14 @@ public class ComparatorChain implements Comparator, Serializable {
 
     /**
      * Construct a ComparatorChain from the Comparators in the
-     * List.  All Comparators will default to the forward 
+     * List.  All Comparators will default to the forward
      * sort order.
-     * 
+     *
      * @param list   List of Comparators
      * @see #ComparatorChain(List,BitSet)
      */
-    public ComparatorChain(List list) {
-        this(list,new BitSet(list.size()));
+    public ComparatorChain(List<Comparator<E>> list) {
+        this(list, new BitSet(list.size()));
     }
 
     /**
@@ -124,13 +124,13 @@ public class ComparatorChain implements Comparator, Serializable {
      * If that method returns <i>false</i>, the forward
      * sort order is used; a return value of <i>true</i>
      * indicates reverse sort order.
-     * 
+     *
      * @param list   List of Comparators.  NOTE: This constructor does not perform a
      *               defensive copy of the list
      * @param bits   Sort order for each Comparator.  Extra bits are ignored,
      *               unless extra Comparators are added by another method.
      */
-    public ComparatorChain(List list, BitSet bits) {
+    public ComparatorChain(List<Comparator<E>> list, BitSet bits) {
         comparatorChain = list;
         orderingBits = bits;
     }
@@ -139,23 +139,23 @@ public class ComparatorChain implements Comparator, Serializable {
     /**
      * Add a Comparator to the end of the chain using the
      * forward sort order
-     * 
+     *
      * @param comparator Comparator with the forward sort order
      */
-    public void addComparator(Comparator comparator) {
-        addComparator(comparator,false);
+    public void addComparator(Comparator<E> comparator) {
+        addComparator(comparator, false);
     }
 
     /**
      * Add a Comparator to the end of the chain using the
      * given sort order
-     * 
+     *
      * @param comparator Comparator to add to the end of the chain
      * @param reverse    false = forward sort order; true = reverse sort order
      */
-    public void addComparator(Comparator comparator, boolean reverse) {
+    public void addComparator(Comparator<E> comparator, boolean reverse) {
         checkLocked();
-        
+
         comparatorChain.add(comparator);
         if (reverse == true) {
             orderingBits.set(comparatorChain.size() - 1);
@@ -165,26 +165,25 @@ public class ComparatorChain implements Comparator, Serializable {
     /**
      * Replace the Comparator at the given index, maintaining
      * the existing sort order.
-     * 
+     *
      * @param index      index of the Comparator to replace
      * @param comparator Comparator to place at the given index
      * @exception IndexOutOfBoundsException
      *                   if index &lt; 0 or index &gt;= size()
      */
-    public void setComparator(int index, Comparator comparator) 
-    throws IndexOutOfBoundsException {
-        setComparator(index,comparator,false);
+    public void setComparator(int index, Comparator<E> comparator) throws IndexOutOfBoundsException {
+        setComparator(index, comparator, false);
     }
 
     /**
      * Replace the Comparator at the given index in the
      * ComparatorChain, using the given sort order
-     * 
+     *
      * @param index      index of the Comparator to replace
      * @param comparator Comparator to set
      * @param reverse    false = forward sort order; true = reverse sort order
      */
-    public void setComparator(int index, Comparator comparator, boolean reverse) {
+    public void setComparator(int index, Comparator<E> comparator, boolean reverse) {
         checkLocked();
 
         comparatorChain.set(index,comparator);
@@ -195,11 +194,10 @@ public class ComparatorChain implements Comparator, Serializable {
         }
     }
 
-
     /**
      * Change the sort order at the given index in the
      * ComparatorChain to a forward sort.
-     * 
+     *
      * @param index  Index of the ComparatorChain
      */
     public void setForwardSort(int index) {
@@ -210,7 +208,7 @@ public class ComparatorChain implements Comparator, Serializable {
     /**
      * Change the sort order at the given index in the
      * ComparatorChain to a reverse sort.
-     * 
+     *
      * @param index  Index of the ComparatorChain
      */
     public void setReverseSort(int index) {
@@ -220,7 +218,7 @@ public class ComparatorChain implements Comparator, Serializable {
 
     /**
      * Number of Comparators in the current ComparatorChain.
-     * 
+     *
      * @return Comparator count
      */
     public int size() {
@@ -231,8 +229,8 @@ public class ComparatorChain implements Comparator, Serializable {
      * Determine if modifications can still be made to the
      * ComparatorChain.  ComparatorChains cannot be modified
      * once they have performed a comparison.
-     * 
-     * @return true = ComparatorChain cannot be modified; false = 
+     *
+     * @return true = ComparatorChain cannot be modified; false =
      *         ComparatorChain can still be modified.
      */
     public boolean isLocked() {
@@ -256,7 +254,7 @@ public class ComparatorChain implements Comparator, Serializable {
     /**
      * Perform comparisons on the Objects as per
      * Comparator.compare(o1,o2).
-     * 
+     *
      * @param o1  the first object to compare
      * @param o2  the second object to compare
      * @return -1, 0, or 1
@@ -264,31 +262,29 @@ public class ComparatorChain implements Comparator, Serializable {
      *                   if the ComparatorChain does not contain at least one
      *                   Comparator
      */
-    public int compare(Object o1, Object o2) throws UnsupportedOperationException {
+    public int compare(E o1, E o2) throws UnsupportedOperationException {
         if (isLocked == false) {
             checkChainIntegrity();
             isLocked = true;
         }
 
         // iterate over all comparators in the chain
-        Iterator comparators = comparatorChain.iterator();
+        Iterator<Comparator<E>> comparators = comparatorChain.iterator();
         for (int comparatorIndex = 0; comparators.hasNext(); ++comparatorIndex) {
 
-            Comparator comparator = (Comparator) comparators.next();
+            Comparator<E> comparator = comparators.next();
             int retval = comparator.compare(o1,o2);
             if (retval != 0) {
                 // invert the order if it is a reverse sort
                 if (orderingBits.get(comparatorIndex) == true) {
                     if(Integer.MIN_VALUE == retval) {
                         retval = Integer.MAX_VALUE;
-                    } else {                        
+                    } else {
                         retval *= -1;
                     }
                 }
-
                 return retval;
             }
-
         }
 
         // if comparators are exhausted, return 0
@@ -299,49 +295,51 @@ public class ComparatorChain implements Comparator, Serializable {
     /**
      * Implement a hash code for this comparator that is consistent with
      * {@link #equals(Object) equals}.
-     * 
+     *
      * @return a suitable hash code
      * @since Commons Collections 3.0
      */
     public int hashCode() {
         int hash = 0;
-        if(null != comparatorChain) {
+        if (null != comparatorChain) {
             hash ^= comparatorChain.hashCode();
         }
-        if(null != orderingBits) {
+        if (null != orderingBits) {
             hash ^= orderingBits.hashCode();
         }
         return hash;
     }
 
     /**
-     * Returns <code>true</code> iff <i>that</i> Object is 
-     * is a {@link Comparator} whose ordering is known to be 
+     * Returns <code>true</code> iff <i>that</i> Object is
+     * is a {@link Comparator} whose ordering is known to be
      * equivalent to mine.
      * <p>
      * This implementation returns <code>true</code>
      * iff <code><i>object</i>.{@link Object#getClass() getClass()}</code>
-     * equals <code>this.getClass()</code>, and the underlying 
+     * equals <code>this.getClass()</code>, and the underlying
      * comparators and order bits are equal.
      * Subclasses may want to override this behavior to remain consistent
      * with the {@link Comparator#equals(Object)} contract.
-     * 
+     *
      * @param object  the object to compare with
      * @return true if equal
      * @since Commons Collections 3.0
      */
     public boolean equals(Object object) {
-        if(this == object) {
+        if (this == object) {
             return true;
-        } else if(null == object) {
-            return false;
-        } else if(object.getClass().equals(this.getClass())) {
-            ComparatorChain chain = (ComparatorChain)object;
-            return ( (null == orderingBits ? null == chain.orderingBits : orderingBits.equals(chain.orderingBits))
-                   && (null == comparatorChain ? null == chain.comparatorChain : comparatorChain.equals(chain.comparatorChain)) );
-        } else {
+        }
+        if (null == object) {
             return false;
         }
+        if (object.getClass().equals(this.getClass())) {
+            ComparatorChain<?> chain = (ComparatorChain<?>) object;
+            return ((null == orderingBits ? null == chain.orderingBits : orderingBits
+                    .equals(chain.orderingBits)) && (null == comparatorChain ? null == chain.comparatorChain
+                    : comparatorChain.equals(chain.comparatorChain)));
+        }
+        return false;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/comparators/FixedOrderComparator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/comparators/FixedOrderComparator.java b/src/java/org/apache/commons/collections/comparators/FixedOrderComparator.java
index dc47da4..05fc835 100644
--- a/src/java/org/apache/commons/collections/comparators/FixedOrderComparator.java
+++ b/src/java/org/apache/commons/collections/comparators/FixedOrderComparator.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,11 +18,10 @@ package org.apache.commons.collections.comparators;
 
 import java.util.Comparator;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
-/** 
+/**
  * A Comparator which imposes a specific order on a specific set of Objects.
  * Objects are presented to the FixedOrderComparator in a specified order and
  * subsequent calls to {@link #compare(Object, Object) compare} yield that order.
@@ -40,7 +39,7 @@ import java.util.Map;
  * Instances of FixedOrderComparator are not synchronized.  The class is not
  * thread-safe at construction time, but it is thread-safe to perform
  * multiple comparisons  after all the setup operations are complete.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
@@ -48,55 +47,47 @@ import java.util.Map;
  * @author Stephen Colebourne
  * @author Janek Bogucki
  */
-public class FixedOrderComparator implements Comparator {
-
-    /** 
-     * Behavior when comparing unknown Objects:
-     * unknown objects compare as before known Objects.
-     */
-    public static final int UNKNOWN_BEFORE = 0;
+public class FixedOrderComparator<T> implements Comparator<T> {
 
-    /** 
-     * Behavior when comparing unknown Objects:
-     * unknown objects compare as after known Objects.
-     */
-    public static final int UNKNOWN_AFTER = 1;
-
-    /** 
-     * Behavior when comparing unknown Objects:
-     * unknown objects cause a IllegalArgumentException to be thrown.
-     * This is the default behavior.
+    /**
+     * Unknown object behavior enum.
+     * @since Commons Collections 5
      */
-    public static final int UNKNOWN_THROW_EXCEPTION = 2;
+    public static enum UnknownObjectBehavior {
+        BEFORE, AFTER, EXCEPTION;
+    }
 
     /** Internal map of object to position */
-    private final Map map = new HashMap();
+    private final Map<T, Integer> map = new HashMap<T, Integer>();
+
     /** Counter used in determining the position in the map */
     private int counter = 0;
+
     /** Is the comparator locked against further change */
     private boolean isLocked = false;
+
     /** The behaviour in the case of an unknown object */
-    private int unknownObjectBehavior = UNKNOWN_THROW_EXCEPTION;
+    private UnknownObjectBehavior unknownObjectBehavior = UnknownObjectBehavior.EXCEPTION;
 
     // Constructors
     //-----------------------------------------------------------------------
-    /** 
+    /**
      * Constructs an empty FixedOrderComparator.
      */
     public FixedOrderComparator() {
         super();
     }
 
-    /** 
+    /**
      * Constructs a FixedOrderComparator which uses the order of the given array
      * to compare the objects.
      * <p>
      * The array is copied, so later changes will not affect the comparator.
-     * 
+     *
      * @param items  the items that the comparator can compare in order
      * @throws IllegalArgumentException if the array is null
      */
-    public FixedOrderComparator(Object[] items) {
+    public FixedOrderComparator(T[] items) {
         super();
         if (items == null) {
             throw new IllegalArgumentException("The list of items must not be null");
@@ -106,22 +97,22 @@ public class FixedOrderComparator implements Comparator {
         }
     }
 
-    /** 
+    /**
      * Constructs a FixedOrderComparator which uses the order of the given list
      * to compare the objects.
      * <p>
      * The list is copied, so later changes will not affect the comparator.
-     * 
+     *
      * @param items  the items that the comparator can compare in order
      * @throws IllegalArgumentException if the list is null
      */
-    public FixedOrderComparator(List items) {
+    public FixedOrderComparator(List<T> items) {
         super();
         if (items == null) {
             throw new IllegalArgumentException("The list of items must not be null");
         }
-        for (Iterator it = items.iterator(); it.hasNext();) {
-            add(it.next());
+        for (T t : items) {
+            add(t);
         }
     }
 
@@ -130,7 +121,7 @@ public class FixedOrderComparator implements Comparator {
     /**
      * Returns true if modifications cannot be made to the FixedOrderComparator.
      * FixedOrderComparators cannot be modified once they have performed a comparison.
-     * 
+     *
      * @return true if attempts to change the FixedOrderComparator yield an
      *  UnsupportedOperationException, false if it can be changed.
      */
@@ -140,7 +131,7 @@ public class FixedOrderComparator implements Comparator {
 
     /**
      * Checks to see whether the comparator is now locked against further changes.
-     * 
+     *
      * @throws UnsupportedOperationException if the comparator is locked
      */
     protected void checkLocked() {
@@ -149,118 +140,108 @@ public class FixedOrderComparator implements Comparator {
         }
     }
 
-    /** 
+    /**
      * Gets the behavior for comparing unknown objects.
-     * 
-     * @return the flag for unknown behaviour - UNKNOWN_AFTER,
-     * UNKNOWN_BEFORE or UNKNOWN_THROW_EXCEPTION
+     *
+     * @return {@link UnknownObjectBehavior}
      */
-    public int getUnknownObjectBehavior() {
+    public UnknownObjectBehavior getUnknownObjectBehavior() {
         return unknownObjectBehavior;
     }
 
-    /** 
+    /**
      * Sets the behavior for comparing unknown objects.
-     * 
+     *
      * @param unknownObjectBehavior  the flag for unknown behaviour -
      * UNKNOWN_AFTER, UNKNOWN_BEFORE or UNKNOWN_THROW_EXCEPTION
      * @throws UnsupportedOperationException if a comparison has been performed
      * @throws IllegalArgumentException if the unknown flag is not valid
      */
-    public void setUnknownObjectBehavior(int unknownObjectBehavior) {
+    public void setUnknownObjectBehavior(UnknownObjectBehavior unknownObjectBehavior) {
         checkLocked();
-        if (unknownObjectBehavior != UNKNOWN_AFTER 
-            && unknownObjectBehavior != UNKNOWN_BEFORE 
-            && unknownObjectBehavior != UNKNOWN_THROW_EXCEPTION) {
-            throw new IllegalArgumentException("Unrecognised value for unknown behaviour flag");    
+        if (unknownObjectBehavior == null) {
+            throw new IllegalArgumentException("Unknown object behavior must not be null");
         }
         this.unknownObjectBehavior = unknownObjectBehavior;
     }
 
     // Methods for adding items
     //-----------------------------------------------------------------------
-    /** 
+    /**
      * Adds an item, which compares as after all items known to the Comparator.
      * If the item is already known to the Comparator, its old position is
      * replaced with the new position.
-     * 
+     *
      * @param obj  the item to be added to the Comparator.
      * @return true if obj has been added for the first time, false if
      *  it was already known to the Comparator.
      * @throws UnsupportedOperationException if a comparison has already been made
      */
-    public boolean add(Object obj) {
+    public boolean add(T obj) {
         checkLocked();
-        Object position = map.put(obj, new Integer(counter++));
+        Integer position = map.put(obj, new Integer(counter++));
         return (position == null);
     }
 
     /**
      * Adds a new item, which compares as equal to the given existing item.
-     * 
-     * @param existingObj  an item already in the Comparator's set of 
+     *
+     * @param existingObj  an item already in the Comparator's set of
      *  known objects
      * @param newObj  an item to be added to the Comparator's set of
      *  known objects
      * @return true if newObj has been added for the first time, false if
      *  it was already known to the Comparator.
-     * @throws IllegalArgumentException if existingObject is not in the 
+     * @throws IllegalArgumentException if existingObject is not in the
      *  Comparator's set of known objects.
      * @throws UnsupportedOperationException if a comparison has already been made
      */
-    public boolean addAsEqual(Object existingObj, Object newObj) {
+    public boolean addAsEqual(T existingObj, T newObj) {
         checkLocked();
-        Integer position = (Integer) map.get(existingObj);
+        Integer position = map.get(existingObj);
         if (position == null) {
             throw new IllegalArgumentException(existingObj + " not known to " + this);
         }
-        Object result = map.put(newObj, position);
+        Integer result = map.put(newObj, position);
         return (result == null);
     }
 
     // Comparator methods
     //-----------------------------------------------------------------------
-    /** 
+    /**
      * Compares two objects according to the order of this Comparator.
      * <p>
      * It is important to note that this class will throw an IllegalArgumentException
-     * in the case of an unrecognised object. This is not specified in the 
+     * in the case of an unrecognised object. This is not specified in the
      * Comparator interface, but is the most appropriate exception.
-     * 
+     *
      * @param obj1  the first object to compare
      * @param obj2  the second object to compare
      * @return negative if obj1 is less, positive if greater, zero if equal
-     * @throws IllegalArgumentException if obj1 or obj2 are not known 
+     * @throws IllegalArgumentException if obj1 or obj2 are not known
      *  to this Comparator and an alternative behavior has not been set
      *  via {@link #setUnknownObjectBehavior(int)}.
      */
-    public int compare(Object obj1, Object obj2) {
+    public int compare(T obj1, T obj2) {
         isLocked = true;
-        Integer position1 = (Integer) map.get(obj1);
-        Integer position2 = (Integer) map.get(obj2);
+        Integer position1 = map.get(obj1);
+        Integer position2 = map.get(obj2);
         if (position1 == null || position2 == null) {
             switch (unknownObjectBehavior) {
-                case UNKNOWN_BEFORE :
-                    if (position1 == null) {
-                        return (position2 == null) ? 0 : -1;
-                    } else {
-                        return 1;
-                    }
-                case UNKNOWN_AFTER :
-                    if (position1 == null) {
-                        return (position2 == null) ? 0 : 1;
-                    } else {
-                        return -1;
-                    }
-                case UNKNOWN_THROW_EXCEPTION :
-                    Object unknownObj = (position1 == null) ? obj1 : obj2;
-                    throw new IllegalArgumentException("Attempting to compare unknown object " + unknownObj);
-                default :
-                    throw new UnsupportedOperationException("Unknown unknownObjectBehavior: " + unknownObjectBehavior);
+            case BEFORE:
+                return position1 == null ? position2 == null ? 0 : -1 : 1;
+            case AFTER:
+                return position1 == null ? position2 == null ? 0 : 1 : -1;
+            case EXCEPTION:
+                Object unknownObj = (position1 == null) ? obj1 : obj2;
+                throw new IllegalArgumentException("Attempting to compare unknown object "
+                        + unknownObj);
+            default: //could be null
+                throw new UnsupportedOperationException("Unknown unknownObjectBehavior: "
+                        + unknownObjectBehavior);
             }
-        } else {
-            return position1.compareTo(position2);
         }
+        return position1.compareTo(position2);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/comparators/NullComparator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/comparators/NullComparator.java b/src/java/org/apache/commons/collections/comparators/NullComparator.java
index 633fe36..ea2c5a1 100644
--- a/src/java/org/apache/commons/collections/comparators/NullComparator.java
+++ b/src/java/org/apache/commons/collections/comparators/NullComparator.java
@@ -19,6 +19,8 @@ package org.apache.commons.collections.comparators;
 import java.io.Serializable;
 import java.util.Comparator;
 
+import org.apache.commons.collections.ComparatorUtils;
+
 /**
  * A Comparator that will compare nulls to be either lower or higher than
  * other objects.
@@ -28,7 +30,7 @@ import java.util.Comparator;
  *
  * @author Michael A. Smith
  */
-public class NullComparator implements Comparator, Serializable {
+public class NullComparator<E> implements Comparator<E>, Serializable {
 
     /** Serialization version. */
     private static final long serialVersionUID = -5820772575483504339L;
@@ -36,7 +38,7 @@ public class NullComparator implements Comparator, Serializable {
     /**
      *  The comparator to use when comparing two non-<code>null</code> objects.
      **/
-    private Comparator nonNullComparator;
+    private Comparator<E> nonNullComparator;
 
     /**
      *  Specifies whether a <code>null</code> are compared as higher than
@@ -51,8 +53,9 @@ public class NullComparator implements Comparator, Serializable {
      *  non-<code>null</code> objects, the {@link ComparableComparator} is
      *  used.
      **/
+    @SuppressWarnings("unchecked")
     public NullComparator() {
-        this(ComparableComparator.getInstance(), true);
+        this(ComparatorUtils.NATURAL_COMPARATOR, true);
     }
 
     /**
@@ -68,7 +71,7 @@ public class NullComparator implements Comparator, Serializable {
      *  @exception NullPointerException if <code>nonNullComparator</code> is
      *  <code>null</code>
      **/
-    public NullComparator(Comparator nonNullComparator) {
+    public NullComparator(Comparator<E> nonNullComparator) {
         this(nonNullComparator, true);
     }
 
@@ -84,8 +87,9 @@ public class NullComparator implements Comparator, Serializable {
      *  that <code>null</code> should be compared as lower than a
      *  non-<code>null</code> object.
      **/
+    @SuppressWarnings("unchecked")
     public NullComparator(boolean nullsAreHigh) {
-        this(ComparableComparator.getInstance(), nullsAreHigh);
+        this(ComparatorUtils.NATURAL_COMPARATOR, nullsAreHigh);
     }
     
     /**
@@ -107,11 +111,11 @@ public class NullComparator implements Comparator, Serializable {
      *  @exception NullPointerException if <code>nonNullComparator</code> is
      *  <code>null</code>
      **/
-    public NullComparator(Comparator nonNullComparator, boolean nullsAreHigh) {
+    public NullComparator(Comparator<E> nonNullComparator, boolean nullsAreHigh) {
         this.nonNullComparator = nonNullComparator;
         this.nullsAreHigh = nullsAreHigh;
         
-        if(nonNullComparator == null) {
+        if (nonNullComparator == null) {
             throw new NullPointerException("null nonNullComparator");
         }
     }
@@ -133,7 +137,7 @@ public class NullComparator implements Comparator, Serializable {
      *  "higher" than (greater than, after, etc.) <code>o2</code>; or
      *  <code>0</code> if <code>o1</code> and <code>o2</code> are equal.
      **/
-    public int compare(Object o1, Object o2) {
+    public int compare(E o1, E o2) {
         if(o1 == o2) { return 0; }
         if(o1 == null) { return (this.nullsAreHigh ? 1 : -1); }
         if(o2 == null) { return (this.nullsAreHigh ? -1 : 1); }
@@ -167,7 +171,7 @@ public class NullComparator implements Comparator, Serializable {
         if(obj == this) { return true; }
         if(!obj.getClass().equals(this.getClass())) { return false; }
 
-        NullComparator other = (NullComparator)obj;
+        NullComparator<?> other = (NullComparator<?>) obj;
 	
         return ((this.nullsAreHigh == other.nullsAreHigh) &&
                 (this.nonNullComparator.equals(other.nonNullComparator)));

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/comparators/ReverseComparator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/comparators/ReverseComparator.java b/src/java/org/apache/commons/collections/comparators/ReverseComparator.java
index 9148f27..a28ead1 100644
--- a/src/java/org/apache/commons/collections/comparators/ReverseComparator.java
+++ b/src/java/org/apache/commons/collections/comparators/ReverseComparator.java
@@ -19,6 +19,8 @@ package org.apache.commons.collections.comparators;
 import java.io.Serializable;
 import java.util.Comparator;
 
+import org.apache.commons.collections.ComparatorUtils;
+
 /**
  * Reverses the order of another comparator by reversing the arguments
  * to its {@link #compare(Object, Object) compare} method.
@@ -31,13 +33,13 @@ import java.util.Comparator;
  * 
  * @see java.util.Collections#reverseOrder()
  */
-public class ReverseComparator implements Comparator, Serializable {
+public class ReverseComparator<E> implements Comparator<E>, Serializable {
 
     /** Serialization version from Collections 2.0. */
     private static final long serialVersionUID = 2858887242028539265L;
 
     /** The comparator being decorated. */
-    private Comparator comparator;
+    private Comparator<E> comparator;
 
     //-----------------------------------------------------------------------
     /**
@@ -61,12 +63,9 @@ public class ReverseComparator implements Comparator, Serializable {
      * 
      * @param comparator Comparator to reverse
      */
-    public ReverseComparator(Comparator comparator) {
-        if(comparator != null) {
-            this.comparator = comparator;
-        } else {
-            this.comparator = ComparableComparator.getInstance();
-        }
+    @SuppressWarnings("unchecked")
+    public ReverseComparator(Comparator<E> comparator) {
+        this.comparator = comparator == null ? ComparatorUtils.NATURAL_COMPARATOR : comparator;
     }
 
     //-----------------------------------------------------------------------
@@ -77,7 +76,7 @@ public class ReverseComparator implements Comparator, Serializable {
      * @param obj2  the second object to compare
      * @return negative if obj1 is less, positive if greater, zero if equal
      */
-    public int compare(Object obj1, Object obj2) {
+    public int compare(E obj1, E obj2) {
         return comparator.compare(obj2, obj1);
     }
 
@@ -110,16 +109,17 @@ public class ReverseComparator implements Comparator, Serializable {
      * @since Commons Collections 3.0
      */
     public boolean equals(Object object) {
-        if(this == object) {
+        if (this == object) {
             return true;
-        } else if(null == object) {
+        }
+        if (null == object) {
             return false;
-        } else if(object.getClass().equals(this.getClass())) {
-            ReverseComparator thatrc = (ReverseComparator)object;
+        }
+        if (object.getClass().equals(this.getClass())) {
+            ReverseComparator<?> thatrc = (ReverseComparator<?>) object;
             return comparator.equals(thatrc.comparator);
-        } else {
-            return false;
         }
+        return false;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/comparators/TransformingComparator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/comparators/TransformingComparator.java b/src/java/org/apache/commons/collections/comparators/TransformingComparator.java
index 4a2a073..62ba50c 100644
--- a/src/java/org/apache/commons/collections/comparators/TransformingComparator.java
+++ b/src/java/org/apache/commons/collections/comparators/TransformingComparator.java
@@ -18,6 +18,7 @@ package org.apache.commons.collections.comparators;
 
 import java.util.Comparator;
 
+import org.apache.commons.collections.ComparatorUtils;
 import org.apache.commons.collections.Transformer;
 
 /**
@@ -31,12 +32,12 @@ import org.apache.commons.collections.Transformer;
  * @see org.apache.commons.collections.Transformer
  * @see org.apache.commons.collections.comparators.ComparableComparator
  */
-public class TransformingComparator implements Comparator {
+public class TransformingComparator<E> implements Comparator<E> {
     
     /** The decorated comparator. */
-    protected Comparator decorated;
+    protected Comparator<E> decorated;
     /** The transformer being used. */    
-    protected Transformer transformer;
+    protected Transformer<? super E, ? extends E> transformer;
 
     //-----------------------------------------------------------------------
     /**
@@ -45,8 +46,9 @@ public class TransformingComparator implements Comparator {
      * 
      * @param transformer what will transform the arguments to <code>compare</code>
      */
-    public TransformingComparator(Transformer transformer) {
-        this(transformer, new ComparableComparator());
+    @SuppressWarnings("unchecked")
+    public TransformingComparator(Transformer<? super E, ? extends E> transformer) {
+        this(transformer, ComparatorUtils.NATURAL_COMPARATOR);
     }
 
     /**
@@ -55,7 +57,7 @@ public class TransformingComparator implements Comparator {
      * @param transformer  what will transform the arguments to <code>compare</code>
      * @param decorated  the decorated Comparator
      */
-    public TransformingComparator(Transformer transformer, Comparator decorated) {
+    public TransformingComparator(Transformer<? super E, ? extends E> transformer, Comparator<E> decorated) {
         this.decorated = decorated;
         this.transformer = transformer;
     }
@@ -68,9 +70,9 @@ public class TransformingComparator implements Comparator {
      * @param obj2  the second object to transform then compare
      * @return negative if obj1 is less, positive if greater, zero if equal
      */
-    public int compare(Object obj1, Object obj2) {
-        Object value1 = this.transformer.transform(obj1);
-        Object value2 = this.transformer.transform(obj2);
+    public int compare(E obj1, E obj2) {
+        E value1 = this.transformer.transform(obj1);
+        E value2 = this.transformer.transform(obj2);
         return this.decorated.compare(value1, value2);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/AllPredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/AllPredicate.java b/src/java/org/apache/commons/collections/functors/AllPredicate.java
index cce6f8e..edde7e9 100644
--- a/src/java/org/apache/commons/collections/functors/AllPredicate.java
+++ b/src/java/org/apache/commons/collections/functors/AllPredicate.java
@@ -99,7 +99,7 @@ public final class AllPredicate<T> implements Predicate<T>, PredicateDecorator<T
      * @throws IllegalArgumentException if any predicate in the array is null
      * @deprecated Use {@link #allPredicate(Collection<Predicate<? super T>>)} instead
      */
-    public static <T> Predicate<T> getInstance(Collection<Predicate<? super T>> predicates) {
+    public static <T> Predicate<T> getInstance(Collection<Predicate<T>> predicates) {
         return allPredicate(predicates);
     }
 
@@ -114,13 +114,13 @@ public final class AllPredicate<T> implements Predicate<T>, PredicateDecorator<T
      * @throws IllegalArgumentException if the predicates array is null
      * @throws IllegalArgumentException if any predicate in the array is null
      */
-    public static <T> Predicate<T> allPredicate(Collection<Predicate<? super T>> predicates) {
-        final Predicate<? super T>[] preds = validate(predicates);
+    public static <T> Predicate<T> allPredicate(Collection<? extends Predicate<T>> predicates) {
+        final Predicate<T>[] preds = validate(predicates);
         if (preds.length == 0) {
             return truePredicate();
         }
         if (preds.length == 1) {
-            return coerce(preds[0]);
+            return preds[0];
         }
         return new AllPredicate<T>(preds);
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/AndPredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/AndPredicate.java b/src/java/org/apache/commons/collections/functors/AndPredicate.java
index e2ff36d..a30fcd0 100644
--- a/src/java/org/apache/commons/collections/functors/AndPredicate.java
+++ b/src/java/org/apache/commons/collections/functors/AndPredicate.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.
@@ -22,45 +22,45 @@ import org.apache.commons.collections.Predicate;
 
 /**
  * Predicate implementation that returns true if both the predicates return true.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
  * @author Stephen Colebourne
  */
-public final class AndPredicate implements Predicate, PredicateDecorator, Serializable {
+public final class AndPredicate<T> implements Predicate<T>, PredicateDecorator<T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = 4189014213763186912L;
-    
+
     /** The array of predicates to call */
-    private final Predicate iPredicate1;
+    private final Predicate<? super T> iPredicate1;
     /** The array of predicates to call */
-    private final Predicate iPredicate2;
-    
+    private final Predicate<? super T> iPredicate2;
+
     /**
      * Factory to create the predicate.
-     * 
+     *
      * @param predicate1  the first predicate to check, not null
      * @param predicate2  the second predicate to check, not null
      * @return the <code>and</code> predicate
      * @throws IllegalArgumentException if either predicate is null
      */
-    public static Predicate getInstance(Predicate predicate1, Predicate predicate2) {
+    public static <T> Predicate<T> getInstance(Predicate<? super T> predicate1, Predicate<? super T> predicate2) {
         if (predicate1 == null || predicate2 == null) {
             throw new IllegalArgumentException("Predicate must not be null");
         }
-        return new AndPredicate(predicate1, predicate2);
+        return new AndPredicate<T>(predicate1, predicate2);
     }
 
     /**
      * Constructor that performs no validation.
      * Use <code>getInstance</code> if you want that.
-     * 
+     *
      * @param predicate1  the first predicate to check, not null
      * @param predicate2  the second predicate to check, not null
      */
-    public AndPredicate(Predicate predicate1, Predicate predicate2) {
+    public AndPredicate(Predicate<? super T> predicate1, Predicate<? super T> predicate2) {
         super();
         iPredicate1 = predicate1;
         iPredicate2 = predicate2;
@@ -68,21 +68,22 @@ public final class AndPredicate implements Predicate, PredicateDecorator, Serial
 
     /**
      * Evaluates the predicate returning true if both predicates return true.
-     * 
+     *
      * @param object  the input object
      * @return true if both decorated predicates return true
      */
-    public boolean evaluate(Object object) {
+    public boolean evaluate(T object) {
        return (iPredicate1.evaluate(object) && iPredicate2.evaluate(object));
     }
 
     /**
      * Gets the two predicates being decorated as an array.
-     * 
+     *
      * @return the predicates
      * @since Commons Collections 3.1
      */
-    public Predicate[] getPredicates() {
+    @SuppressWarnings("unchecked")
+    public Predicate<? super T>[] getPredicates() {
         return new Predicate[] {iPredicate1, iPredicate2};
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/AnyPredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/AnyPredicate.java b/src/java/org/apache/commons/collections/functors/AnyPredicate.java
index b3cb88b..430d6d3 100644
--- a/src/java/org/apache/commons/collections/functors/AnyPredicate.java
+++ b/src/java/org/apache/commons/collections/functors/AnyPredicate.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.
@@ -35,14 +35,14 @@ import org.apache.commons.collections.Predicate;
  * @author Stephen Colebourne
  * @author Matt Benson
  */
-public final class AnyPredicate implements Predicate, PredicateDecorator, Serializable {
+public final class AnyPredicate<T> implements Predicate<T>, PredicateDecorator<T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = 7429999530934647542L;
-    
+
     /** The array of predicates to call */
-    private final Predicate[] iPredicates;
-    
+    private final Predicate<? super T>[] iPredicates;
+
     /**
      * Factory to create the predicate.
      * <p>
@@ -54,15 +54,16 @@ public final class AnyPredicate implements Predicate, PredicateDecorator, Serial
      * @throws IllegalArgumentException if the predicates array is null
      * @throws IllegalArgumentException if any predicate in the array is null
      */
-    public static Predicate getInstance(Predicate[] predicates) {
+    @SuppressWarnings("unchecked")
+    public static <T> Predicate<T> getInstance(Predicate<? super T>[] predicates) {
         FunctorUtils.validate(predicates);
         if (predicates.length == 0) {
-            return FalsePredicate.INSTANCE;
+            return FalsePredicate.<T>falsePredicate();
         }
         if (predicates.length == 1) {
-            return predicates[0];
+            return (Predicate<T>) predicates[0];
         }
-        return new AnyPredicate(FunctorUtils.copy(predicates));
+        return new AnyPredicate<T>(FunctorUtils.copy(predicates));
     }
 
     /**
@@ -76,35 +77,36 @@ public final class AnyPredicate implements Predicate, PredicateDecorator, Serial
      * @throws IllegalArgumentException if the predicates array is null
      * @throws IllegalArgumentException if any predicate in the array is null
      */
-    public static Predicate getInstance(Collection predicates) {
-        Predicate[] preds = FunctorUtils.validate(predicates);
+    @SuppressWarnings("unchecked")
+    public static <T> Predicate<T> getInstance(Collection<? extends Predicate<T>> predicates) {
+        Predicate<? super T>[] preds = FunctorUtils.validate(predicates);
         if (preds.length == 0) {
-            return FalsePredicate.INSTANCE;
+            return FalsePredicate.<T>falsePredicate();
         }
         if (preds.length == 1) {
-            return preds[0];
+            return (Predicate<T>) preds[0];
         }
-        return new AnyPredicate(preds);
+        return new AnyPredicate<T>(preds);
     }
 
     /**
      * Constructor that performs no validation.
      * Use <code>getInstance</code> if you want that.
-     * 
+     *
      * @param predicates  the predicates to check, not cloned, not null
      */
-    public AnyPredicate(Predicate[] predicates) {
+    public AnyPredicate(Predicate<? super T>[] predicates) {
         super();
         iPredicates = predicates;
     }
 
     /**
      * Evaluates the predicate returning true if any predicate returns true.
-     * 
+     *
      * @param object  the input object
      * @return true if any decorated predicate return true
      */
-    public boolean evaluate(Object object) {
+    public boolean evaluate(T object) {
         for (int i = 0; i < iPredicates.length; i++) {
             if (iPredicates[i].evaluate(object)) {
                 return true;
@@ -115,11 +117,11 @@ public final class AnyPredicate implements Predicate, PredicateDecorator, Serial
 
     /**
      * Gets the predicates, do not modify the array.
-     * 
+     *
      * @return the predicates
      * @since Commons Collections 3.1
      */
-    public Predicate[] getPredicates() {
+    public Predicate<? super T>[] getPredicates() {
         return iPredicates;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/ChainedClosure.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/ChainedClosure.java b/src/java/org/apache/commons/collections/functors/ChainedClosure.java
index 6f2346a..bf2c476 100644
--- a/src/java/org/apache/commons/collections/functors/ChainedClosure.java
+++ b/src/java/org/apache/commons/collections/functors/ChainedClosure.java
@@ -18,7 +18,6 @@ package org.apache.commons.collections.functors;
 
 import java.io.Serializable;
 import java.util.Collection;
-import java.util.Iterator;
 
 import org.apache.commons.collections.Closure;
 
@@ -30,13 +29,13 @@ import org.apache.commons.collections.Closure;
  *
  * @author Stephen Colebourne
  */
-public class ChainedClosure implements Closure, Serializable {
+public class ChainedClosure<E> implements Closure<E>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = -3520677225766901240L;
 
     /** The closures to call in turn */
-    private final Closure[] iClosures;
+    private final Closure<? super E>[] iClosures;
 
     /**
      * Factory method that performs validation and copies the parameter array.
@@ -46,15 +45,15 @@ public class ChainedClosure implements Closure, Serializable {
      * @throws IllegalArgumentException if the closures array is null
      * @throws IllegalArgumentException if any closure in the array is null
      */
-    public static Closure getInstance(Closure[] closures) {
+    public static <E> Closure<E> getInstance(Closure<? super E>[] closures) {
         FunctorUtils.validate(closures);
         if (closures.length == 0) {
-            return NOPClosure.INSTANCE;
+            return NOPClosure.<E>getInstance();
         }
         closures = FunctorUtils.copy(closures);
-        return new ChainedClosure(closures);
+        return new ChainedClosure<E>(closures);
     }
-    
+
     /**
      * Create a new Closure that calls each closure in turn, passing the 
      * result into the next closure. The ordering is that of the iterator()
@@ -65,21 +64,22 @@ public class ChainedClosure implements Closure, Serializable {
      * @throws IllegalArgumentException if the closures collection is null
      * @throws IllegalArgumentException if any closure in the collection is null
      */
-    public static Closure getInstance(Collection closures) {
+    @SuppressWarnings("unchecked")
+    public static <E> Closure<E> getInstance(Collection<Closure<E>> closures) {
         if (closures == null) {
             throw new IllegalArgumentException("Closure collection must not be null");
         }
         if (closures.size() == 0) {
-            return NOPClosure.INSTANCE;
+            return NOPClosure.<E>getInstance();
         }
         // convert to array like this to guarantee iterator() ordering
-        Closure[] cmds = new Closure[closures.size()];
+        Closure<? super E>[] cmds = new Closure[closures.size()];
         int i = 0;
-        for (Iterator it = closures.iterator(); it.hasNext();) {
-            cmds[i++] = (Closure) it.next();
+        for (Closure<? super E> closure : closures) {
+            cmds[i++] = (Closure<E>) closure;
         }
         FunctorUtils.validate(cmds);
-        return new ChainedClosure(cmds);
+        return new ChainedClosure<E>(cmds);
     }
 
     /**
@@ -90,12 +90,13 @@ public class ChainedClosure implements Closure, Serializable {
      * @return the <code>chained</code> closure
      * @throws IllegalArgumentException if either closure is null
      */
-    public static Closure getInstance(Closure closure1, Closure closure2) {
+    @SuppressWarnings("unchecked")
+    public static <E> Closure<E> getInstance(Closure<? super E> closure1, Closure<? super E> closure2) {
         if (closure1 == null || closure2 == null) {
             throw new IllegalArgumentException("Closures must not be null");
         }
-        Closure[] closures = new Closure[] { closure1, closure2 };
-        return new ChainedClosure(closures);
+        Closure<E>[] closures = new Closure[] { closure1, closure2 };
+        return new ChainedClosure<E>(closures);
     }
 
     /**
@@ -104,7 +105,7 @@ public class ChainedClosure implements Closure, Serializable {
      * 
      * @param closures  the closures to chain, not copied, no nulls
      */
-    public ChainedClosure(Closure[] closures) {
+    public ChainedClosure(Closure<? super E>[] closures) {
         super();
         iClosures = closures;
     }
@@ -114,7 +115,7 @@ public class ChainedClosure implements Closure, Serializable {
      * 
      * @param input  the input object passed to each closure
      */
-    public void execute(Object input) {
+    public void execute(E input) {
         for (int i = 0; i < iClosures.length; i++) {
             iClosures[i].execute(input);
         }
@@ -125,7 +126,7 @@ public class ChainedClosure implements Closure, Serializable {
      * @return the closures
      * @since Commons Collections 3.1
      */
-    public Closure[] getClosures() {
+    public Closure<? super E>[] getClosures() {
         return iClosures;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/ChainedTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/ChainedTransformer.java b/src/java/org/apache/commons/collections/functors/ChainedTransformer.java
index 4d86b89..ca69f45 100644
--- a/src/java/org/apache/commons/collections/functors/ChainedTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/ChainedTransformer.java
@@ -18,7 +18,6 @@ package org.apache.commons.collections.functors;
 
 import java.io.Serializable;
 import java.util.Collection;
-import java.util.Iterator;
 
 import org.apache.commons.collections.Transformer;
 
@@ -33,13 +32,13 @@ import org.apache.commons.collections.Transformer;
  *
  * @author Stephen Colebourne
  */
-public class ChainedTransformer implements Transformer, Serializable {
+public class ChainedTransformer<T> implements Transformer<T, T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = 3514945074733160196L;
 
     /** The transformers to call in turn */
-    private final Transformer[] iTransformers;
+    private final Transformer<? super T, ? extends T>[] iTransformers;
 
     /**
      * Factory method that performs validation and copies the parameter array.
@@ -49,13 +48,13 @@ public class ChainedTransformer implements Transformer, Serializable {
      * @throws IllegalArgumentException if the transformers array is null
      * @throws IllegalArgumentException if any transformer in the array is null
      */
-    public static Transformer getInstance(Transformer[] transformers) {
+    public static <T> Transformer<T, T> getInstance(Transformer<? super T, ? extends T>[] transformers) {
         FunctorUtils.validate(transformers);
         if (transformers.length == 0) {
-            return NOPTransformer.INSTANCE;
+            return NOPTransformer.<T>getInstance();
         }
         transformers = FunctorUtils.copy(transformers);
-        return new ChainedTransformer(transformers);
+        return new ChainedTransformer<T>(transformers);
     }
     
     /**
@@ -68,21 +67,18 @@ public class ChainedTransformer implements Transformer, Serializable {
      * @throws IllegalArgumentException if the transformers collection is null
      * @throws IllegalArgumentException if any transformer in the collection is null
      */
-    public static Transformer getInstance(Collection transformers) {
+    @SuppressWarnings("unchecked")
+    public static <T> Transformer<T, T> getInstance(Collection<? extends Transformer<T, T>> transformers) {
         if (transformers == null) {
             throw new IllegalArgumentException("Transformer collection must not be null");
         }
         if (transformers.size() == 0) {
-            return NOPTransformer.INSTANCE;
+            return NOPTransformer.<T>getInstance();
         }
         // convert to array like this to guarantee iterator() ordering
-        Transformer[] cmds = new Transformer[transformers.size()];
-        int i = 0;
-        for (Iterator it = transformers.iterator(); it.hasNext();) {
-            cmds[i++] = (Transformer) it.next();
-        }
+        Transformer<T, T>[] cmds = transformers.toArray(new Transformer[transformers.size()]);
         FunctorUtils.validate(cmds);
-        return new ChainedTransformer(cmds);
+        return new ChainedTransformer<T>(cmds);
     }
 
     /**
@@ -93,12 +89,13 @@ public class ChainedTransformer implements Transformer, Serializable {
      * @return the <code>chained</code> transformer
      * @throws IllegalArgumentException if either transformer is null
      */
-    public static Transformer getInstance(Transformer transformer1, Transformer transformer2) {
+    @SuppressWarnings("unchecked")
+    public static <T> Transformer<T, T> getInstance(Transformer<? super T, ? extends T> transformer1, Transformer<? super T, ? extends T> transformer2) {
         if (transformer1 == null || transformer2 == null) {
             throw new IllegalArgumentException("Transformers must not be null");
         }
-        Transformer[] transformers = new Transformer[] { transformer1, transformer2 };
-        return new ChainedTransformer(transformers);
+        Transformer<? super T, ? extends T>[] transformers = new Transformer[] { transformer1, transformer2 };
+        return new ChainedTransformer<T>(transformers);
     }
 
     /**
@@ -107,7 +104,7 @@ public class ChainedTransformer implements Transformer, Serializable {
      * 
      * @param transformers  the transformers to chain, not copied, no nulls
      */
-    public ChainedTransformer(Transformer[] transformers) {
+    public ChainedTransformer(Transformer<? super T, ? extends T>[] transformers) {
         super();
         iTransformers = transformers;
     }
@@ -118,7 +115,7 @@ public class ChainedTransformer implements Transformer, Serializable {
      * @param object  the input object passed to the first transformer
      * @return the transformed result
      */
-    public Object transform(Object object) {
+    public T transform(T object) {
         for (int i = 0; i < iTransformers.length; i++) {
             object = iTransformers[i].transform(object);
         }
@@ -130,7 +127,7 @@ public class ChainedTransformer implements Transformer, Serializable {
      * @return the transformers
      * @since Commons Collections 3.1
      */
-    public Transformer[] getTransformers() {
+    public Transformer<? super T, ? extends T>[] getTransformers() {
         return iTransformers;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/CloneTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/CloneTransformer.java b/src/java/org/apache/commons/collections/functors/CloneTransformer.java
index c4752c4..e17888d 100644
--- a/src/java/org/apache/commons/collections/functors/CloneTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/CloneTransformer.java
@@ -30,13 +30,13 @@ import org.apache.commons.collections.Transformer;
  *
  * @author Stephen Colebourne
  */
-public class CloneTransformer implements Transformer, Serializable {
+public class CloneTransformer<T> implements Transformer<T, T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = -8188742709499652567L;
 
     /** Singleton predicate instance */
-    public static final Transformer INSTANCE = new CloneTransformer();
+    public static final Transformer<Object, Object> INSTANCE = new CloneTransformer<Object>();
 
     /**
      * Factory returning the singleton instance.
@@ -44,8 +44,9 @@ public class CloneTransformer implements Transformer, Serializable {
      * @return the singleton instance
      * @since Commons Collections 3.1
      */
-    public static Transformer getInstance() {
-        return INSTANCE;
+    @SuppressWarnings("unchecked")
+    public static <T> Transformer<T, T> getInstance() {
+        return (Transformer<T, T>) INSTANCE;
     }
 
     /**
@@ -61,7 +62,7 @@ public class CloneTransformer implements Transformer, Serializable {
      * @param input  the input object to transform
      * @return the transformed result
      */
-    public Object transform(Object input) {
+    public T transform(T input) {
         if (input == null) {
             return null;
         }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/ClosureTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/ClosureTransformer.java b/src/java/org/apache/commons/collections/functors/ClosureTransformer.java
index 6eda96d..e55685e 100644
--- a/src/java/org/apache/commons/collections/functors/ClosureTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/ClosureTransformer.java
@@ -30,13 +30,13 @@ import org.apache.commons.collections.Transformer;
  *
  * @author Stephen Colebourne
  */
-public class ClosureTransformer implements Transformer, Serializable {
+public class ClosureTransformer<T> implements Transformer<T, T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = 478466901448617286L;
 
     /** The closure to wrap */
-    private final Closure iClosure;
+    private final Closure<? super T> iClosure;
 
     /**
      * Factory method that performs validation.
@@ -45,11 +45,11 @@ public class ClosureTransformer implements Transformer, Serializable {
      * @return the <code>closure</code> transformer
      * @throws IllegalArgumentException if the closure is null
      */
-    public static Transformer getInstance(Closure closure) {
+    public static <T> Transformer<T, T> getInstance(Closure<? super T> closure) {
         if (closure == null) {
             throw new IllegalArgumentException("Closure must not be null");
         }
-        return new ClosureTransformer(closure);
+        return new ClosureTransformer<T>(closure);
     }
 
     /**
@@ -58,7 +58,7 @@ public class ClosureTransformer implements Transformer, Serializable {
      * 
      * @param closure  the closure to call, not null
      */
-    public ClosureTransformer(Closure closure) {
+    public ClosureTransformer(Closure<? super T> closure) {
         super();
         iClosure = closure;
     }
@@ -69,7 +69,7 @@ public class ClosureTransformer implements Transformer, Serializable {
      * @param input  the input object to transform
      * @return the transformed result
      */
-    public Object transform(Object input) {
+    public T transform(T input) {
         iClosure.execute(input);
         return input;
     }
@@ -80,7 +80,7 @@ public class ClosureTransformer implements Transformer, Serializable {
      * @return the closure
      * @since Commons Collections 3.1
      */
-    public Closure getClosure() {
+    public Closure<? super T> getClosure() {
         return iClosure;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/ConstantFactory.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/ConstantFactory.java b/src/java/org/apache/commons/collections/functors/ConstantFactory.java
index 658ad4e..ef7fea9 100644
--- a/src/java/org/apache/commons/collections/functors/ConstantFactory.java
+++ b/src/java/org/apache/commons/collections/functors/ConstantFactory.java
@@ -32,16 +32,16 @@ import org.apache.commons.collections.Factory;
  *
  * @author Stephen Colebourne
  */
-public class ConstantFactory implements Factory, Serializable {
+public class ConstantFactory<T> implements Factory<T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = -3520677225766901240L;
     
     /** Returns null each time */
-    public static final Factory NULL_INSTANCE = new ConstantFactory(null);
+    public static final Factory<Object> NULL_INSTANCE = new ConstantFactory<Object>(null);
 
     /** The closures to call in turn */
-    private final Object iConstant;
+    private final T iConstant;
 
     /**
      * Factory method that performs validation.
@@ -49,11 +49,12 @@ public class ConstantFactory implements Factory, Serializable {
      * @param constantToReturn  the constant object to return each time in the factory
      * @return the <code>constant</code> factory.
      */
-    public static Factory getInstance(Object constantToReturn) {
+    @SuppressWarnings("unchecked")
+    public static <T> Factory<T> getInstance(T constantToReturn) {
         if (constantToReturn == null) {
-            return NULL_INSTANCE;
+            return (Factory<T>) NULL_INSTANCE;
         }
-        return new ConstantFactory(constantToReturn);
+        return new ConstantFactory<T>(constantToReturn);
     }
     
     /**
@@ -62,7 +63,7 @@ public class ConstantFactory implements Factory, Serializable {
      * 
      * @param constantToReturn  the constant to return each time
      */
-    public ConstantFactory(Object constantToReturn) {
+    public ConstantFactory(T constantToReturn) {
         super();
         iConstant = constantToReturn;
     }
@@ -72,7 +73,7 @@ public class ConstantFactory implements Factory, Serializable {
      * 
      * @return the stored constant value
      */
-    public Object create() {
+    public T create() {
         return iConstant;
     }
 
@@ -82,7 +83,7 @@ public class ConstantFactory implements Factory, Serializable {
      * @return the constant
      * @since Commons Collections 3.1
      */
-    public Object getConstant() {
+    public T getConstant() {
         return iConstant;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/ConstantTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/ConstantTransformer.java b/src/java/org/apache/commons/collections/functors/ConstantTransformer.java
index 6ac19e0..bd748bd 100644
--- a/src/java/org/apache/commons/collections/functors/ConstantTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/ConstantTransformer.java
@@ -32,16 +32,27 @@ import org.apache.commons.collections.Transformer;
  *
  * @author Stephen Colebourne
  */
-public class ConstantTransformer implements Transformer, Serializable {
+public class ConstantTransformer<I, O> implements Transformer<I, O>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = 6374440726369055124L;
     
     /** Returns null each time */
-    public static final Transformer NULL_INSTANCE = new ConstantTransformer(null);
+    public static final Transformer<Object, Object> NULL_INSTANCE = new ConstantTransformer<Object, Object>(null);
 
     /** The closures to call in turn */
-    private final Object iConstant;
+    private final O iConstant;
+
+    /**
+     * Get a typed null instance.
+     * @param <I>
+     * @param <O>
+     * @return Transformer<I, O> that always returns null.
+     */
+    @SuppressWarnings("unchecked")
+    public static <I, O> Transformer<I, O> getNullInstance() {
+        return (Transformer<I, O>) NULL_INSTANCE;
+    }
 
     /**
      * Transformer method that performs validation.
@@ -49,11 +60,11 @@ public class ConstantTransformer implements Transformer, Serializable {
      * @param constantToReturn  the constant object to return each time in the factory
      * @return the <code>constant</code> factory.
      */
-    public static Transformer getInstance(Object constantToReturn) {
+    public static <I, O> Transformer<I, O> getInstance(O constantToReturn) {
         if (constantToReturn == null) {
-            return NULL_INSTANCE;
+            return getNullInstance();
         }
-        return new ConstantTransformer(constantToReturn);
+        return new ConstantTransformer<I, O>(constantToReturn);
     }
     
     /**
@@ -62,7 +73,7 @@ public class ConstantTransformer implements Transformer, Serializable {
      * 
      * @param constantToReturn  the constant to return each time
      */
-    public ConstantTransformer(Object constantToReturn) {
+    public ConstantTransformer(O constantToReturn) {
         super();
         iConstant = constantToReturn;
     }
@@ -73,7 +84,7 @@ public class ConstantTransformer implements Transformer, Serializable {
      * @param input  the input object which is ignored
      * @return the stored constant
      */
-    public Object transform(Object input) {
+    public O transform(I input) {
         return iConstant;
     }
 
@@ -83,8 +94,34 @@ public class ConstantTransformer implements Transformer, Serializable {
      * @return the constant
      * @since Commons Collections 3.1
      */
-    public Object getConstant() {
+    public O getConstant() {
         return iConstant;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == this) {
+            return true;
+        }
+        if (obj instanceof ConstantTransformer == false) {
+            return false;
+        }
+        Object otherConstant = ((ConstantTransformer<?, ?>) obj).getConstant();
+        return otherConstant == getConstant() || otherConstant != null && otherConstant.equals(getConstant());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode() {
+        int result = "ConstantTransformer".hashCode() << 2;
+        if (getConstant() != null) {
+            result |= getConstant().hashCode();
+        }
+        return result;
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/EqualPredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/EqualPredicate.java b/src/java/org/apache/commons/collections/functors/EqualPredicate.java
index bf9fc4d..231a235 100644
--- a/src/java/org/apache/commons/collections/functors/EqualPredicate.java
+++ b/src/java/org/apache/commons/collections/functors/EqualPredicate.java
@@ -62,7 +62,7 @@ public final class EqualPredicate<T> implements Predicate<T>, Serializable {
      * @return the predicate
      * @throws IllegalArgumentException if the predicate is null
      */
-    public static <T, O extends T> Predicate<T> equalPredicate(O object) {
+    public static <T> Predicate<T> equalPredicate(T object) {
         if (object == null) {
             return nullPredicate();
         }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/ExceptionClosure.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/ExceptionClosure.java b/src/java/org/apache/commons/collections/functors/ExceptionClosure.java
index 5079348..b5f73a9 100644
--- a/src/java/org/apache/commons/collections/functors/ExceptionClosure.java
+++ b/src/java/org/apache/commons/collections/functors/ExceptionClosure.java
@@ -29,14 +29,13 @@ import org.apache.commons.collections.FunctorException;
  *
  * @author Stephen Colebourne
  */
-public final class ExceptionClosure implements Closure, Serializable {
+public final class ExceptionClosure<E> implements Closure<E>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = 7179106032121985545L;
-    
 
     /** Singleton predicate instance */
-    public static final Closure INSTANCE = new ExceptionClosure();
+    public static final Closure<Object> INSTANCE = new ExceptionClosure<Object>();
 
     /**
      * Factory returning the singleton instance.
@@ -44,8 +43,9 @@ public final class ExceptionClosure implements Closure, Serializable {
      * @return the singleton instance
      * @since Commons Collections 3.1
      */
-    public static Closure getInstance() {
-        return INSTANCE;
+    @SuppressWarnings("unchecked")
+    public static <E> Closure<E> getInstance() {
+        return (Closure<E>) INSTANCE;
     }
 
     /**
@@ -61,7 +61,7 @@ public final class ExceptionClosure implements Closure, Serializable {
      * @param input  the input object
      * @throws FunctorException always
      */
-    public void execute(Object input) {
+    public void execute(E input) {
         throw new FunctorException("ExceptionClosure invoked");
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/ExceptionFactory.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/ExceptionFactory.java b/src/java/org/apache/commons/collections/functors/ExceptionFactory.java
index 2f8a934..56d54ef 100644
--- a/src/java/org/apache/commons/collections/functors/ExceptionFactory.java
+++ b/src/java/org/apache/commons/collections/functors/ExceptionFactory.java
@@ -29,14 +29,13 @@ import org.apache.commons.collections.FunctorException;
  *
  * @author Stephen Colebourne
  */
-public final class ExceptionFactory implements Factory, Serializable {
+public final class ExceptionFactory<T> implements Factory<T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = 7179106032121985545L;
-    
 
     /** Singleton predicate instance */
-    public static final Factory INSTANCE = new ExceptionFactory();
+    public static final Factory<Object> INSTANCE = new ExceptionFactory<Object>();
 
     /**
      * Factory returning the singleton instance.
@@ -44,8 +43,9 @@ public final class ExceptionFactory implements Factory, Serializable {
      * @return the singleton instance
      * @since Commons Collections 3.1
      */
-    public static Factory getInstance() {
-        return INSTANCE;
+    @SuppressWarnings("unchecked")
+    public static <T> Factory<T> getInstance() {
+        return (Factory<T>) INSTANCE;
     }
 
     /**
@@ -61,7 +61,7 @@ public final class ExceptionFactory implements Factory, Serializable {
      * @return never
      * @throws FunctorException always
      */
-    public Object create() {
+    public T create() {
         throw new FunctorException("ExceptionFactory invoked");
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/ExceptionPredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/ExceptionPredicate.java b/src/java/org/apache/commons/collections/functors/ExceptionPredicate.java
index c7e4f21..238e455 100644
--- a/src/java/org/apache/commons/collections/functors/ExceptionPredicate.java
+++ b/src/java/org/apache/commons/collections/functors/ExceptionPredicate.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,28 +23,29 @@ import org.apache.commons.collections.Predicate;
 
 /**
  * Predicate implementation that always throws an exception.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
  * @author Stephen Colebourne
  */
-public final class ExceptionPredicate implements Predicate, Serializable {
+public final class ExceptionPredicate<T> implements Predicate<T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = 7179106032121985545L;
-    
+
     /** Singleton predicate instance */
-    public static final Predicate INSTANCE = new ExceptionPredicate();
+    public static final Predicate<Object> INSTANCE = new ExceptionPredicate<Object>();
 
     /**
      * Factory returning the singleton instance.
-     * 
+     *
      * @return the singleton instance
      * @since Commons Collections 3.1
      */
-    public static Predicate getInstance() {
-        return INSTANCE;
+    @SuppressWarnings("unchecked")
+    public static <T> Predicate<T> getInstance() {
+        return (Predicate<T>) INSTANCE;
     }
 
     /**
@@ -56,13 +57,13 @@ public final class ExceptionPredicate implements Predicate, Serializable {
 
     /**
      * Evaluates the predicate always throwing an exception.
-     * 
+     *
      * @param object  the input object
      * @return never
      * @throws FunctorException always
      */
-    public boolean evaluate(Object object) {
+    public boolean evaluate(T object) {
         throw new FunctorException("ExceptionPredicate invoked");
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/ExceptionTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/ExceptionTransformer.java b/src/java/org/apache/commons/collections/functors/ExceptionTransformer.java
index c41a76f..b1bcf2c 100644
--- a/src/java/org/apache/commons/collections/functors/ExceptionTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/ExceptionTransformer.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,29 +23,29 @@ import org.apache.commons.collections.Transformer;
 
 /**
  * Transformer implementation that always throws an exception.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
  * @author Stephen Colebourne
  */
-public final class ExceptionTransformer implements Transformer, Serializable {
+public final class ExceptionTransformer<I, O> implements Transformer<I, O>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = 7179106032121985545L;
-    
 
     /** Singleton predicate instance */
-    public static final Transformer INSTANCE = new ExceptionTransformer();
+    public static final Transformer<Object, Object> INSTANCE = new ExceptionTransformer<Object, Object>();
 
     /**
      * Factory returning the singleton instance.
-     * 
+     *
      * @return the singleton instance
      * @since Commons Collections 3.1
      */
-    public static Transformer getInstance() {
-        return INSTANCE;
+    @SuppressWarnings("unchecked")
+    public static <I, O> Transformer<I, O> getInstance() {
+        return (Transformer<I, O>) INSTANCE;
     }
 
     /**
@@ -57,12 +57,12 @@ public final class ExceptionTransformer implements Transformer, Serializable {
 
     /**
      * Transforms the input to result by cloning it.
-     * 
+     *
      * @param input  the input object to transform
      * @return never
      * @throws FunctorException always
      */
-    public Object transform(Object input) {
+    public O transform(I input) {
         throw new FunctorException("ExceptionTransformer invoked");
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/FactoryTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/FactoryTransformer.java b/src/java/org/apache/commons/collections/functors/FactoryTransformer.java
index 97359b3..340aa00 100644
--- a/src/java/org/apache/commons/collections/functors/FactoryTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/FactoryTransformer.java
@@ -29,13 +29,13 @@ import org.apache.commons.collections.Transformer;
  *
  * @author Stephen Colebourne
  */
-public class FactoryTransformer implements Transformer, Serializable {
+public class FactoryTransformer<I, O> implements Transformer<I, O>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = -6817674502475353160L;
 
     /** The factory to wrap */
-    private final Factory iFactory;
+    private final Factory<? extends O> iFactory;
 
     /**
      * Factory method that performs validation.
@@ -44,11 +44,11 @@ public class FactoryTransformer implements Transformer, Serializable {
      * @return the <code>factory</code> transformer
      * @throws IllegalArgumentException if the factory is null
      */
-    public static Transformer getInstance(Factory factory) {
+    public static <I, O> Transformer<I, O> getInstance(Factory<? extends O> factory) {
         if (factory == null) {
             throw new IllegalArgumentException("Factory must not be null");
         }
-        return new FactoryTransformer(factory);
+        return new FactoryTransformer<I, O>(factory);
     }
 
     /**
@@ -57,7 +57,7 @@ public class FactoryTransformer implements Transformer, Serializable {
      * 
      * @param factory  the factory to call, not null
      */
-    public FactoryTransformer(Factory factory) {
+    public FactoryTransformer(Factory<? extends O> factory) {
         super();
         iFactory = factory;
     }
@@ -69,7 +69,7 @@ public class FactoryTransformer implements Transformer, Serializable {
      * @param input  the input object to transform
      * @return the transformed result
      */
-    public Object transform(Object input) {
+    public O transform(I input) {
         return iFactory.create();
     }
 
@@ -79,7 +79,7 @@ public class FactoryTransformer implements Transformer, Serializable {
      * @return the factory
      * @since Commons Collections 3.1
      */
-    public Factory getFactory() {
+    public Factory<? extends O> getFactory() {
         return iFactory;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/FalsePredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/FalsePredicate.java b/src/java/org/apache/commons/collections/functors/FalsePredicate.java
index 4560b9b..c007844 100644
--- a/src/java/org/apache/commons/collections/functors/FalsePredicate.java
+++ b/src/java/org/apache/commons/collections/functors/FalsePredicate.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.
@@ -22,28 +22,40 @@ import org.apache.commons.collections.Predicate;
 
 /**
  * Predicate implementation that always returns false.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
  * @author Stephen Colebourne
  */
-public final class FalsePredicate implements Predicate, Serializable {
+public final class FalsePredicate<T> implements Predicate<T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = 7533784454832764388L;
-    
+
     /** Singleton predicate instance */
-    public static final Predicate INSTANCE = new FalsePredicate();
+    public static final Predicate<Object> INSTANCE = new FalsePredicate<Object>();
 
     /**
-     * Factory returning the singleton instance.
-     * 
+     * Get a typed instance.
+     *
      * @return the singleton instance
      * @since Commons Collections 3.1
+     * @deprecated use {@link #falsePredicate()} instead.
+     */
+    public static <T> Predicate<T> getInstance() {
+        return FalsePredicate.<T>falsePredicate();
+    }
+
+    /**
+     * Get a typed instance.
+     *
+     * @return the singleton instance
+     * @since Commons Collections 5
      */
-    public static Predicate getInstance() {
-        return INSTANCE;
+    @SuppressWarnings("unchecked")
+    public static <T> Predicate<T> falsePredicate() {
+        return (Predicate<T>) INSTANCE;
     }
 
     /**
@@ -55,11 +67,11 @@ public final class FalsePredicate implements Predicate, Serializable {
 
     /**
      * Evaluates the predicate returning false always.
-     * 
+     *
      * @param object  the input object
      * @return false always
      */
-    public boolean evaluate(Object object) {
+    public boolean evaluate(T object) {
         return false;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/ForClosure.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/ForClosure.java b/src/java/org/apache/commons/collections/functors/ForClosure.java
index 9ebad4a..b77ed5e 100644
--- a/src/java/org/apache/commons/collections/functors/ForClosure.java
+++ b/src/java/org/apache/commons/collections/functors/ForClosure.java
@@ -28,7 +28,7 @@ import org.apache.commons.collections.Closure;
  *
  * @author Stephen Colebourne
  */
-public class ForClosure implements Closure, Serializable {
+public class ForClosure<E> implements Closure<E>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = -1190120533393621674L;
@@ -36,7 +36,7 @@ public class ForClosure implements Closure, Serializable {
     /** The number of times to loop */
     private final int iCount;
     /** The closure to call */
-    private final Closure iClosure;
+    private final Closure<? super E> iClosure;
 
     /**
      * Factory method that performs validation.
@@ -48,14 +48,15 @@ public class ForClosure implements Closure, Serializable {
      * @param closure  the closure to execute, not null
      * @return the <code>for</code> closure
      */
-    public static Closure getInstance(int count, Closure closure) {
+    @SuppressWarnings("unchecked")
+    public static <E> Closure<E> getInstance(int count, Closure<? super E> closure) {
         if (count <= 0 || closure == null) {
-            return NOPClosure.INSTANCE;
+            return NOPClosure.<E>getInstance();
         }
         if (count == 1) {
-            return closure;
+            return (Closure<E>) closure;
         }
-        return new ForClosure(count, closure);
+        return new ForClosure<E>(count, closure);
     }
 
     /**
@@ -65,7 +66,7 @@ public class ForClosure implements Closure, Serializable {
      * @param count  the number of times to execute the closure
      * @param closure  the closure to execute, not null
      */
-    public ForClosure(int count, Closure closure) {
+    public ForClosure(int count, Closure<? super E> closure) {
         super();
         iCount = count;
         iClosure = closure;
@@ -76,7 +77,7 @@ public class ForClosure implements Closure, Serializable {
      * 
      * @param input  the input object
      */
-    public void execute(Object input) {
+    public void execute(E input) {
         for (int i = 0; i < iCount; i++) {
             iClosure.execute(input);
         }
@@ -88,7 +89,7 @@ public class ForClosure implements Closure, Serializable {
      * @return the closure
      * @since Commons Collections 3.1
      */
-    public Closure getClosure() {
+    public Closure<? super E> getClosure() {
         return iClosure;
     }
 


[14/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java b/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java
index 1ec5c34..8d1a857 100644
--- a/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java
+++ b/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.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.
@@ -34,74 +34,89 @@ import org.apache.commons.collections.map.AbstractTestSortedMap;
 
 /**
  * Abstract test class for {@link SortedBidiMap} methods and contracts.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Matthew Hawthorne
  * @author Stephen Colebourne
  */
-public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiMap {
+public abstract class AbstractTestSortedBidiMap<K extends Comparable<K>, V extends Comparable<V>> extends AbstractTestOrderedBidiMap<K, V> {
 
-    protected List sortedKeys = new ArrayList();
-    protected List sortedValues = new ArrayList();
-    protected SortedSet sortedNewValues = new TreeSet();
+    protected List<K> sortedKeys = new ArrayList<K>();
+    protected List<V> sortedValues = new ArrayList<V>();
+    protected SortedSet<V> sortedNewValues = new TreeSet<V>();
 
     public AbstractTestSortedBidiMap(String testName) {
         super(testName);
         sortedKeys.addAll(Arrays.asList(getSampleKeys()));
         Collections.sort(sortedKeys);
         sortedKeys = Collections.unmodifiableList(sortedKeys);
-        
-        Map map = new TreeMap();
-        for (int i = 0; i < getSampleKeys().length; i++) {
-            map.put(getSampleKeys()[i], getSampleValues()[i]);
-        }
-        sortedValues.addAll(map.values());
-        sortedValues = Collections.unmodifiableList(sortedValues);
-        
-        sortedNewValues.addAll(Arrays.asList(getNewSampleValues()));
-    }
 
-    public AbstractTestSortedBidiMap() {
-        super();
-        sortedKeys.addAll(Arrays.asList(getSampleValues()));
-        Collections.sort(sortedKeys);
-        sortedKeys = Collections.unmodifiableList(sortedKeys);
-        
-        Map map = new TreeMap();
-        for (int i = 0; i < getSampleKeys().length; i++) {
-            map.put(getSampleValues()[i], getSampleKeys()[i]);
-        }
+        Map<K, V> map = new TreeMap<K, V>();
+        addSampleMappings(map);
+
         sortedValues.addAll(map.values());
         sortedValues = Collections.unmodifiableList(sortedValues);
-        
+
         sortedNewValues.addAll(Arrays.asList(getNewSampleValues()));
     }
 
+//    public AbstractTestSortedBidiMap() {
+//        super();
+//        sortedKeys.addAll(Arrays.asList(getSampleValues()));
+//        Collections.sort(sortedKeys);
+//        sortedKeys = Collections.unmodifiableList(sortedKeys);
+//
+//        Map map = new TreeMap();
+//        for (int i = 0; i < getSampleKeys().length; i++) {
+//            map.put(getSampleValues()[i], getSampleKeys()[i]);
+//        }
+//        sortedValues.addAll(map.values());
+//        sortedValues = Collections.unmodifiableList(sortedValues);
+//
+//        sortedNewValues.addAll(Arrays.asList(getNewSampleValues()));
+//    }
+
     //-----------------------------------------------------------------------
     public boolean isAllowNullKey() {
         return false;
     }
+
     public boolean isAllowNullValue() {
         return false;
     }
-    public Map makeConfirmedMap() {
-        return new TreeMap();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public abstract SortedBidiMap<K, V> makeObject();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public SortedBidiMap<K, V> makeFullMap() {
+        return (SortedBidiMap<K, V>) super.makeFullMap();
+    }
+
+    public SortedMap<K, V> makeConfirmedMap() {
+        return new TreeMap<K, V>();
     }
 
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
     public void testBidiHeadMapContains() {
         // extra test as other tests get complex
-        SortedBidiMap sm = (SortedBidiMap) makeFullMap();
-        Iterator it = sm.keySet().iterator();
-        Object first = it.next();
-        Object toKey = it.next();
-        Object second = it.next();
-        Object firstValue = sm.get(first);
-        Object secondValue = sm.get(second);
-        
-        SortedMap head = sm.headMap(toKey);
+        SortedBidiMap<K, V> sm = makeFullMap();
+        Iterator<K> it = sm.keySet().iterator();
+        K first = it.next();
+        K toKey = it.next();
+        K second = it.next();
+        V firstValue = sm.get(first);
+        V secondValue = sm.get(second);
+
+        SortedMap<K, V> head = sm.headMap(toKey);
         assertEquals(1, head.size());
         assertEquals(true, sm.containsKey(first));
         assertEquals(true, head.containsKey(first));
@@ -112,44 +127,44 @@ public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiM
         assertEquals(true, sm.containsValue(secondValue));
         assertEquals(false, head.containsValue(secondValue));
     }
-                
+
     //-----------------------------------------------------------------------
     public void testBidiClearByHeadMap() {
         if (isRemoveSupported() == false) return;
-        
+
         // extra test as other tests get complex
-        SortedBidiMap sm = (SortedBidiMap) makeFullMap();
-        Iterator it = sm.keySet().iterator();
-        Object first = it.next();
-        Object second = it.next();
-        Object toKey = it.next();
-        
-        Object firstValue = sm.get(first);
-        Object secondValue = sm.get(second);
-        Object toKeyValue = sm.get(toKey);
-        
-        SortedMap sub = sm.headMap(toKey);
+        SortedBidiMap<K, V> sm = makeFullMap();
+        Iterator<K> it = sm.keySet().iterator();
+        K first = it.next();
+        K second = it.next();
+        K toKey = it.next();
+
+        V firstValue = sm.get(first);
+        V secondValue = sm.get(second);
+        V toKeyValue = sm.get(toKey);
+
+        SortedMap<K, V> sub = sm.headMap(toKey);
         int size = sm.size();
         assertEquals(2, sub.size());
         sub.clear();
         assertEquals(0, sub.size());
         assertEquals(size - 2, sm.size());
         assertEquals(size - 2, sm.inverseBidiMap().size());
-        
+
         assertEquals(false, sm.containsKey(first));
         assertEquals(false, sm.containsValue(firstValue));
         assertEquals(false, sm.inverseBidiMap().containsKey(firstValue));
         assertEquals(false, sm.inverseBidiMap().containsValue(first));
         assertEquals(false, sub.containsKey(first));
         assertEquals(false, sub.containsValue(firstValue));
-        
+
         assertEquals(false, sm.containsKey(second));
         assertEquals(false, sm.containsValue(secondValue));
         assertEquals(false, sm.inverseBidiMap().containsKey(secondValue));
         assertEquals(false, sm.inverseBidiMap().containsValue(second));
         assertEquals(false, sub.containsKey(second));
         assertEquals(false, sub.containsValue(secondValue));
-        
+
         assertEquals(true, sm.containsKey(toKey));
         assertEquals(true, sm.containsValue(toKeyValue));
         assertEquals(true, sm.inverseBidiMap().containsKey(toKeyValue));
@@ -161,23 +176,23 @@ public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiM
     //-----------------------------------------------------------------------
     public void testBidiRemoveByHeadMap() {
         if (isRemoveSupported() == false) return;
-        
+
         // extra test as other tests get complex
-        SortedBidiMap sm = (SortedBidiMap) makeFullMap();
-        Iterator it = sm.keySet().iterator();
-        Object first = it.next();
-        Object second = it.next();
-        Object toKey = it.next();
-        
+        SortedBidiMap<K, V> sm = makeFullMap();
+        Iterator<K> it = sm.keySet().iterator();
+        K first = it.next();
+        K second = it.next();
+        K toKey = it.next();
+
         int size = sm.size();
-        SortedMap sub = sm.headMap(toKey);
+        SortedMap<K, V> sub = sm.headMap(toKey);
         assertEquals(2, sub.size());
         assertEquals(true, sm.containsKey(first));
         assertEquals(true, sub.containsKey(first));
         assertEquals(true, sm.containsKey(second));
         assertEquals(true, sub.containsKey(second));
-        
-        Object firstValue = sub.remove(first);
+
+        V firstValue = sub.remove(first);
         assertEquals(1, sub.size());
         assertEquals(size - 1, sm.size());
         assertEquals(size - 1, sm.inverseBidiMap().size());
@@ -187,8 +202,8 @@ public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiM
         assertEquals(false, sm.inverseBidiMap().containsValue(first));
         assertEquals(false, sub.containsKey(first));
         assertEquals(false, sub.containsValue(firstValue));
-        
-        Object secondValue = sub.remove(second);
+
+        V secondValue = sub.remove(second);
         assertEquals(0, sub.size());
         assertEquals(size - 2, sm.size());
         assertEquals(size - 2, sm.inverseBidiMap().size());
@@ -203,30 +218,30 @@ public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiM
     //-----------------------------------------------------------------------
     public void testBidiRemoveByHeadMapEntrySet() {
         if (isRemoveSupported() == false) return;
-        
+
         // extra test as other tests get complex
-        SortedBidiMap sm = (SortedBidiMap) makeFullMap();
-        Iterator it = sm.keySet().iterator();
-        Object first = it.next();
-        Object second = it.next();
-        Object toKey = it.next();
-        
+        SortedBidiMap<K, V> sm = makeFullMap();
+        Iterator<K> it = sm.keySet().iterator();
+        K first = it.next();
+        K second = it.next();
+        K toKey = it.next();
+
         int size = sm.size();
-        SortedMap sub = sm.headMap(toKey);
-        Set set = sub.entrySet();
+        SortedMap<K, V> sub = sm.headMap(toKey);
+        Set<Map.Entry<K, V>> set = sub.entrySet();
         assertEquals(2, sub.size());
         assertEquals(2, set.size());
-        
-        Iterator it2 = set.iterator();
-        Map.Entry firstEntry = cloneMapEntry((Map.Entry) it2.next());
-        Map.Entry secondEntry = cloneMapEntry((Map.Entry) it2.next());
+
+        Iterator<Map.Entry<K, V>> it2 = set.iterator();
+        Map.Entry<K, V> firstEntry = cloneMapEntry(it2.next());
+        Map.Entry<K, V> secondEntry = cloneMapEntry(it2.next());
         assertEquals(true, sm.containsKey(first));
         assertEquals(true, sub.containsKey(first));
         assertEquals(true, set.contains(firstEntry));
         assertEquals(true, sm.containsKey(second));
         assertEquals(true, sub.containsKey(second));
         assertEquals(true, set.contains(secondEntry));
-        
+
         set.remove(firstEntry);
         assertEquals(1, sub.size());
         assertEquals(size - 1, sm.size());
@@ -238,7 +253,7 @@ public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiM
         assertEquals(false, sub.containsKey(firstEntry.getKey()));
         assertEquals(false, sub.containsValue(firstEntry.getValue()));
         assertEquals(false, set.contains(firstEntry));
-        
+
         set.remove(secondEntry);
         assertEquals(0, sub.size());
         assertEquals(size - 2, sm.size());
@@ -256,16 +271,16 @@ public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiM
     //-----------------------------------------------------------------------
     public void testBidiTailMapContains() {
         // extra test as other tests get complex
-        SortedBidiMap sm = (SortedBidiMap) makeFullMap();
-        Iterator it = sm.keySet().iterator();
-        Object first = it.next();
-        Object fromKey = it.next();
-        Object second = it.next();
-        Object firstValue = sm.get(first);
-        Object fromKeyValue = sm.get(fromKey);
-        Object secondValue = sm.get(second);
-        
-        SortedMap sub = sm.tailMap(fromKey);
+        SortedBidiMap<K, V> sm = makeFullMap();
+        Iterator<K> it = sm.keySet().iterator();
+        K first = it.next();
+        K fromKey = it.next();
+        K second = it.next();
+        V firstValue = sm.get(first);
+        V fromKeyValue = sm.get(fromKey);
+        V secondValue = sm.get(second);
+
+        SortedMap<K, V> sub = sm.tailMap(fromKey);
         assertEquals(sm.size() - 1, sub.size());
         assertEquals(true, sm.containsKey(first));
         assertEquals(false, sub.containsKey(first));
@@ -284,42 +299,42 @@ public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiM
     //-----------------------------------------------------------------------
     public void testBidiClearByTailMap() {
         if (isRemoveSupported() == false) return;
-        
+
         // extra test as other tests get complex
-        SortedBidiMap sm = (SortedBidiMap) makeFullMap();
-        Iterator it = sm.keySet().iterator();
+        SortedBidiMap<K, V> sm = makeFullMap();
+        Iterator<K> it = sm.keySet().iterator();
         it.next();
         it.next();
-        Object first = it.next();
-        Object fromKey = it.next();
-        Object second = it.next();
-        
-        Object firstValue = sm.get(first);
-        Object fromKeyValue = sm.get(fromKey);
-        Object secondValue = sm.get(second);
-        
-        SortedMap sub = sm.tailMap(fromKey);
+        K first = it.next();
+        K fromKey = it.next();
+        K second = it.next();
+
+        V firstValue = sm.get(first);
+        V fromKeyValue = sm.get(fromKey);
+        V secondValue = sm.get(second);
+
+        SortedMap<K, V> sub = sm.tailMap(fromKey);
         int size = sm.size();
         assertEquals(size - 3, sub.size());
         sub.clear();
         assertEquals(0, sub.size());
         assertEquals(3, sm.size());
         assertEquals(3, sm.inverseBidiMap().size());
-        
+
         assertEquals(true, sm.containsKey(first));
         assertEquals(true, sm.containsValue(firstValue));
         assertEquals(true, sm.inverseBidiMap().containsKey(firstValue));
         assertEquals(true, sm.inverseBidiMap().containsValue(first));
         assertEquals(false, sub.containsKey(first));
         assertEquals(false, sub.containsValue(firstValue));
-        
+
         assertEquals(false, sm.containsKey(fromKey));
         assertEquals(false, sm.containsValue(fromKeyValue));
         assertEquals(false, sm.inverseBidiMap().containsKey(fromKeyValue));
         assertEquals(false, sm.inverseBidiMap().containsValue(fromKey));
         assertEquals(false, sub.containsKey(fromKey));
         assertEquals(false, sub.containsValue(fromKeyValue));
-        
+
         assertEquals(false, sm.containsKey(second));
         assertEquals(false, sm.containsValue(secondValue));
         assertEquals(false, sm.inverseBidiMap().containsKey(secondValue));
@@ -328,26 +343,26 @@ public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiM
         assertEquals(false, sub.containsValue(secondValue));
     }
 
-    //-----------------------------------------------------------------------                
+    //-----------------------------------------------------------------------
     public void testBidiRemoveByTailMap() {
         if (isRemoveSupported() == false) return;
-        
+
         // extra test as other tests get complex
-        SortedBidiMap sm = (SortedBidiMap) makeFullMap();
-        Iterator it = sm.keySet().iterator();
+        SortedBidiMap<K, V> sm = makeFullMap();
+        Iterator<K> it = sm.keySet().iterator();
         it.next();
         it.next();
-        Object fromKey = it.next();
-        Object first = it.next();
-        Object second = it.next();
-        
+        K fromKey = it.next();
+        K first = it.next();
+        K second = it.next();
+
         int size = sm.size();
-        SortedMap sub = sm.tailMap(fromKey);
+        SortedMap<K, V> sub = sm.tailMap(fromKey);
         assertEquals(true, sm.containsKey(first));
         assertEquals(true, sub.containsKey(first));
         assertEquals(true, sm.containsKey(second));
         assertEquals(true, sub.containsKey(second));
-        
+
         Object firstValue = sub.remove(first);
         assertEquals(size - 3, sub.size());
         assertEquals(size - 1, sm.size());
@@ -358,7 +373,7 @@ public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiM
         assertEquals(false, sm.inverseBidiMap().containsValue(first));
         assertEquals(false, sub.containsKey(first));
         assertEquals(false, sub.containsValue(firstValue));
-        
+
         Object secondValue = sub.remove(second);
         assertEquals(size - 4, sub.size());
         assertEquals(size - 2, sm.size());
@@ -374,30 +389,30 @@ public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiM
     //-----------------------------------------------------------------------
     public void testBidiRemoveByTailMapEntrySet() {
         if (isRemoveSupported() == false) return;
-        
+
         // extra test as other tests get complex
-        SortedBidiMap sm = (SortedBidiMap) makeFullMap();
-        Iterator it = sm.keySet().iterator();
+        SortedBidiMap<K, V> sm = makeFullMap();
+        Iterator<K> it = sm.keySet().iterator();
         it.next();
         it.next();
-        Object fromKey = it.next();
-        Object first = it.next();
-        Object second = it.next();
-        
+        K fromKey = it.next();
+        K first = it.next();
+        K second = it.next();
+
         int size = sm.size();
-        SortedMap sub = sm.tailMap(fromKey);
-        Set set = sub.entrySet();
-        Iterator it2 = set.iterator();
-        Object fromEntry = it2.next();
-        Map.Entry firstEntry = cloneMapEntry((Map.Entry) it2.next());
-        Map.Entry secondEntry = cloneMapEntry((Map.Entry) it2.next());
+        SortedMap<K, V> sub = sm.tailMap(fromKey);
+        Set<Map.Entry<K, V>> set = sub.entrySet();
+        Iterator<Map.Entry<K, V>> it2 = set.iterator();
+        it2.next();
+        Map.Entry<K, V> firstEntry = cloneMapEntry(it2.next());
+        Map.Entry<K, V> secondEntry = cloneMapEntry(it2.next());
         assertEquals(true, sm.containsKey(first));
         assertEquals(true, sub.containsKey(first));
         assertEquals(true, set.contains(firstEntry));
         assertEquals(true, sm.containsKey(second));
         assertEquals(true, sub.containsKey(second));
         assertEquals(true, set.contains(secondEntry));
-        
+
         set.remove(firstEntry);
         assertEquals(size - 3, sub.size());
         assertEquals(size - 1, sm.size());
@@ -409,7 +424,7 @@ public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiM
         assertEquals(false, sub.containsKey(firstEntry.getKey()));
         assertEquals(false, sub.containsValue(firstEntry.getValue()));
         assertEquals(false, set.contains(firstEntry));
-        
+
         set.remove(secondEntry);
         assertEquals(size - 4, sub.size());
         assertEquals(size - 2, sm.size());
@@ -427,19 +442,19 @@ public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiM
     //-----------------------------------------------------------------------
     public void testBidiSubMapContains() {
         // extra test as other tests get complex
-        SortedBidiMap sm = (SortedBidiMap) makeFullMap();
-        Iterator it = sm.keySet().iterator();
-        Object first = it.next();
-        Object fromKey = it.next();
-        Object second = it.next();
-        Object toKey = it.next();
-        Object third = it.next();
-        Object firstValue = sm.get(first);
-        Object fromKeyValue = sm.get(fromKey);
-        Object secondValue = sm.get(second);
-        Object thirdValue = sm.get(third);
-        
-        SortedMap sub = sm.subMap(fromKey, toKey);
+        SortedBidiMap<K, V> sm = makeFullMap();
+        Iterator<K> it = sm.keySet().iterator();
+        K first = it.next();
+        K fromKey = it.next();
+        K second = it.next();
+        K toKey = it.next();
+        K third = it.next();
+        V firstValue = sm.get(first);
+        V fromKeyValue = sm.get(fromKey);
+        V secondValue = sm.get(second);
+        V thirdValue = sm.get(third);
+
+        SortedMap<K, V> sub = sm.subMap(fromKey, toKey);
         assertEquals(2, sub.size());
         assertEquals(true, sm.containsKey(first));
         assertEquals(false, sub.containsKey(first));
@@ -462,50 +477,50 @@ public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiM
     //-----------------------------------------------------------------------
     public void testBidiClearBySubMap() {
         if (isRemoveSupported() == false) return;
-        
+
         // extra test as other tests get complex
-        SortedBidiMap sm = (SortedBidiMap) makeFullMap();
-        Iterator it = sm.keySet().iterator();
+        SortedBidiMap<K, V> sm = makeFullMap();
+        Iterator<K> it = sm.keySet().iterator();
         it.next();
-        Object fromKey = it.next();
-        Object first = it.next();
-        Object second = it.next();
-        Object toKey = it.next();
-        
-        Object fromKeyValue = sm.get(fromKey);
-        Object firstValue = sm.get(first);
-        Object secondValue = sm.get(second);
-        Object toKeyValue = sm.get(toKey);
-        
-        SortedMap sub = sm.subMap(fromKey, toKey);
+        K fromKey = it.next();
+        K first = it.next();
+        K second = it.next();
+        K toKey = it.next();
+
+        V fromKeyValue = sm.get(fromKey);
+        V firstValue = sm.get(first);
+        V secondValue = sm.get(second);
+        V toKeyValue = sm.get(toKey);
+
+        SortedMap<K, V> sub = sm.subMap(fromKey, toKey);
         int size = sm.size();
         assertEquals(3, sub.size());
         sub.clear();
         assertEquals(0, sub.size());
         assertEquals(size - 3, sm.size());
         assertEquals(size - 3, sm.inverseBidiMap().size());
-        
+
         assertEquals(false, sm.containsKey(fromKey));
         assertEquals(false, sm.containsValue(fromKeyValue));
         assertEquals(false, sm.inverseBidiMap().containsKey(fromKeyValue));
         assertEquals(false, sm.inverseBidiMap().containsValue(fromKey));
         assertEquals(false, sub.containsKey(fromKey));
         assertEquals(false, sub.containsValue(fromKeyValue));
-        
+
         assertEquals(false, sm.containsKey(first));
         assertEquals(false, sm.containsValue(firstValue));
         assertEquals(false, sm.inverseBidiMap().containsKey(firstValue));
         assertEquals(false, sm.inverseBidiMap().containsValue(first));
         assertEquals(false, sub.containsKey(first));
         assertEquals(false, sub.containsValue(firstValue));
-        
+
         assertEquals(false, sm.containsKey(second));
         assertEquals(false, sm.containsValue(secondValue));
         assertEquals(false, sm.inverseBidiMap().containsKey(secondValue));
         assertEquals(false, sm.inverseBidiMap().containsValue(second));
         assertEquals(false, sub.containsKey(second));
         assertEquals(false, sub.containsValue(secondValue));
-        
+
         assertEquals(true, sm.containsKey(toKey));
         assertEquals(true, sm.containsValue(toKeyValue));
         assertEquals(true, sm.inverseBidiMap().containsKey(toKeyValue));
@@ -517,25 +532,25 @@ public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiM
     //-----------------------------------------------------------------------
     public void testBidiRemoveBySubMap() {
         if (isRemoveSupported() == false) return;
-        
+
         // extra test as other tests get complex
-        SortedBidiMap sm = (SortedBidiMap) makeFullMap();
-        Iterator it = sm.keySet().iterator();
+        SortedBidiMap<K, V> sm = makeFullMap();
+        Iterator<K> it = sm.keySet().iterator();
         it.next();
         it.next();
-        Object fromKey = it.next();
-        Object first = it.next();
-        Object second = it.next();
-        Object toKey = it.next();
-        
+        K fromKey = it.next();
+        K first = it.next();
+        K second = it.next();
+        K toKey = it.next();
+
         int size = sm.size();
-        SortedMap sub = sm.subMap(fromKey, toKey);
+        SortedMap<K, V> sub = sm.subMap(fromKey, toKey);
         assertEquals(true, sm.containsKey(first));
         assertEquals(true, sub.containsKey(first));
         assertEquals(true, sm.containsKey(second));
         assertEquals(true, sub.containsKey(second));
-        
-        Object firstValue = sub.remove(first);
+
+        V firstValue = sub.remove(first);
         assertEquals(2, sub.size());
         assertEquals(size - 1, sm.size());
         assertEquals(size - 1, sm.inverseBidiMap().size());
@@ -545,8 +560,8 @@ public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiM
         assertEquals(false, sm.inverseBidiMap().containsValue(first));
         assertEquals(false, sub.containsKey(first));
         assertEquals(false, sub.containsValue(firstValue));
-        
-        Object secondValue = sub.remove(second);
+
+        V secondValue = sub.remove(second);
         assertEquals(1, sub.size());
         assertEquals(size - 2, sm.size());
         assertEquals(size - 2, sm.inverseBidiMap().size());
@@ -561,32 +576,32 @@ public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiM
     //-----------------------------------------------------------------------
     public void testBidiRemoveBySubMapEntrySet() {
         if (isRemoveSupported() == false) return;
-        
+
         // extra test as other tests get complex
-        SortedBidiMap sm = (SortedBidiMap) makeFullMap();
-        Iterator it = sm.keySet().iterator();
+        SortedBidiMap<K, V> sm = makeFullMap();
+        Iterator<K> it = sm.keySet().iterator();
         it.next();
         it.next();
-        Object fromKey = it.next();
-        Object first = it.next();
-        Object second = it.next();
-        Object toKey = it.next();
-        
+        K fromKey = it.next();
+        K first = it.next();
+        K second = it.next();
+        K toKey = it.next();
+
         int size = sm.size();
-        SortedMap sub = sm.subMap(fromKey, toKey);
-        Set set = sub.entrySet();
+        SortedMap<K, V> sub = sm.subMap(fromKey, toKey);
+        Set<Map.Entry<K, V>> set = sub.entrySet();
         assertEquals(3, set.size());
-        Iterator it2 = set.iterator();
-        Object fromEntry = it2.next();
-        Map.Entry firstEntry = cloneMapEntry((Map.Entry) it2.next());
-        Map.Entry secondEntry = cloneMapEntry((Map.Entry) it2.next());
+        Iterator<Map.Entry<K, V>> it2 = set.iterator();
+        it2.next();
+        Map.Entry<K, V> firstEntry = cloneMapEntry(it2.next());
+        Map.Entry<K, V> secondEntry = cloneMapEntry(it2.next());
         assertEquals(true, sm.containsKey(first));
         assertEquals(true, sub.containsKey(first));
         assertEquals(true, set.contains(firstEntry));
         assertEquals(true, sm.containsKey(second));
         assertEquals(true, sub.containsKey(second));
         assertEquals(true, set.contains(secondEntry));
-        
+
         set.remove(firstEntry);
         assertEquals(2, sub.size());
         assertEquals(size - 1, sm.size());
@@ -598,7 +613,7 @@ public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiM
         assertEquals(false, sub.containsKey(firstEntry.getKey()));
         assertEquals(false, sub.containsValue(firstEntry.getValue()));
         assertEquals(false, set.contains(firstEntry));
-        
+
         set.remove(secondEntry);
         assertEquals(1, sub.size());
         assertEquals(size - 2, sm.size());
@@ -612,17 +627,17 @@ public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiM
         assertEquals(false, set.contains(secondEntry));
     }
 
-    //-----------------------------------------------------------------------    
+    //-----------------------------------------------------------------------
     public BulkTest bulkTestHeadMap() {
-        return new AbstractTestSortedMap.TestHeadMap(this);
+        return new AbstractTestSortedMap.TestHeadMap<K, V>(this);
     }
 
     public BulkTest bulkTestTailMap() {
-        return new AbstractTestSortedMap.TestTailMap(this);
+        return new AbstractTestSortedMap.TestTailMap<K, V>(this);
     }
 
     public BulkTest bulkTestSubMap() {
-        return new AbstractTestSortedMap.TestSubMap(this);
+        return new AbstractTestSortedMap.TestSubMap<K, V>(this);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/bidimap/TestAbstractOrderedBidiMapDecorator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bidimap/TestAbstractOrderedBidiMapDecorator.java b/src/test/org/apache/commons/collections/bidimap/TestAbstractOrderedBidiMapDecorator.java
index b385bf8..3223033 100644
--- a/src/test/org/apache/commons/collections/bidimap/TestAbstractOrderedBidiMapDecorator.java
+++ b/src/test/org/apache/commons/collections/bidimap/TestAbstractOrderedBidiMapDecorator.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,21 @@
  */
 package org.apache.commons.collections.bidimap;
 
-import java.util.Map;
+import java.util.SortedMap;
 import java.util.TreeMap;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-import org.apache.commons.collections.BidiMap;
 import org.apache.commons.collections.OrderedBidiMap;
 
 /**
  * Test class for AbstractOrderedBidiMapDecorator.
- * 
+ *
  * @version $Revision$ $Date$
  */
-public class TestAbstractOrderedBidiMapDecorator
-        extends AbstractTestOrderedBidiMap {
+public class TestAbstractOrderedBidiMapDecorator<K, V>
+        extends AbstractTestOrderedBidiMap<K, V> {
 
     public TestAbstractOrderedBidiMapDecorator(String testName) {
         super(testName);
@@ -41,12 +40,16 @@ public class TestAbstractOrderedBidiMapDecorator
         return new TestSuite(TestAbstractOrderedBidiMapDecorator.class);
     }
 
-    public BidiMap makeEmptyBidiMap() {
-        return new TestOrderedBidiMap();
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public OrderedBidiMap<K, V> makeObject() {
+        return new TestOrderedBidiMap<K, V>();
     }
 
-    public Map makeConfirmedMap() {
-        return new TreeMap();
+    public SortedMap<K, V> makeConfirmedMap() {
+        return new TreeMap<K, V>();
     }
 
     public boolean isAllowNullKey() {
@@ -64,21 +67,21 @@ public class TestAbstractOrderedBidiMapDecorator
     /**
      * Simple class to actually test.
      */
-    private static final class TestOrderedBidiMap extends AbstractOrderedBidiMapDecorator {
-            
-        private TestOrderedBidiMap inverse = null;
+    private static final class TestOrderedBidiMap<K, V> extends AbstractOrderedBidiMapDecorator<K, V> {
+
+        private TestOrderedBidiMap<V, K> inverse = null;
 
         public TestOrderedBidiMap() {
-            super(new DualTreeBidiMap());
+            super(new DualTreeBidiMap<K, V>());
         }
-        
-        public TestOrderedBidiMap(OrderedBidiMap map) {
+
+        public TestOrderedBidiMap(OrderedBidiMap<K, V> map) {
             super(map);
         }
-        
-        public BidiMap inverseBidiMap() {
+
+        public OrderedBidiMap<V, K> inverseBidiMap() {
             if (inverse == null) {
-                inverse = new TestOrderedBidiMap((OrderedBidiMap) getBidiMap().inverseBidiMap());
+                inverse = new TestOrderedBidiMap<V, K>(decorated().inverseBidiMap());
                 inverse.inverse = this;
             }
             return inverse;

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/bidimap/TestDualHashBidiMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bidimap/TestDualHashBidiMap.java b/src/test/org/apache/commons/collections/bidimap/TestDualHashBidiMap.java
index 1118356..af5c363 100644
--- a/src/test/org/apache/commons/collections/bidimap/TestDualHashBidiMap.java
+++ b/src/test/org/apache/commons/collections/bidimap/TestDualHashBidiMap.java
@@ -19,7 +19,6 @@ package org.apache.commons.collections.bidimap;
 import junit.framework.Test;
 import junit.textui.TestRunner;
 
-import org.apache.commons.collections.BidiMap;
 import org.apache.commons.collections.BulkTest;
 
 /**
@@ -30,7 +29,7 @@ import org.apache.commons.collections.BulkTest;
  * @author Matthew Hawthorne
  * @author Stephen Colebourne
  */
-public class TestDualHashBidiMap extends AbstractTestBidiMap {
+public class TestDualHashBidiMap<K, V> extends AbstractTestBidiMap<K, V> {
 
     public static void main(String[] args) {
         TestRunner.run(suite());
@@ -44,15 +43,19 @@ public class TestDualHashBidiMap extends AbstractTestBidiMap {
         super(testName);
     }
 
-    public BidiMap makeEmptyBidiMap() {
-        return new DualHashBidiMap();
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public DualHashBidiMap<K, V> makeObject() {
+        return new DualHashBidiMap<K, V>();
     }
 
     /**
      * Override to prevent infinite recursion of tests.
      */
     public String[] ignoredTests() {
-        return new String[] {"TestDualHashBidiMap.bulkTestInverseMap.bulkTestInverseMap"};
+        return new String[] { "TestDualHashBidiMap.bulkTestInverseMap.bulkTestInverseMap" };
     }
     
 //    public void testCreate() throws Exception {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap.java b/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap.java
index a9c34f5..470d6c0 100644
--- a/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap.java
+++ b/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap.java
@@ -19,7 +19,6 @@ package org.apache.commons.collections.bidimap;
 import junit.framework.Test;
 import junit.textui.TestRunner;
 
-import org.apache.commons.collections.BidiMap;
 import org.apache.commons.collections.BulkTest;
 
 /**
@@ -30,7 +29,7 @@ import org.apache.commons.collections.BulkTest;
  * @author Matthew Hawthorne
  * @author Stephen Colebourne
  */
-public class TestDualTreeBidiMap extends AbstractTestSortedBidiMap {
+public class TestDualTreeBidiMap<K extends Comparable<K>, V extends Comparable<V>> extends AbstractTestSortedBidiMap<K, V> {
 
     public static void main(String[] args) {
         TestRunner.run(suite());
@@ -44,8 +43,12 @@ public class TestDualTreeBidiMap extends AbstractTestSortedBidiMap {
         super(testName);
     }
 
-    public BidiMap makeEmptyBidiMap() {
-        return new DualTreeBidiMap();
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public DualTreeBidiMap<K, V> makeObject() {
+        return new DualTreeBidiMap<K, V>();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java b/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java
index fba5af8..74c7389 100644
--- a/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java
+++ b/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java
@@ -25,13 +25,11 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 import java.util.TreeMap;
 
 import junit.framework.Test;
 import junit.textui.TestRunner;
 
-import org.apache.commons.collections.BidiMap;
 import org.apache.commons.collections.BulkTest;
 import org.apache.commons.collections.SortedBidiMap;
 import org.apache.commons.collections.comparators.ComparableComparator;
@@ -46,7 +44,7 @@ import org.apache.commons.collections.comparators.ReverseComparator;
  * @author Stephen Colebourne
  * @author Jonas Van Poucke
  */
-public class TestDualTreeBidiMap2 extends AbstractTestSortedBidiMap {
+public class TestDualTreeBidiMap2<K extends Comparable<K>, V extends Comparable<V>> extends AbstractTestSortedBidiMap<K, V> {
 
     public static void main(String[] args) {
         TestRunner.run(suite());
@@ -60,21 +58,24 @@ public class TestDualTreeBidiMap2 extends AbstractTestSortedBidiMap {
         super(testName);
     }
 
-    public BidiMap makeEmptyBidiMap() {
-        return new DualTreeBidiMap(new ReverseComparator(ComparableComparator.getInstance()));
+    public DualTreeBidiMap<K, V> makeObject() {
+        return new DualTreeBidiMap<K, V>(
+                new ReverseComparator<K>(ComparableComparator.<K> getInstance()),
+                new ReverseComparator<V>(ComparableComparator.<V> getInstance()));
     }
 
-    public Map makeConfirmedMap() {
-        return new TreeMap(new ReverseComparator(ComparableComparator.getInstance()));
+    public TreeMap<K, V> makeConfirmedMap() {
+        return new TreeMap<K, V>(new ReverseComparator<K>(ComparableComparator.<K>getInstance()));
     }
 
     public void testComparator() {
         resetEmpty();
-        SortedBidiMap bidi = (SortedBidiMap) map;
+        SortedBidiMap<K, V> bidi = (SortedBidiMap<K, V>) map;
         assertNotNull(bidi.comparator());
         assertTrue(bidi.comparator() instanceof ReverseComparator);
     }
 
+    @SuppressWarnings("unchecked")
     public void testSerializeDeserializeCheckComparator() throws Exception {
         SortedBidiMap obj = (SortedBidiMap) makeObject();
         if (obj instanceof Serializable && isTestSerialization()) {
@@ -95,18 +96,18 @@ public class TestDualTreeBidiMap2 extends AbstractTestSortedBidiMap {
     }
 
     public void testSortOrder() throws Exception {
-        SortedBidiMap sm = (SortedBidiMap) makeFullMap();
+        SortedBidiMap<K, V> sm = makeFullMap();
 
         // Sort by the comparator used in the makeEmptyBidiMap() method
-        List newSortedKeys = Arrays.asList(getSampleKeys());
-        Collections.sort(newSortedKeys, new ReverseComparator(ComparableComparator.getInstance()));
+        List<K> newSortedKeys = Arrays.asList(getSampleKeys());
+        Collections.sort(newSortedKeys, new ReverseComparator<K>(ComparableComparator.<K>getInstance()));
         newSortedKeys = Collections.unmodifiableList(newSortedKeys);
 
-        Iterator mapIter = sm.keySet().iterator();
-        Iterator expectedIter = newSortedKeys.iterator();
+        Iterator<K> mapIter = sm.keySet().iterator();
+        Iterator<K> expectedIter = newSortedKeys.iterator();
         while (expectedIter.hasNext()) {
-            Object expectedKey = expectedIter.next();
-            Object mapKey = mapIter.next();
+            K expectedKey = expectedIter.next();
+            K mapKey = mapIter.next();
             assertNotNull("key in sorted list may not be null", expectedKey);
             assertNotNull("key in map may not be null", mapKey);
             assertEquals("key from sorted list and map must be equal", expectedKey, mapKey);

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/bidimap/TestTreeBidiMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bidimap/TestTreeBidiMap.java b/src/test/org/apache/commons/collections/bidimap/TestTreeBidiMap.java
index 42028c6..66def22 100644
--- a/src/test/org/apache/commons/collections/bidimap/TestTreeBidiMap.java
+++ b/src/test/org/apache/commons/collections/bidimap/TestTreeBidiMap.java
@@ -16,7 +16,6 @@
  */
 package org.apache.commons.collections.bidimap;
 
-import java.util.Map;
 import java.util.TreeMap;
 
 import junit.framework.Test;
@@ -32,7 +31,7 @@ import org.apache.commons.collections.BulkTest;
  * 
  * @author Stephen Colebourne
  */
-public class TestTreeBidiMap extends AbstractTestOrderedBidiMap {
+public class TestTreeBidiMap<K extends Comparable<K>, V extends Comparable<V>> extends AbstractTestOrderedBidiMap<K, V> {
 
     public static void main(String[] args) {
         TestRunner.run(suite());
@@ -46,12 +45,12 @@ public class TestTreeBidiMap extends AbstractTestOrderedBidiMap {
         super(testName);
     }
 
-    public BidiMap makeEmptyBidiMap() {
-        return new TreeBidiMap();
+    public BidiMap<K, V> makeObject() {
+        return new TreeBidiMap<K, V>();
     }
     
-    public Map makeConfirmedMap() {
-        return new TreeMap();
+    public TreeMap<K, V> makeConfirmedMap() {
+        return new TreeMap<K, V>();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableBidiMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableBidiMap.java b/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableBidiMap.java
index e8da77c..8af3f17 100644
--- a/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableBidiMap.java
+++ b/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableBidiMap.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.
@@ -27,17 +27,17 @@ import org.apache.commons.collections.BulkTest;
 
 /**
  * JUnit tests.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestUnmodifiableBidiMap extends AbstractTestBidiMap {
+public class TestUnmodifiableBidiMap<K, V> extends AbstractTestBidiMap<K, V> {
 
     public static void main(String[] args) {
         TestRunner.run(suite());
     }
-    
+
     public static Test suite() {
         return BulkTest.makeSuite(TestUnmodifiableBidiMap.class);
     }
@@ -46,24 +46,18 @@ public class TestUnmodifiableBidiMap extends AbstractTestBidiMap {
         super(testName);
     }
 
-    public BidiMap makeEmptyBidiMap() {
-        return UnmodifiableBidiMap.decorate(new DualHashBidiMap());
-    }
-    public BidiMap makeFullBidiMap() {
-        BidiMap bidi = new DualHashBidiMap();
-        for (int i = 0; i < entries.length; i++) {
-            bidi.put(entries[i][0], entries[i][1]);
-        }
-        return UnmodifiableBidiMap.decorate(bidi);
+    public BidiMap<K, V> makeObject() {
+        return UnmodifiableBidiMap.decorate(new DualHashBidiMap<K, V>());
     }
-    public Map makeFullMap() {
-        BidiMap bidi = new DualHashBidiMap();
+
+    public BidiMap<K, V> makeFullMap() {
+        BidiMap<K, V> bidi = new DualHashBidiMap<K, V>();
         addSampleMappings(bidi);
         return UnmodifiableBidiMap.decorate(bidi);
     }
-    
-    public Map makeConfirmedMap() {
-        return new HashMap();
+
+    public Map<K, V> makeConfirmedMap() {
+        return new HashMap<K, V>();
     }
 
     /**
@@ -76,11 +70,13 @@ public class TestUnmodifiableBidiMap extends AbstractTestBidiMap {
     public boolean isPutAddSupported() {
         return false;
     }
+
     public boolean isPutChangeSupported() {
         return false;
     }
+
     public boolean isRemoveSupported() {
         return false;
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableOrderedBidiMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableOrderedBidiMap.java b/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableOrderedBidiMap.java
index 1a84417..6c732e7 100644
--- a/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableOrderedBidiMap.java
+++ b/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableOrderedBidiMap.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.
@@ -28,17 +28,17 @@ import org.apache.commons.collections.OrderedBidiMap;
 
 /**
  * JUnit tests.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestUnmodifiableOrderedBidiMap extends AbstractTestOrderedBidiMap {
+public class TestUnmodifiableOrderedBidiMap<K extends Comparable<K>, V extends Comparable<V>> extends AbstractTestOrderedBidiMap<K, V> {
 
     public static void main(String[] args) {
         TestRunner.run(suite());
     }
-    
+
     public static Test suite() {
         return BulkTest.makeSuite(TestUnmodifiableOrderedBidiMap.class);
     }
@@ -47,24 +47,18 @@ public class TestUnmodifiableOrderedBidiMap extends AbstractTestOrderedBidiMap {
         super(testName);
     }
 
-    public BidiMap makeEmptyBidiMap() {
-        return UnmodifiableOrderedBidiMap.decorate(new TreeBidiMap());
-    }
-    public BidiMap makeFullBidiMap() {
-        OrderedBidiMap bidi = new TreeBidiMap();
-        for (int i = 0; i < entries.length; i++) {
-            bidi.put(entries[i][0], entries[i][1]);
-        }
-        return UnmodifiableOrderedBidiMap.decorate(bidi);
+    public OrderedBidiMap<K, V> makeObject() {
+        return UnmodifiableOrderedBidiMap.decorate(new TreeBidiMap<K, V>());
     }
-    public Map makeFullMap() {
-        OrderedBidiMap bidi = new TreeBidiMap();
+
+    public BidiMap<K, V> makeFullMap() {
+        OrderedBidiMap<K, V> bidi = new TreeBidiMap<K, V>();
         addSampleMappings(bidi);
         return UnmodifiableOrderedBidiMap.decorate(bidi);
     }
-    
-    public Map makeConfirmedMap() {
-        return new TreeMap();
+
+    public Map<K, V> makeConfirmedMap() {
+        return new TreeMap<K, V>();
     }
 
     /**
@@ -73,21 +67,25 @@ public class TestUnmodifiableOrderedBidiMap extends AbstractTestOrderedBidiMap {
     public String[] ignoredTests() {
         return new String[] {"TestUnmodifiableOrderedBidiMap.bulkTestInverseMap.bulkTestInverseMap"};
     }
-    
+
     public boolean isAllowNullKey() {
         return false;
     }
+
     public boolean isAllowNullValue() {
         return false;
     }
+
     public boolean isPutAddSupported() {
         return false;
     }
+
     public boolean isPutChangeSupported() {
         return false;
     }
+
     public boolean isRemoveSupported() {
         return false;
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableSortedBidiMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableSortedBidiMap.java b/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableSortedBidiMap.java
index b4ae163..7b4597c 100644
--- a/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableSortedBidiMap.java
+++ b/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableSortedBidiMap.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,29 +16,28 @@
  */
 package org.apache.commons.collections.bidimap;
 
-import java.util.Map;
+import java.util.SortedMap;
 import java.util.TreeMap;
 
 import junit.framework.Test;
 import junit.textui.TestRunner;
 
-import org.apache.commons.collections.BidiMap;
 import org.apache.commons.collections.BulkTest;
 import org.apache.commons.collections.SortedBidiMap;
 
 /**
  * JUnit tests.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestUnmodifiableSortedBidiMap extends AbstractTestSortedBidiMap {
+public class TestUnmodifiableSortedBidiMap<K extends Comparable<K>, V extends Comparable<V>> extends AbstractTestSortedBidiMap<K, V> {
 
     public static void main(String[] args) {
         TestRunner.run(suite());
     }
-    
+
     public static Test suite() {
         return BulkTest.makeSuite(TestUnmodifiableSortedBidiMap.class);
     }
@@ -48,30 +47,25 @@ public class TestUnmodifiableSortedBidiMap extends AbstractTestSortedBidiMap {
     }
 
     //-----------------------------------------------------------------------
-    public BidiMap makeEmptyBidiMap() {
-        return UnmodifiableSortedBidiMap.decorate(new DualTreeBidiMap());
-    }
-    public BidiMap makeFullBidiMap() {
-        SortedBidiMap bidi = new DualTreeBidiMap();
-        for (int i = 0; i < entries.length; i++) {
-            bidi.put(entries[i][0], entries[i][1]);
-        }
-        return UnmodifiableSortedBidiMap.decorate(bidi);
+    public SortedBidiMap<K, V> makeObject() {
+        return UnmodifiableSortedBidiMap.decorate(new DualTreeBidiMap<K, V>());
     }
-    public Map makeFullMap() {
-        SortedBidiMap bidi = new DualTreeBidiMap();
+
+    public SortedBidiMap<K, V> makeFullMap() {
+        SortedBidiMap<K, V> bidi = new DualTreeBidiMap<K, V>();
         addSampleMappings(bidi);
         return UnmodifiableSortedBidiMap.decorate(bidi);
     }
-    
-    public Map makeConfirmedMap() {
-        return new TreeMap();
+
+    public SortedMap<K, V> makeConfirmedMap() {
+        return new TreeMap<K, V>();
     }
 
     public boolean isSubMapViewsSerializable() {
         // TreeMap sub map views have a bug in deserialization.
         return false;
     }
+
     public String[] ignoredTests() {
         // Override to prevent infinite recursion of tests.
         return new String[] {"TestUnmodifiableSortedBidiMap.bulkTestInverseMap.bulkTestInverseMap"};
@@ -81,17 +75,21 @@ public class TestUnmodifiableSortedBidiMap extends AbstractTestSortedBidiMap {
     public boolean isAllowNullKey() {
         return false;
     }
+
     public boolean isAllowNullValue() {
         return false;
     }
+
     public boolean isPutAddSupported() {
         return false;
     }
+
     public boolean isPutChangeSupported() {
         return false;
     }
+
     public boolean isRemoveSupported() {
         return false;
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/buffer/TestBlockingBuffer.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/buffer/TestBlockingBuffer.java b/src/test/org/apache/commons/collections/buffer/TestBlockingBuffer.java
index e5ea282..2860de5 100644
--- a/src/test/org/apache/commons/collections/buffer/TestBlockingBuffer.java
+++ b/src/test/org/apache/commons/collections/buffer/TestBlockingBuffer.java
@@ -29,30 +29,31 @@ import java.util.LinkedList;
 import java.util.Set;
 
 /**
- * Extension of {@link AbstractTestObject} for exercising the {@link BlockingBuffer} implementation.
- *
+ * Extension of {@link AbstractTestObject} for exercising the
+ * {@link BlockingBuffer} implementation.
+ * 
  * @author Janek Bogucki
  * @author Phil Steitz
  * @version $Revision$
  * @since Commons Collections 3.0
  */
-public class TestBlockingBuffer extends AbstractTestObject {
+public class TestBlockingBuffer<E> extends AbstractTestObject {
 
-    public TestBlockingBuffer( String testName ) {
-        super( testName );
+    public TestBlockingBuffer(String testName) {
+        super(testName);
     }
 
     public static Test suite() {
-        return new TestSuite( TestBlockingBuffer.class );
+        return new TestSuite(TestBlockingBuffer.class);
     }
 
-    public static void main( String args[] ) {
-        String[] testCaseName = {TestBlockingBuffer.class.getName()};
-        junit.textui.TestRunner.main( testCaseName );
+    public static void main(String args[]) {
+        String[] testCaseName = { TestBlockingBuffer.class.getName() };
+        junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Object makeObject() {
-        return BlockingBuffer.decorate( new MyBuffer() );
+    public Buffer<E> makeObject() {
+        return BlockingBuffer.decorate(new MyBuffer<E>());
     }
 
     public boolean isEqualsCheckable() {
@@ -61,113 +62,122 @@ public class TestBlockingBuffer extends AbstractTestObject {
 
     //-----------------------------------------------------------------------
 
+    @SuppressWarnings("unchecked")
+    protected E makeElement() {
+        return (E) new Object();
+    }
+    
     /**
-     * Tests {@link BlockingBuffer#get()} in combination with {@link BlockingBuffer#add(Object)}.
+     * Tests {@link BlockingBuffer#get()} in combination with
+     * {@link BlockingBuffer#add(Object)}.
      */
     public void testGetWithAdd() {
-        Buffer blockingBuffer = BlockingBuffer.decorate( new MyBuffer() );
-        Object obj = new Object();
-        new DelayedAdd( blockingBuffer, obj ).start();
+        Buffer<E> blockingBuffer = makeObject();
+        E obj = makeElement();
+        new DelayedAdd<E>(blockingBuffer, obj).start();
 
         // verify does not throw BufferUnderflowException; should block until other thread has added to the buffer .
-        assertSame( obj, blockingBuffer.get() );
+        assertSame(obj, blockingBuffer.get());
     }
 
     public void testGetWithAddTimeout() {
-        Buffer blockingBuffer = BlockingBuffer.decorate( new MyBuffer(), 500 );
-        Object obj = new Object();
-        new DelayedAdd( blockingBuffer, obj, 100 ).start();
+        Buffer<E> blockingBuffer = BlockingBuffer.decorate(new MyBuffer<E>(), 500);
+        E obj = makeElement();
+        new DelayedAdd<E>(blockingBuffer, obj, 100).start();
 
         // verify does not throw BufferUnderflowException; should block until other thread has added to the buffer .
-        assertSame( obj, blockingBuffer.get() );
+        assertSame(obj, blockingBuffer.get());
     }
 
     //-----------------------------------------------------------------------
 
     /**
-     * Tests {@link BlockingBuffer#get()} in combination with {@link BlockingBuffer#addAll(java.util.Collection)}.
+     * Tests {@link BlockingBuffer#get()} in combination with
+     * {@link BlockingBuffer#addAll(java.util.Collection)}.
      */
     public void testGetWithAddAll() {
-        Buffer blockingBuffer = BlockingBuffer.decorate( new MyBuffer() );
-        Object obj = new Object();
-        new DelayedAddAll( blockingBuffer, obj ).start();
+        Buffer<E> blockingBuffer = makeObject();
+        E obj = makeElement();
+        new DelayedAddAll<E>(blockingBuffer, obj).start();
 
         // verify does not throw BufferUnderflowException; should block until other thread has added to the buffer .
-        assertSame( obj, blockingBuffer.get() );
+        assertSame(obj, blockingBuffer.get());
     }
 
     public void testGetWithAddAllTimeout() {
-        Buffer blockingBuffer = BlockingBuffer.decorate( new MyBuffer(), 500 );
-        Object obj = new Object();
-        new DelayedAddAll( blockingBuffer, obj, 100 ).start();
+        Buffer<E> blockingBuffer = BlockingBuffer.decorate(new MyBuffer<E>(), 500);
+        E obj = makeElement();
+        new DelayedAddAll<E>(blockingBuffer, obj, 100).start();
 
         // verify does not throw BufferUnderflowException; should block until other thread has added to the buffer .
-        assertSame( obj, blockingBuffer.get() );
+        assertSame(obj, blockingBuffer.get());
     }
 
     //-----------------------------------------------------------------------
 
     /**
-     * Tests {@link BlockingBuffer#remove()} in combination with {@link BlockingBuffer#add(Object)}.
+     * Tests {@link BlockingBuffer#remove()} in combination with
+     * {@link BlockingBuffer#add(Object)}.
      */
     public void testRemoveWithAdd() {
-        Buffer blockingBuffer = BlockingBuffer.decorate( new MyBuffer() );
-        Object obj = new Object();
-        new DelayedAdd( blockingBuffer, obj ).start();
+        Buffer<E> blockingBuffer = makeObject();
+        E obj = makeElement();
+        new DelayedAdd<E>(blockingBuffer, obj).start();
 
         // verify does not throw BufferUnderflowException; should block until other thread has added to the buffer .
-        assertSame( obj, blockingBuffer.remove() );
+        assertSame(obj, blockingBuffer.remove());
     }
 
     public void testRemoveWithAddTimeout() {
-        Buffer blockingBuffer = BlockingBuffer.decorate( new MyBuffer(), 100 );
-        Object obj = new Object();
-        new DelayedAdd( blockingBuffer, obj, 500 ).start();
+        Buffer<E> blockingBuffer = BlockingBuffer.decorate(new MyBuffer<E>(), 100);
+        E obj = makeElement();
+        new DelayedAdd<E>(blockingBuffer, obj, 500).start();
         try {
             blockingBuffer.remove();
-        }
-        catch( BufferUnderflowException e ) {
+        } catch (BufferUnderflowException e) {
         }
     }
+
     //-----------------------------------------------------------------------
 
     /**
-     * Tests {@link BlockingBuffer#remove()} in combination with {@link BlockingBuffer#addAll(java.util.Collection)}.
+     * Tests {@link BlockingBuffer#remove()} in combination with
+     * {@link BlockingBuffer#addAll(java.util.Collection)}.
      */
     public void testRemoveWithAddAll() {
-        Buffer blockingBuffer = BlockingBuffer.decorate( new MyBuffer() );
-        Object obj = new Object();
-        new DelayedAddAll( blockingBuffer, obj ).start();
+        Buffer<E> blockingBuffer = makeObject();
+        E obj = makeElement();
+        new DelayedAddAll<E>(blockingBuffer, obj).start();
 
         // verify does not throw BufferUnderflowException; should block until other thread has added to the buffer .
-        assertSame( obj, blockingBuffer.remove() );
+        assertSame(obj, blockingBuffer.remove());
     }
 
     public void testRemoveWithAddAllTimeout() {
-        Buffer blockingBuffer = BlockingBuffer.decorate( new MyBuffer(), 100 );
-        Object obj = new Object();
-        new DelayedAddAll( blockingBuffer, obj, 500 ).start();
+        Buffer<E> blockingBuffer = BlockingBuffer.decorate(new MyBuffer<E>(), 100);
+        E obj = makeElement();
+        new DelayedAddAll<E>(blockingBuffer, obj, 500).start();
         try {
             blockingBuffer.remove();
-        }
-        catch( BufferUnderflowException e ) {
+        } catch (BufferUnderflowException e) {
         }
     }
+
     //-----------------------------------------------------------------------
 
     /**
-     * Tests {@link BlockingBuffer#get()} in combination with {@link BlockingBuffer#add(Object)} using multiple read
-     * threads.
-     * <p/>
-     * Two read threads should block on an empty buffer until one object is added then both threads should complete.
+     * Tests {@link BlockingBuffer#get()} in combination with
+     * {@link BlockingBuffer#add(Object)} using multiple read threads. <p/> Two
+     * read threads should block on an empty buffer until one object is added
+     * then both threads should complete.
      */
     public void testBlockedGetWithAdd() {
-        Buffer blockingBuffer = BlockingBuffer.decorate( new MyBuffer() );
-        Object obj = new Object();
+        Buffer<E> blockingBuffer = makeObject();
+        E obj = makeElement();
 
         // run methods will get and compare -- must wait for add
-        Thread thread1 = new ReadThread( blockingBuffer, obj );
-        Thread thread2 = new ReadThread( blockingBuffer, obj );
+        Thread thread1 = new ReadThread<E>(blockingBuffer, obj);
+        Thread thread2 = new ReadThread<E>(blockingBuffer, obj);
         thread1.start();
         thread2.start();
 
@@ -175,32 +185,32 @@ public class TestBlockingBuffer extends AbstractTestObject {
         delay();
 
         // notifyAll should allow both read threads to complete
-        blockingBuffer.add( obj );
+        blockingBuffer.add(obj);
 
         // allow notified threads to complete 
         delay();
 
         // There should not be any threads waiting.
-        if( thread1.isAlive() || thread2.isAlive() ) {
-            fail( "Live thread(s) when both should be dead." );
+        if (thread1.isAlive() || thread2.isAlive()) {
+            fail("Live thread(s) when both should be dead.");
         }
     }
 
     //-----------------------------------------------------------------------
 
     /**
-     * Tests {@link BlockingBuffer#get()} in combination with {@link BlockingBuffer#addAll(java.util.Collection)} using
-     * multiple read threads.
-     * <p/>
-     * Two read threads should block on an empty buffer until a singleton is added then both threads should complete.
+     * Tests {@link BlockingBuffer#get()} in combination with
+     * {@link BlockingBuffer#addAll(java.util.Collection)} using multiple read
+     * threads. <p/> Two read threads should block on an empty buffer until a
+     * singleton is added then both threads should complete.
      */
     public void testBlockedGetWithAddAll() {
-        Buffer blockingBuffer = BlockingBuffer.decorate( new MyBuffer() );
-        Object obj = new Object();
+        Buffer<E> blockingBuffer = makeObject();
+        E obj = makeElement();
 
         // run methods will get and compare -- must wait for addAll
-        Thread thread1 = new ReadThread( blockingBuffer, obj );
-        Thread thread2 = new ReadThread( blockingBuffer, obj );
+        Thread thread1 = new ReadThread<E>(blockingBuffer, obj);
+        Thread thread2 = new ReadThread<E>(blockingBuffer, obj);
         thread1.start();
         thread2.start();
 
@@ -208,14 +218,14 @@ public class TestBlockingBuffer extends AbstractTestObject {
         delay();
 
         // notifyAll should allow both read threads to complete
-        blockingBuffer.addAll( Collections.singleton( obj ) );
+        blockingBuffer.addAll(Collections.singleton(obj));
 
         // allow notified threads to complete 
         delay();
 
         // There should not be any threads waiting.
-        if( thread1.isAlive() || thread2.isAlive() ) {
-            fail( "Live thread(s) when both should be dead." );
+        if (thread1.isAlive() || thread2.isAlive()) {
+            fail("Live thread(s) when both should be dead.");
         }
     }
 
@@ -225,12 +235,12 @@ public class TestBlockingBuffer extends AbstractTestObject {
      * Tests interrupted {@link BlockingBuffer#get()}.
      */
     public void testInterruptedGet() {
-        Buffer blockingBuffer = BlockingBuffer.decorate( new MyBuffer() );
-        Object obj = new Object();
+        Buffer<E> blockingBuffer = makeObject();
+        E obj = makeElement();
 
         // spawn a read thread to wait on the empty buffer
-        ArrayList exceptionList = new ArrayList();
-        Thread thread = new ReadThread( blockingBuffer, obj, exceptionList );
+        ArrayList<String> exceptionList = new ArrayList<String>();
+        Thread thread = new ReadThread<E>(blockingBuffer, obj, exceptionList);
         thread.start();
 
         // Interrupting the thread should cause it to throw BufferUnderflowException
@@ -238,10 +248,10 @@ public class TestBlockingBuffer extends AbstractTestObject {
 
         // Chill, so thread can throw and add message to exceptionList
         delay();
-        assertTrue( "Thread interrupt should have led to underflow",
-                    exceptionList.contains( "BufferUnderFlow" ) );
-        if( thread.isAlive() ) {
-            fail( "Read thread has hung." );
+        assertTrue("Thread interrupt should have led to underflow", exceptionList
+                .contains("BufferUnderFlow"));
+        if (thread.isAlive()) {
+            fail("Read thread has hung.");
         }
 
     }
@@ -249,115 +259,116 @@ public class TestBlockingBuffer extends AbstractTestObject {
     //-----------------------------------------------------------------------
 
     /**
-     * Tests {@link BlockingBuffer#remove()} in combination with {@link BlockingBuffer#add(Object)} using multiple read
-     * threads.
-     * <p/>
-     * Two read threads should block on an empty buffer until one object is added then one thread should complete. The
-     * remaining thread should complete after the addition of a second object.
+     * Tests {@link BlockingBuffer#remove()} in combination with
+     * {@link BlockingBuffer#add(Object)} using multiple read threads. <p/> Two
+     * read threads should block on an empty buffer until one object is added
+     * then one thread should complete. The remaining thread should complete
+     * after the addition of a second object.
      */
     public void testBlockedRemoveWithAdd() {
-        Buffer blockingBuffer = BlockingBuffer.decorate( new MyBuffer() );
-        Object obj = new Object();
+        Buffer<E> blockingBuffer = makeObject();
+        E obj = makeElement();
 
         // run methods will remove and compare -- must wait for add
-        Thread thread1 = new ReadThread( blockingBuffer, obj, null, "remove" );
-        Thread thread2 = new ReadThread( blockingBuffer, obj, null, "remove" );
+        Thread thread1 = new ReadThread<E>(blockingBuffer, obj, null, "remove");
+        Thread thread2 = new ReadThread<E>(blockingBuffer, obj, null, "remove");
         thread1.start();
         thread2.start();
 
         // give hungry read threads ample time to hang
         delay();
-        blockingBuffer.add( obj );
+        blockingBuffer.add(obj);
 
         // allow notified threads to complete 
         delay();
 
         // There should be one thread waiting.
-        assertTrue( "There is one thread waiting", thread1.isAlive() ^ thread2.isAlive() );
-        blockingBuffer.add( obj );
+        assertTrue("There is one thread waiting", thread1.isAlive() ^ thread2.isAlive());
+        blockingBuffer.add(obj);
 
         // allow notified thread to complete 
         delay();
 
         // There should not be any threads waiting.
-        if( thread1.isAlive() || thread2.isAlive() ) {
-            fail( "Live thread(s) when both should be dead." );
+        if (thread1.isAlive() || thread2.isAlive()) {
+            fail("Live thread(s) when both should be dead.");
         }
     }
 
     //-----------------------------------------------------------------------
 
     /**
-     * Tests {@link BlockingBuffer#remove()} in combination with {@link BlockingBuffer#addAll(java.util.Collection)}
-     * using multiple read threads.
-     * <p/>
-     * Two read threads should block on an empty buffer until a singleton collection is added then one thread should
-     * complete. The remaining thread should complete after the addition of a second singleton.
+     * Tests {@link BlockingBuffer#remove()} in combination with
+     * {@link BlockingBuffer#addAll(java.util.Collection)} using multiple read
+     * threads. <p/> Two read threads should block on an empty buffer until a
+     * singleton collection is added then one thread should complete. The
+     * remaining thread should complete after the addition of a second
+     * singleton.
      */
     public void testBlockedRemoveWithAddAll1() {
-        Buffer blockingBuffer = BlockingBuffer.decorate( new MyBuffer() );
-        Object obj = new Object();
+        Buffer<E> blockingBuffer = makeObject();
+        E obj = makeElement();
 
         // run methods will remove and compare -- must wait for addAll
-        Thread thread1 = new ReadThread( blockingBuffer, obj, null, "remove" );
-        Thread thread2 = new ReadThread( blockingBuffer, obj, null, "remove" );
+        Thread thread1 = new ReadThread<E>(blockingBuffer, obj, null, "remove");
+        Thread thread2 = new ReadThread<E>(blockingBuffer, obj, null, "remove");
         thread1.start();
         thread2.start();
 
         // give hungry read threads ample time to hang
         delay();
-        blockingBuffer.addAll( Collections.singleton( obj ) );
+        blockingBuffer.addAll(Collections.singleton(obj));
 
         // allow notified threads to complete 
         delay();
 
         // There should be one thread waiting.
-        assertTrue( "There is one thread waiting", thread1.isAlive() ^ thread2.isAlive() );
-        blockingBuffer.addAll( Collections.singleton( obj ) );
+        assertTrue("There is one thread waiting", thread1.isAlive() ^ thread2.isAlive());
+        blockingBuffer.addAll(Collections.singleton(obj));
 
         // allow notified thread to complete 
         delay();
 
         // There should not be any threads waiting.
-        if( thread1.isAlive() || thread2.isAlive() ) {
-            fail( "Live thread(s) when both should be dead." );
+        if (thread1.isAlive() || thread2.isAlive()) {
+            fail("Live thread(s) when both should be dead.");
         }
     }
 
     //-----------------------------------------------------------------------
 
     /**
-     * Tests {@link BlockingBuffer#remove()} in combination with {@link BlockingBuffer#addAll(java.util.Collection)}
-     * using multiple read threads.
-     * <p/>
-     * Two read threads should block on an empty buffer until a collection with two distinct objects is added then both
-     * threads should complete. Each thread should have read a different object.
+     * Tests {@link BlockingBuffer#remove()} in combination with
+     * {@link BlockingBuffer#addAll(java.util.Collection)} using multiple read
+     * threads. <p/> Two read threads should block on an empty buffer until a
+     * collection with two distinct objects is added then both threads should
+     * complete. Each thread should have read a different object.
      */
     public void testBlockedRemoveWithAddAll2() {
-        Buffer blockingBuffer = BlockingBuffer.decorate( new MyBuffer() );
-        Object obj1 = new Object();
-        Object obj2 = new Object();
-        Set objs = Collections.synchronizedSet( new HashSet() );
-        objs.add( obj1 );
-        objs.add( obj2 );
+        Buffer<E> blockingBuffer = makeObject();
+        E obj1 = makeElement();
+        E obj2 = makeElement();
+        Set<E> objs = Collections.synchronizedSet(new HashSet<E>());
+        objs.add(obj1);
+        objs.add(obj2);
 
         // run methods will remove and compare -- must wait for addAll
-        Thread thread1 = new ReadThread( blockingBuffer, objs, "remove" );
-        Thread thread2 = new ReadThread( blockingBuffer, objs, "remove" );
+        Thread thread1 = new ReadThread<E>(blockingBuffer, objs, "remove");
+        Thread thread2 = new ReadThread<E>(blockingBuffer, objs, "remove");
         thread1.start();
         thread2.start();
 
         // give hungry read threads ample time to hang
         delay();
-        blockingBuffer.addAll( objs );
+        blockingBuffer.addAll(objs);
 
         // allow notified threads to complete 
         delay();
-        assertEquals( "Both objects were removed", 0, objs.size() );
+        assertEquals("Both objects were removed", 0, objs.size());
 
         // There should not be any threads waiting.
-        if( thread1.isAlive() || thread2.isAlive() ) {
-            fail( "Live thread(s) when both should be dead." );
+        if (thread1.isAlive() || thread2.isAlive()) {
+            fail("Live thread(s) when both should be dead.");
         }
     }
 
@@ -367,12 +378,12 @@ public class TestBlockingBuffer extends AbstractTestObject {
      * Tests interrupted remove.
      */
     public void testInterruptedRemove() {
-        Buffer blockingBuffer = BlockingBuffer.decorate( new MyBuffer() );
-        Object obj = new Object();
+        Buffer<E> blockingBuffer = makeObject();
+        E obj = makeElement();
 
         // spawn a read thread to wait on the empty buffer
-        ArrayList exceptionList = new ArrayList();
-        Thread thread = new ReadThread( blockingBuffer, obj, exceptionList, "remove" );
+        ArrayList<String> exceptionList = new ArrayList<String>();
+        Thread thread = new ReadThread<E>(blockingBuffer, obj, exceptionList, "remove");
         thread.start();
 
         // Interrupting the thread should cause it to throw BufferUnderflowException
@@ -380,49 +391,47 @@ public class TestBlockingBuffer extends AbstractTestObject {
 
         // Chill, so thread can throw and add message to exceptionList
         delay();
-        assertTrue( "Thread interrupt should have led to underflow",
-                    exceptionList.contains( "BufferUnderFlow" ) );
-        if( thread.isAlive() ) {
-            fail( "Read thread has hung." );
+        assertTrue("Thread interrupt should have led to underflow", exceptionList
+                .contains("BufferUnderFlow"));
+        if (thread.isAlive()) {
+            fail("Read thread has hung.");
         }
 
     }
 
     public void testTimeoutGet() {
-        final BlockingBuffer buffer = new BlockingBuffer( new MyBuffer() );
+        final BlockingBuffer<E> buffer = new BlockingBuffer<E>(new MyBuffer<E>());
         try {
-            buffer.get( 100 );
-            fail( "Get should have timed out." );
-        }
-        catch( BufferUnderflowException e ) {
+            buffer.get(100);
+            fail("Get should have timed out.");
+        } catch (BufferUnderflowException e) {
         }
     }
 
     public void testTimeoutRemove() {
-        final BlockingBuffer buffer = new BlockingBuffer( new MyBuffer() );
+        final BlockingBuffer<E> buffer = new BlockingBuffer<E>(new MyBuffer<E>());
         try {
-            buffer.remove( 100 );
-            fail( "Get should have timed out." );
-        }
-        catch( BufferUnderflowException e ) {
+            buffer.remove(100);
+            fail("Get should have timed out.");
+        } catch (BufferUnderflowException e) {
         }
     }
 
-    protected static class DelayedAdd extends Thread {
+    protected static class DelayedAdd<E> extends Thread {
 
-        Buffer buffer;
+        Buffer<E> buffer;
 
-        Object obj;
+        E obj;
 
         long delay = 1000;
 
-        public DelayedAdd( Buffer buffer, Object obj, long delay ) {
+        public DelayedAdd(Buffer<E> buffer, E obj, long delay) {
             this.buffer = buffer;
             this.obj = obj;
             this.delay = delay;
         }
 
-        DelayedAdd( Buffer buffer, Object obj ) {
+        DelayedAdd(Buffer<E> buffer, E obj) {
             super();
             this.buffer = buffer;
             this.obj = obj;
@@ -431,29 +440,28 @@ public class TestBlockingBuffer extends AbstractTestObject {
         public void run() {
             try {
                 // wait for other thread to block on get() or remove()
-                Thread.sleep( delay );
-            }
-            catch( InterruptedException e ) {
+                Thread.sleep(delay);
+            } catch (InterruptedException e) {
             }
-            buffer.add( obj );
+            buffer.add(obj);
         }
     }
 
-    protected static class DelayedAddAll extends Thread {
+    protected static class DelayedAddAll<E> extends Thread {
 
-        Buffer buffer;
+        Buffer<E> buffer;
 
-        Object obj;
+        E obj;
 
         long delay = 100;
 
-        public DelayedAddAll( Buffer buffer, Object obj, long delay ) {
+        public DelayedAddAll(Buffer<E> buffer, E obj, long delay) {
             this.buffer = buffer;
             this.obj = obj;
             this.delay = delay;
         }
 
-        DelayedAddAll( Buffer buffer, Object obj ) {
+        DelayedAddAll(Buffer<E> buffer, E obj) {
             super();
             this.buffer = buffer;
             this.obj = obj;
@@ -462,40 +470,39 @@ public class TestBlockingBuffer extends AbstractTestObject {
         public void run() {
             try {
                 // wait for other thread to block on get() or remove()
-                Thread.sleep( delay );
-            }
-            catch( InterruptedException e ) {
+                Thread.sleep(delay);
+            } catch (InterruptedException e) {
             }
-            buffer.addAll( Collections.singleton( obj ) );
+            buffer.addAll(Collections.singleton(obj));
         }
     }
 
-    protected static class ReadThread extends Thread {
+    protected static class ReadThread<E> extends Thread {
 
-        Buffer buffer;
+        Buffer<E> buffer;
 
         Object obj;
 
-        ArrayList exceptionList = null;
+        ArrayList<String> exceptionList = null;
 
         String action = "get";
 
-        Set objs;
+        Set<E> objs;
 
-        ReadThread( Buffer buffer, Object obj ) {
+        ReadThread(Buffer<E> buffer, Object obj) {
             super();
             this.buffer = buffer;
             this.obj = obj;
         }
 
-        ReadThread( Buffer buffer, Object obj, ArrayList exceptionList ) {
+        ReadThread(Buffer<E> buffer, Object obj, ArrayList<String> exceptionList) {
             super();
             this.buffer = buffer;
             this.obj = obj;
             this.exceptionList = exceptionList;
         }
 
-        ReadThread( Buffer buffer, Object obj, ArrayList exceptionList, String action ) {
+        ReadThread(Buffer<E> buffer, Object obj, ArrayList<String> exceptionList, String action) {
             super();
             this.buffer = buffer;
             this.obj = obj;
@@ -503,7 +510,7 @@ public class TestBlockingBuffer extends AbstractTestObject {
             this.action = action;
         }
 
-        ReadThread( Buffer buffer, Set objs, String action ) {
+        ReadThread(Buffer<E> buffer, Set<E> objs, String action) {
             super();
             this.buffer = buffer;
             this.objs = objs;
@@ -512,46 +519,43 @@ public class TestBlockingBuffer extends AbstractTestObject {
 
         public void run() {
             try {
-                if( action == "get" ) {
-                    assertSame( obj, buffer.get() );
-                }
-                else {
-                    if( null != obj ) {
-                        assertSame( obj, buffer.remove() );
-                    }
-                    else {
-                        assertTrue( objs.remove( buffer.remove() ) );
+                if (action == "get") {
+                    assertSame(obj, buffer.get());
+                } else {
+                    if (null != obj) {
+                        assertSame(obj, buffer.remove());
+                    } else {
+                        assertTrue(objs.remove(buffer.remove()));
                     }
                 }
-            }
-            catch( BufferUnderflowException ex ) {
-                exceptionList.add( "BufferUnderFlow" );
+            } catch (BufferUnderflowException ex) {
+                exceptionList.add("BufferUnderFlow");
             }
         }
     }
 
-    protected static class MyBuffer extends LinkedList implements Buffer {
+    @SuppressWarnings("serial")
+    protected static class MyBuffer<E> extends LinkedList<E> implements Buffer<E> {
 
-        public Object get() {
-            if( isEmpty() ) {
+        public E get() {
+            if (isEmpty()) {
                 throw new BufferUnderflowException();
             }
-            return get( 0 );
+            return get(0);
         }
 
-        public Object remove() {
-            if( isEmpty() ) {
+        public E remove() {
+            if (isEmpty()) {
                 throw new BufferUnderflowException();
             }
-            return remove( 0 );
+            return remove(0);
         }
     }
 
     private void delay() {
         try {
-            Thread.sleep( 100 );
-        }
-        catch( InterruptedException e ) {
+            Thread.sleep(100);
+        } catch (InterruptedException e) {
         }
     }
 
@@ -559,15 +563,15 @@ public class TestBlockingBuffer extends AbstractTestObject {
         return "3.1";
     }
 
-//    public void testCreate() throws Exception {
-//        Buffer buffer = BlockingBuffer.decorate(new UnboundedFifoBuffer());
-//        writeExternalFormToDisk((java.io.Serializable) buffer,
-//        "D:/dev/collections/data/test/BlockingBuffer.emptyCollection.version3.1.obj");
-//        buffer = BlockingBuffer.decorate(new UnboundedFifoBuffer());
-//        buffer.add("A");
-//        buffer.add("B");
-//        buffer.add("C");
-//        writeExternalFormToDisk((java.io.Serializable) buffer,
-//        "D:/dev/collections/data/test/BlockingBuffer.fullCollection.version3.1.obj");
-//    }
+    //    public void testCreate() throws Exception {
+    //        Buffer buffer = BlockingBuffer.decorate(new UnboundedFifoBuffer());
+    //        writeExternalFormToDisk((java.io.Serializable) buffer,
+    //        "D:/dev/collections/data/test/BlockingBuffer.emptyCollection.version3.1.obj");
+    //        buffer = BlockingBuffer.decorate(new UnboundedFifoBuffer());
+    //        buffer.add("A");
+    //        buffer.add("B");
+    //        buffer.add("C");
+    //        writeExternalFormToDisk((java.io.Serializable) buffer,
+    //        "D:/dev/collections/data/test/BlockingBuffer.fullCollection.version3.1.obj");
+    //    }
 }


[75/77] [abbrv] commons-collections git commit: Updating NOTICE to match trunk

Posted by ch...@apache.org.
Updating NOTICE to match trunk

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@814212 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/50053b64
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/50053b64
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/50053b64

Branch: refs/heads/collections_jdk5_branch
Commit: 50053b6474029d0759dd91de75834c5b7cd50012
Parents: c10ea5b
Author: Henri Yandell <ba...@apache.org>
Authored: Sat Sep 12 17:44:46 2009 +0000
Committer: Henri Yandell <ba...@apache.org>
Committed: Sat Sep 12 17:44:46 2009 +0000

----------------------------------------------------------------------
 NOTICE.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/50053b64/NOTICE.txt
----------------------------------------------------------------------
diff --git a/NOTICE.txt b/NOTICE.txt
index d6d6bc9..04eebf5 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -1,4 +1,4 @@
-Apache Jakarta Commons Collections
+Apache Commons Collections
 Copyright 2001-2009 The Apache Software Foundation
 
 This product includes software developed by


[40/77] [abbrv] commons-collections git commit: remove unnecessarily overridden method

Posted by ch...@apache.org.
remove unnecessarily overridden method

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@740155 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/dadc033a
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/dadc033a
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/dadc033a

Branch: refs/heads/collections_jdk5_branch
Commit: dadc033aa4f54261d755ae011fc1bfc477d8013f
Parents: 800616b
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Mon Feb 2 23:42:27 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Mon Feb 2 23:42:27 2009 +0000

----------------------------------------------------------------------
 .../apache/commons/collections/map/AbstractMapDecorator.java | 8 --------
 1 file changed, 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/dadc033a/src/java/org/apache/commons/collections/map/AbstractMapDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/AbstractMapDecorator.java b/src/java/org/apache/commons/collections/map/AbstractMapDecorator.java
index 821dc95..9394775 100644
--- a/src/java/org/apache/commons/collections/map/AbstractMapDecorator.java
+++ b/src/java/org/apache/commons/collections/map/AbstractMapDecorator.java
@@ -20,8 +20,6 @@ import java.util.Collection;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.commons.collections.MapIterator;
-
 /**
  * Provides a base decorator that enables additional functionality to be added
  * to a Map via decoration.
@@ -142,10 +140,4 @@ public abstract class AbstractMapDecorator<K, V> extends AbstractIterableMap<K,
         return decorated().toString();
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    public MapIterator<K, V> mapIterator() {
-        return new EntrySetToMapIteratorAdapter<K, V>(entrySet());
-    }
 }


[49/77] [abbrv] commons-collections git commit: javadoc + extension point

Posted by ch...@apache.org.
javadoc + extension point

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@751865 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/783aa51f
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/783aa51f
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/783aa51f

Branch: refs/heads/collections_jdk5_branch
Commit: 783aa51f14cf9dd79826401f0e627ad2a47331da
Parents: 4306110
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Mon Mar 9 22:06:27 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Mon Mar 9 22:06:27 2009 +0000

----------------------------------------------------------------------
 .../map/EntrySetToMapIteratorAdapter.java           | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/783aa51f/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.java b/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.java
index a9d3f43..e69ca9d 100644
--- a/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.java
+++ b/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.java
@@ -33,10 +33,14 @@ import org.apache.commons.collections.ResettableIterator;
  * @author Matt Benson
  */
 public class EntrySetToMapIteratorAdapter<K, V> implements MapIterator<K, V>, ResettableIterator<K> {
-    private Set<Map.Entry<K, V>> entrySet;
+    /** The adapted Map entry Set. */
+    protected Set<Map.Entry<K, V>> entrySet;
 
-    private transient Iterator<Map.Entry<K, V>> iterator;
-    private transient Map.Entry<K, V> entry;
+    /** The resettable iterator in use. */
+    protected transient Iterator<Map.Entry<K, V>> iterator;
+
+    /** The currently positioned Map entry. */
+    protected transient Map.Entry<K, V> entry;
 
     /**
      * Create a new EntrySetToMapIteratorAdapter.
@@ -97,7 +101,11 @@ public class EntrySetToMapIteratorAdapter<K, V> implements MapIterator<K, V>, Re
         entry = null;
     }
 
-    private synchronized Map.Entry<K, V> current() {
+    /**
+     * Get the currently active entry.
+     * @return Map.Entry<K, V>
+     */
+    protected synchronized Map.Entry<K, V> current() { 
         if (entry == null) {
             throw new IllegalStateException();
         }


[46/77] [abbrv] commons-collections git commit: handle more ListIterator functionality when possible

Posted by ch...@apache.org.
handle more ListIterator functionality when possible

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@751857 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/613d1acb
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/613d1acb
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/613d1acb

Branch: refs/heads/collections_jdk5_branch
Commit: 613d1acbb10c9c0d04f94eaa9b3686c2e357f1ae
Parents: e53e8f2
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Mon Mar 9 21:43:53 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Mon Mar 9 21:43:53 2009 +0000

----------------------------------------------------------------------
 .../iterators/ListIteratorWrapper.java          | 108 ++++++++--
 .../iterators/TestListIteratorWrapper.java      |  90 +++++++-
 .../iterators/TestListIteratorWrapper2.java     | 213 +++++++++++++++++++
 3 files changed, 391 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/613d1acb/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java b/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java
index 4abd2f5..6a9e5bf 100644
--- a/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java
+++ b/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java
@@ -16,15 +16,21 @@
  */
 package org.apache.commons.collections.iterators;
 
+import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.ListIterator;
 import java.util.NoSuchElementException;
 
+import org.apache.commons.collections.ResettableIterator;
 import org.apache.commons.collections.ResettableListIterator;
 
 /**
- * Converts an iterator into a list iterator by caching the returned entries.
+ * Converts an {@link Iterator} into a {@link ResettableListIterator}.
+ * For plain <code>Iterator</code>s this is accomplished by caching the returned
+ * elements.  This class can also be used to simply add {@link ResettableIterator}
+ * functionality to a given {@link ListIterator}.
  * <p>
  * The <code>ListIterator</code> interface has additional useful methods
  * for navigation - <code>previous()</code> and the index methods.
@@ -32,7 +38,7 @@ import org.apache.commons.collections.ResettableListIterator;
  * <code>ListIterator</code>. It achieves this by building a list internally
  * of as the underlying iterator is traversed.
  * <p>
- * The optional operations of <code>ListIterator</code> are not supported.
+ * The optional operations of <code>ListIterator</code> are not supported for plain <code>Iterator</code>s.
  * <p>
  * This class implements ResettableListIterator from Commons Collections 3.2.
  *
@@ -41,13 +47,17 @@ import org.apache.commons.collections.ResettableListIterator;
  *
  * @author Morgan Delagrange
  * @author Stephen Colebourne
+ * @author Matt Benson
  */
 public class ListIteratorWrapper<E> implements ResettableListIterator<E> {
 
-    /** Message used when remove, set or add are called. */
+    /** Message used when set or add are called. */
     private static final String UNSUPPORTED_OPERATION_MESSAGE =
         "ListIteratorWrapper does not support optional operations of ListIterator.";
 
+    /** Message used when set or add are called. */
+    private static final String CANNOT_REMOVE_MESSAGE = "Cannot remove element at index {0}.";
+
     /** The underlying iterator being decorated. */
     private final Iterator<? extends E> iterator;
     /** The list being used to cache the iterator. */
@@ -57,6 +67,8 @@ public class ListIteratorWrapper<E> implements ResettableListIterator<E> {
     private int currentIndex = 0;
     /** The current index of the wrapped iterator. */
     private int wrappedIteratorIndex = 0;
+    /** recall whether the wrapped iterator's "cursor" is in such a state as to allow remove() to be called */
+    private boolean removeState;
 
     // Constructor
     //-------------------------------------------------------------------------
@@ -78,12 +90,19 @@ public class ListIteratorWrapper<E> implements ResettableListIterator<E> {
     // ListIterator interface
     //-------------------------------------------------------------------------
     /**
-     * Throws {@link UnsupportedOperationException}.
+     * Throws {@link UnsupportedOperationException}
+     * unless the underlying <code>Iterator</code> is a <code>ListIterator</code>.
      *
-     * @param obj  the object to add, ignored
-     * @throws UnsupportedOperationException always
+     * @param obj  the object to add
+     * @throws UnsupportedOperationException
      */
     public void add(E obj) throws UnsupportedOperationException {
+        if (iterator instanceof ListIterator) {
+            @SuppressWarnings("unchecked")
+            ListIterator<E> li = (ListIterator<E>) iterator;
+            li.add(obj);
+            return;
+        }
         throw new UnsupportedOperationException(UNSUPPORTED_OPERATION_MESSAGE);
     }
 
@@ -93,7 +112,7 @@ public class ListIteratorWrapper<E> implements ResettableListIterator<E> {
      * @return true if there are more elements
      */
     public boolean hasNext() {
-        if (currentIndex == wrappedIteratorIndex) {
+        if (currentIndex == wrappedIteratorIndex || iterator instanceof ListIterator) {
             return iterator.hasNext();
         }
         return true;
@@ -105,10 +124,12 @@ public class ListIteratorWrapper<E> implements ResettableListIterator<E> {
      * @return true if there are previous elements
      */
     public boolean hasPrevious() {
-        if (currentIndex == 0) {
-            return false;
+        if (iterator instanceof ListIterator) {
+            @SuppressWarnings("unchecked")
+            ListIterator li = (ListIterator) iterator;
+            return li.hasPrevious();
         }
-        return true;
+        return currentIndex > 0;
     }
 
     /**
@@ -118,6 +139,10 @@ public class ListIteratorWrapper<E> implements ResettableListIterator<E> {
      * @throws NoSuchElementException if there are no more elements
      */
     public E next() throws NoSuchElementException {
+        if (iterator instanceof ListIterator) {
+            return iterator.next();
+        }
+
         if (currentIndex < wrappedIteratorIndex) {
             ++currentIndex;
             return list.get(currentIndex - 1);
@@ -127,15 +152,21 @@ public class ListIteratorWrapper<E> implements ResettableListIterator<E> {
         list.add(retval);
         ++currentIndex;
         ++wrappedIteratorIndex;
+        removeState = true;
         return retval;
     }
 
     /**
-     * Returns in the index of the next element.
+     * Returns the index of the next element.
      *
      * @return the index of the next element
      */
     public int nextIndex() {
+        if (iterator instanceof ListIterator) {
+            @SuppressWarnings("unchecked")
+            ListIterator li = (ListIterator) iterator;
+            return li.nextIndex();
+        }
         return currentIndex;
     }
 
@@ -146,11 +177,17 @@ public class ListIteratorWrapper<E> implements ResettableListIterator<E> {
      * @throws NoSuchElementException  if there are no previous elements
      */
     public E previous() throws NoSuchElementException {
+        if (iterator instanceof ListIterator) {
+            @SuppressWarnings("unchecked")
+            ListIterator<E> li = (ListIterator<E>) iterator;
+            return li.previous();
+        }
+
         if (currentIndex == 0) {
             throw new NoSuchElementException();
         }
-        --currentIndex;
-        return list.get(currentIndex);    
+        removeState = wrappedIteratorIndex == currentIndex;
+        return list.get(--currentIndex);
     }
 
     /**
@@ -159,25 +196,52 @@ public class ListIteratorWrapper<E> implements ResettableListIterator<E> {
      * @return  the index of the previous element
      */
     public int previousIndex() {
+        if (iterator instanceof ListIterator) {
+            @SuppressWarnings("unchecked")
+            ListIterator li = (ListIterator) iterator;
+            return li.previousIndex();
+        }
         return currentIndex - 1;
     }
 
     /**
-     * Throws {@link UnsupportedOperationException}.
+     * Throws {@link UnsupportedOperationException} if {@link #previous()} has ever been called.
      *
      * @throws UnsupportedOperationException always
      */
     public void remove() throws UnsupportedOperationException {
-        throw new UnsupportedOperationException(UNSUPPORTED_OPERATION_MESSAGE);
+        if (iterator instanceof ListIterator) {
+            iterator.remove();
+            return;
+        }
+        int removeIndex = currentIndex;
+        if (currentIndex == wrappedIteratorIndex) {
+            --removeIndex;
+        }
+        if (!removeState || wrappedIteratorIndex - currentIndex > 1) {
+            throw new IllegalStateException(MessageFormat.format(CANNOT_REMOVE_MESSAGE, removeIndex));
+        }
+        iterator.remove();
+        list.remove(removeIndex);
+        currentIndex = removeIndex;
+        wrappedIteratorIndex--;
+        removeState = false;
     }
 
     /**
-     * Throws {@link UnsupportedOperationException}.
+     * Throws {@link UnsupportedOperationException}
+     * unless the underlying <code>Iterator</code> is a <code>ListIterator</code>.
      *
-     * @param obj  the object to set, ignored
-     * @throws UnsupportedOperationException always
+     * @param obj  the object to set
+     * @throws UnsupportedOperationException
      */
     public void set(E obj) throws UnsupportedOperationException {
+        if (iterator instanceof ListIterator) {
+            @SuppressWarnings("unchecked")
+            ListIterator<E> li = (ListIterator<E>) iterator;
+            li.set(obj);
+            return;
+        }
         throw new UnsupportedOperationException(UNSUPPORTED_OPERATION_MESSAGE);
     }
 
@@ -190,6 +254,14 @@ public class ListIteratorWrapper<E> implements ResettableListIterator<E> {
      * @since Commons Collections 3.2
      */
     public void reset()  {
+        if (iterator instanceof ListIterator) {
+            @SuppressWarnings("unchecked")
+            ListIterator li = (ListIterator) iterator;
+            while (li.previousIndex() >= 0) {
+                li.previous();
+            }
+            return;
+        }
         currentIndex = 0;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/613d1acb/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 6f108b0..8571356 100644
--- a/src/test/org/apache/commons/collections/iterators/TestListIteratorWrapper.java
+++ b/src/test/org/apache/commons/collections/iterators/TestListIteratorWrapper.java
@@ -115,13 +115,99 @@ public class TestListIteratorWrapper<E> extends AbstractTestIterator<E> {
     public void testRemove() {
         ListIterator<E> iter = makeObject();
 
+        //initial state:
+        assertEquals(-1, iter.previousIndex());
+        assertEquals(0, iter.nextIndex());
+
         try {
             iter.remove();
-            fail("FilterIterator does not support the remove() method");
-        } catch (UnsupportedOperationException e) {
+            fail("ListIteratorWrapper#remove() should fail; must be initially positioned first");
+        } catch (IllegalStateException e) {
+        }
 
+        //no change from invalid op:
+        assertEquals(-1, iter.previousIndex());
+        assertEquals(0, iter.nextIndex());
+
+        //establish size:
+        int sz = list1.size();
+
+        //verify initial next() call:
+        assertEquals(list1.get(0), iter.next());
+        assertEquals(0, iter.previousIndex());
+        assertEquals(1, iter.nextIndex());
+
+        //verify remove():
+        iter.remove();
+        assertEquals(--sz, list1.size());
+        //like we never started iterating:
+        assertEquals(-1, iter.previousIndex());
+        assertEquals(0, iter.nextIndex());
+ 
+        try {
+            iter.remove();
+            fail("ListIteratorWrapper#remove() should fail; must be repositioned first");
+        } catch (IllegalStateException e) {
         }
 
+        //no change from invalid op:
+        assertEquals(-1, iter.previousIndex());
+        assertEquals(0, iter.nextIndex());
+
+        //two consecutive next() calls:
+        assertEquals(list1.get(0), iter.next());
+        assertEquals(0, iter.previousIndex());
+        assertEquals(1, iter.nextIndex());
+
+        assertEquals(list1.get(1), iter.next());
+        assertEquals(1, iter.previousIndex());
+        assertEquals(2, iter.nextIndex());
+
+        //call previous():
+        assertEquals(list1.get(1), iter.previous());
+        assertEquals(0, iter.previousIndex());
+        assertEquals(1, iter.nextIndex());
+
+        //should support remove() after calling previous() once from tip because we haven't changed the underlying iterator's position:
+        iter.remove();
+        assertEquals(--sz, list1.size());
+        assertEquals(0, iter.previousIndex());
+        assertEquals(1, iter.nextIndex());
+
+        //dig into cache
+        assertEquals(list1.get(0), iter.previous());
+        assertEquals(-1, iter.previousIndex());
+        assertEquals(0, iter.nextIndex());
+
+        try {
+            iter.remove();
+            fail("ListIteratorWrapper does not support the remove() method while dug into the cache via previous()");
+        } catch (IllegalStateException e) {
+        }
+
+        //no change from invalid op:
+        assertEquals(-1, iter.previousIndex());
+        assertEquals(0, iter.nextIndex());
+
+        //dig out of cache, first next() maintains current position:
+        assertEquals(list1.get(0), iter.next());
+        assertEquals(0, iter.previousIndex());
+        assertEquals(1, iter.nextIndex());
+        //continue traversing underlying iterator with this next() call, and we're out of the hole, so to speak:
+        assertEquals(list1.get(1), iter.next());
+        assertEquals(1, iter.previousIndex());
+        assertEquals(2, iter.nextIndex());
+
+        //verify remove() works again:
+        iter.remove();
+        assertEquals(--sz, list1.size());
+        assertEquals(0, iter.previousIndex());
+        assertEquals(1, iter.nextIndex());
+
+        assertEquals(list1.get(1), iter.next());
+        assertEquals(1, iter.previousIndex());
+        assertEquals(2, iter.nextIndex());
+
     }
 
     public void testReset() {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/613d1acb/src/test/org/apache/commons/collections/iterators/TestListIteratorWrapper2.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestListIteratorWrapper2.java b/src/test/org/apache/commons/collections/iterators/TestListIteratorWrapper2.java
new file mode 100644
index 0000000..acad9fe
--- /dev/null
+++ b/src/test/org/apache/commons/collections/iterators/TestListIteratorWrapper2.java
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections.iterators;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.commons.collections.ResettableListIterator;
+
+/**
+ * Tests the ListIteratorWrapper to insure that it behaves as expected when wrapping a ListIterator.
+ *
+ * @version $Revision$ $Date$
+ *
+ * @author Morgan Delagrange
+ */
+public class TestListIteratorWrapper2<E> extends AbstractTestIterator<E> {
+
+    protected String[] testArray = {
+        "One", "Two", "Three", "Four", "Five", "Six"
+    };
+
+    protected List<E> list1 = null;
+
+    public static Test suite() {
+        return new TestSuite(TestListIteratorWrapper2.class);
+    }
+
+    public TestListIteratorWrapper2(String testName) {
+        super(testName);
+    }
+
+    @SuppressWarnings("unchecked")
+    public void setUp() {
+        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 ResettableListIterator<E> makeEmptyIterator() {
+        ArrayList<E> list = new ArrayList<E>();
+        return new ListIteratorWrapper<E>(list.listIterator());
+    }
+
+    public ResettableListIterator<E> makeObject() {
+        return new ListIteratorWrapper<E>(list1.listIterator());
+    }
+
+    public void testIterator() {
+        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);
+        }
+
+        assertTrue("Iterator should now be empty", !iter.hasNext());
+
+        try {
+            iter.next();
+        } catch (Exception e) {
+            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];
+            E iterValue = iter.previous();
+
+            assertEquals( "Iteration value is correct", testValue, iterValue );
+        }
+
+        try {
+            iter.previous();
+        } catch (Exception e) {
+            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];
+            Object iterValue = iter.next();
+
+            assertEquals("Iteration value is correct", testValue, iterValue);
+        }
+
+    }
+
+    public void testRemove() {
+        ListIterator<E> iter = makeObject();
+
+        //initial state:
+        assertEquals(-1, iter.previousIndex());
+        assertEquals(0, iter.nextIndex());
+
+        try {
+            iter.remove();
+            fail("ListIteratorWrapper#remove() should fail; must be initially positioned first");
+        } catch (IllegalStateException e) {
+        }
+
+        //no change from invalid op:
+        assertEquals(-1, iter.previousIndex());
+        assertEquals(0, iter.nextIndex());
+
+        //establish size:
+        int sz = list1.size();
+
+        //verify initial next() call:
+        assertEquals(list1.get(0), iter.next());
+        assertEquals(0, iter.previousIndex());
+        assertEquals(1, iter.nextIndex());
+
+        //verify remove():
+        iter.remove();
+        assertEquals(--sz, list1.size());
+        //like we never started iterating:
+        assertEquals(-1, iter.previousIndex());
+        assertEquals(0, iter.nextIndex());
+ 
+        try {
+            iter.remove();
+            fail("ListIteratorWrapper#remove() should fail; must be repositioned first");
+        } catch (IllegalStateException e) {
+        }
+
+        //no change from invalid op:
+        assertEquals(-1, iter.previousIndex());
+        assertEquals(0, iter.nextIndex());
+
+        //two consecutive next() calls:
+        assertEquals(list1.get(0), iter.next());
+        assertEquals(0, iter.previousIndex());
+        assertEquals(1, iter.nextIndex());
+
+        assertEquals(list1.get(1), iter.next());
+        assertEquals(1, iter.previousIndex());
+        assertEquals(2, iter.nextIndex());
+
+        //call previous():
+        assertEquals(list1.get(1), iter.previous());
+        assertEquals(0, iter.previousIndex());
+        assertEquals(1, iter.nextIndex());
+
+        //should support remove() after calling previous() once from tip because we haven't changed the underlying iterator's position:
+        iter.remove();
+        assertEquals(--sz, list1.size());
+        assertEquals(0, iter.previousIndex());
+        assertEquals(1, iter.nextIndex());
+
+        //this would dig into cache on a plain Iterator, but forwards directly to wrapped ListIterator:
+        assertEquals(list1.get(0), iter.previous());
+        assertEquals(-1, iter.previousIndex());
+        assertEquals(0, iter.nextIndex());
+
+        //here's the proof; remove() still works:
+        iter.remove();
+        assertEquals(--sz, list1.size());
+        assertEquals(-1, iter.previousIndex());
+        assertEquals(0, iter.nextIndex());
+
+        //further testing would be fairly meaningless:
+    }
+
+    public void testReset() {
+        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];
+            E iterValue = iter.next();
+
+            assertEquals("Iteration value is correct", testValue, iterValue);
+        }
+    }
+
+}


[48/77] [abbrv] commons-collections git commit: add new test to suite

Posted by ch...@apache.org.
add new test to suite

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@751862 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/4306110c
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/4306110c
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/4306110c

Branch: refs/heads/collections_jdk5_branch
Commit: 4306110cd1ac98b9c19ce979f89dd37212e61529
Parents: 3d5f3fe
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Mon Mar 9 21:56:41 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Mon Mar 9 21:56:41 2009 +0000

----------------------------------------------------------------------
 src/test/org/apache/commons/collections/iterators/TestAll.java | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/4306110c/src/test/org/apache/commons/collections/iterators/TestAll.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/TestAll.java b/src/test/org/apache/commons/collections/iterators/TestAll.java
index 671f78d..ac20c46 100644
--- a/src/test/org/apache/commons/collections/iterators/TestAll.java
+++ b/src/test/org/apache/commons/collections/iterators/TestAll.java
@@ -47,6 +47,7 @@ public class TestAll extends TestCase {
         suite.addTest(TestFilterListIterator.suite());
         suite.addTest(TestIteratorChain.suite());
         suite.addTest(TestListIteratorWrapper.suite());
+        suite.addTest(TestListIteratorWrapper2.suite());
         suite.addTest(TestLoopingIterator.suite());
         suite.addTest(TestLoopingListIterator.suite());
         suite.addTest(TestReverseListIterator.suite());


[65/77] [abbrv] commons-collections git commit: Tab police

Posted by ch...@apache.org.
Tab police

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@814044 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/8c2bb85d
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/8c2bb85d
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/8c2bb85d

Branch: refs/heads/collections_jdk5_branch
Commit: 8c2bb85d468aaa4fdf06cca4f9cf49a916c62e3a
Parents: a944755
Author: Sebastian Bazley <se...@apache.org>
Authored: Fri Sep 11 21:48:16 2009 +0000
Committer: Sebastian Bazley <se...@apache.org>
Committed: Fri Sep 11 21:48:16 2009 +0000

----------------------------------------------------------------------
 .../commons/collections/CollectionUtils.java    |   8 +-
 .../commons/collections/PredicateUtils.java     |   2 +-
 .../collections/comparators/NullComparator.java |   2 +-
 .../collections/iterators/ArrayIterator.java    |   4 +-
 .../iterators/ArrayListIterator.java            |   2 +-
 .../iterators/ObjectArrayListIterator.java      |   2 +-
 .../iterators/ObjectGraphIterator.java          |   4 +-
 .../iterators/SingletonIterator.java            |   2 +-
 .../commons/collections/map/CompositeMap.java   |  52 ++++-----
 .../apache/commons/collections/map/LazyMap.java |  28 ++---
 .../commons/collections/map/LazySortedMap.java  |  32 +++---
 .../commons/collections/MockTestCase.java       |  56 ++++-----
 .../commons/collections/TestAllPackages.java    |   2 +-
 .../collections/TestCollectionUtils.java        |  10 +-
 .../commons/collections/TestIteratorUtils.java  |   8 +-
 .../comparators/AbstractTestComparator.java     |  12 +-
 .../comparators/TestNullComparator.java         |  32 +++---
 .../iterators/TestSingletonListIterator.java    |  12 +-
 .../commons/collections/list/TestTreeList.java  | 114 +++++++++----------
 .../apache/commons/collections/map/TestAll.java |   2 +-
 .../commons/collections/map/TestLazyMap.java    |  28 ++---
 .../collections/map/TestLazySortedMap.java      |  12 +-
 .../commons/collections/splitmap/TestAll.java   |   2 +-
 23 files changed, 214 insertions(+), 214 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/java/org/apache/commons/collections/CollectionUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/CollectionUtils.java b/src/java/org/apache/commons/collections/CollectionUtils.java
index 89b06e4..3da722b 100644
--- a/src/java/org/apache/commons/collections/CollectionUtils.java
+++ b/src/java/org/apache/commons/collections/CollectionUtils.java
@@ -128,7 +128,7 @@ public class CollectionUtils {
      * undesirable. This implementation only implements Collection.
      */
     @SuppressWarnings("unchecked")
-	public static final Collection EMPTY_COLLECTION = UnmodifiableCollection.decorate(new ArrayList<Object>());
+    public static final Collection EMPTY_COLLECTION = UnmodifiableCollection.decorate(new ArrayList<Object>());
 
     /**
      * <code>CollectionUtils</code> should not normally be instantiated.
@@ -845,7 +845,7 @@ public class CollectionUtils {
      */
     public static <T> T get(Iterator<T> iterator, int index) {
         int i = index;
-		checkIndexBounds(i);
+        checkIndexBounds(i);
             while (iterator.hasNext()) {
                 i--;
                 if (i == -1) {
@@ -919,7 +919,7 @@ public class CollectionUtils {
      */
     public static Object get(Object object, int index) {
         int i = index;
-		if (i < 0) {
+        if (i < 0) {
             throw new IndexOutOfBoundsException("Index cannot be negative: " + i);
         }
         if (object instanceof Map) {
@@ -935,7 +935,7 @@ public class CollectionUtils {
                 if (i == -1) {
                     return it.next();
                 }
-				it.next();
+                it.next();
             }
             throw new IndexOutOfBoundsException("Entry does not exist: " + i);
         } else if (object instanceof Collection) {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/java/org/apache/commons/collections/PredicateUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/PredicateUtils.java b/src/java/org/apache/commons/collections/PredicateUtils.java
index c2b557b..d5185f9 100644
--- a/src/java/org/apache/commons/collections/PredicateUtils.java
+++ b/src/java/org/apache/commons/collections/PredicateUtils.java
@@ -538,7 +538,7 @@ public class PredicateUtils {
      * @param predicate  the predicate to call with the result of the transform
      * @return the predicate
      * @throws IllegalArgumentException if the transformer or the predicate is null
-	 * @since Commons Collections 3.1
+     * @since Commons Collections 3.1
      */
     public static <T> Predicate<T> transformedPredicate(
             Transformer<? super T, ? extends T> transformer, Predicate<? super T> predicate) {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/java/org/apache/commons/collections/comparators/NullComparator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/comparators/NullComparator.java b/src/java/org/apache/commons/collections/comparators/NullComparator.java
index ea2c5a1..3262426 100644
--- a/src/java/org/apache/commons/collections/comparators/NullComparator.java
+++ b/src/java/org/apache/commons/collections/comparators/NullComparator.java
@@ -172,7 +172,7 @@ public class NullComparator<E> implements Comparator<E>, Serializable {
         if(!obj.getClass().equals(this.getClass())) { return false; }
 
         NullComparator<?> other = (NullComparator<?>) obj;
-	
+
         return ((this.nullsAreHigh == other.nullsAreHigh) &&
                 (this.nonNullComparator.equals(other.nonNullComparator)));
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/java/org/apache/commons/collections/iterators/ArrayIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/ArrayIterator.java b/src/java/org/apache/commons/collections/iterators/ArrayIterator.java
index 809101c..42e9528 100644
--- a/src/java/org/apache/commons/collections/iterators/ArrayIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/ArrayIterator.java
@@ -48,9 +48,9 @@ public class ArrayIterator<E> implements ResettableIterator<E> {
     /** The start index to loop from */
     protected int startIndex = 0;
     /** The end index to loop to */
-	protected int endIndex = 0;
+    protected int endIndex = 0;
     /** The current iterator index */
-	protected int index = 0;
+    protected int index = 0;
     
     // Constructors
     // ----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java b/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java
index 159bcc2..55662d8 100644
--- a/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java
@@ -45,7 +45,7 @@ import org.apache.commons.collections.ResettableListIterator;
  * @author Phil Steitz
  */
 public class ArrayListIterator<E> extends ArrayIterator<E>
-		implements ListIterator<E>, ResettableListIterator<E> {
+        implements ListIterator<E>, ResettableListIterator<E> {
 
     /**
      * Holds the index of the last item returned by a call to <code>next()</code>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java b/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java
index 113fba6..fffb599 100644
--- a/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java
@@ -42,7 +42,7 @@ import org.apache.commons.collections.ResettableListIterator;
  * @author Phil Steitz
  */
 public class ObjectArrayListIterator<E> extends ObjectArrayIterator<E>
-		implements ListIterator<E>, ResettableListIterator<E> {
+        implements ListIterator<E>, ResettableListIterator<E> {
 
     /**
      * Holds the index of the last item returned by a call to <code>next()</code> 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/java/org/apache/commons/collections/iterators/ObjectGraphIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/ObjectGraphIterator.java b/src/java/org/apache/commons/collections/iterators/ObjectGraphIterator.java
index a43a876..3926f11 100644
--- a/src/java/org/apache/commons/collections/iterators/ObjectGraphIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/ObjectGraphIterator.java
@@ -79,7 +79,7 @@ public class ObjectGraphIterator<E> implements Iterator<E> {
 
     /** The stack of iterators */
     protected final ArrayStack<Iterator<? extends E>> stack = new ArrayStack<Iterator<? extends E>>(8);
-	/** The root object in the tree */
+    /** The root object in the tree */
     protected E root;
     /** The transformer to use */
     protected Transformer<? super E, ? extends E> transformer;
@@ -198,7 +198,7 @@ public class ObjectGraphIterator<E> implements Iterator<E> {
             // all iterators exhausted
         } else {
             // current iterator exhausted, go up a level
-            currentIterator = (Iterator<? extends E>) stack.pop();
+            currentIterator = stack.pop();
             findNextByIterator(currentIterator);
         }
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/java/org/apache/commons/collections/iterators/SingletonIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/SingletonIterator.java b/src/java/org/apache/commons/collections/iterators/SingletonIterator.java
index a1b8c31..e6145f2 100644
--- a/src/java/org/apache/commons/collections/iterators/SingletonIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/SingletonIterator.java
@@ -33,7 +33,7 @@ import org.apache.commons.collections.ResettableIterator;
  * @author Rodney Waldhoff
  */
 public class SingletonIterator<E>
-		implements Iterator<E>, ResettableIterator<E> {
+        implements Iterator<E>, ResettableIterator<E> {
 
     /** Whether remove is allowed */
     private final boolean removeAllowed;

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/java/org/apache/commons/collections/map/CompositeMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/CompositeMap.java b/src/java/org/apache/commons/collections/map/CompositeMap.java
index 432e492..05c5469 100644
--- a/src/java/org/apache/commons/collections/map/CompositeMap.java
+++ b/src/java/org/apache/commons/collections/map/CompositeMap.java
@@ -188,7 +188,7 @@ public class CompositeMap<K, V> extends AbstractIterableMap<K, V> {
      *         key.
      *
      * @throws ClassCastException if the key is of an inappropriate type for
-     * 		  this map (optional).
+     *         this map (optional).
      * @throws NullPointerException if the key is <tt>null</tt> and this map
      *            does not not permit <tt>null</tt> keys (optional).
      */
@@ -213,7 +213,7 @@ public class CompositeMap<K, V> extends AbstractIterableMap<K, V> {
      * @return <tt>true</tt> if this map maps one or more keys to the
      *         specified value.
      * @throws ClassCastException if the value is of an inappropriate type for
-     * 		  this map (optional).
+     *         this map (optional).
      * @throws NullPointerException if the value is <tt>null</tt> and this map
      *            does not not permit <tt>null</tt> values (optional).
      */
@@ -246,7 +246,7 @@ public class CompositeMap<K, V> extends AbstractIterableMap<K, V> {
     public Set<Map.Entry<K, V>> entrySet() {
         CompositeSet<Map.Entry<K, V>> entries = new CompositeSet<Map.Entry<K,V>>();
         for (int i = composite.length - 1; i >= 0; --i) {
-            entries.addComposited((Collection<Map.Entry<K, V>>) composite[i].entrySet());
+            entries.addComposited(composite[i].entrySet());
         }
         return entries;
     }
@@ -266,12 +266,12 @@ public class CompositeMap<K, V> extends AbstractIterableMap<K, V> {
      *
      * @param key key whose associated value is to be returned.
      * @return the value to which this map maps the specified key, or
-     *	       <tt>null</tt> if the map contains no mapping for this key.
+     *         <tt>null</tt> if the map contains no mapping for this key.
      *
      * @throws ClassCastException if the key is of an inappropriate type for
-     * 		  this map (optional).
+     *         this map (optional).
      * @throws NullPointerException key is <tt>null</tt> and this map does not
-     *		  not permit <tt>null</tt> keys (optional).
+     *         not permit <tt>null</tt> keys (optional).
      *
      * @see #containsKey(Object)
      */
@@ -332,16 +332,16 @@ public class CompositeMap<K, V> extends AbstractIterableMap<K, V> {
      * @param key key with which the specified value is to be associated.
      * @param value value to be associated with the specified key.
      * @return previous value associated with specified key, or <tt>null</tt>
-     *	       if there was no mapping for key.  A <tt>null</tt> return can
-     *	       also indicate that the map previously associated <tt>null</tt>
-     *	       with the specified key, if the implementation supports
-     *	       <tt>null</tt> values.
+     *         if there was no mapping for key.  A <tt>null</tt> return can
+     *         also indicate that the map previously associated <tt>null</tt>
+     *         with the specified key, if the implementation supports
+     *         <tt>null</tt> values.
      *
      * @throws UnsupportedOperationException if no MapMutator has been specified
      * @throws ClassCastException if the class of the specified key or value
-     * 	          prevents it from being stored in this map.
+     *            prevents it from being stored in this map.
      * @throws IllegalArgumentException if some aspect of this key or value
-     *	          prevents it from being stored in this map.
+     *            prevents it from being stored in this map.
      * @throws NullPointerException this map does not permit <tt>null</tt>
      *            keys or values, and the specified key or value is
      *            <tt>null</tt>.
@@ -364,13 +364,13 @@ public class CompositeMap<K, V> extends AbstractIterableMap<K, V> {
      * @param map Mappings to be stored in this map.
      *
      * @throws UnsupportedOperationException if the <tt>putAll</tt> method is
-     * 		  not supported by this map.
+     *         not supported by this map.
      *
      * @throws ClassCastException if the class of a key or value in the
-     * 	          specified map prevents it from being stored in this map.
+     *         specified map prevents it from being stored in this map.
      *
      * @throws IllegalArgumentException some aspect of a key or value in the
-     *	          specified map prevents it from being stored in this map.
+     *         specified map prevents it from being stored in this map.
      * @throws NullPointerException the specified map is <tt>null</tt>, or if
      *         this map does not permit <tt>null</tt> keys or values, and the
      *         specified map contains <tt>null</tt> keys or values.
@@ -398,10 +398,10 @@ public class CompositeMap<K, V> extends AbstractIterableMap<K, V> {
      *
      * @param key key whose mapping is to be removed from the map.
      * @return previous value associated with specified key, or <tt>null</tt>
-     *	       if there was no mapping for key.
+     *         if there was no mapping for key.
      *
      * @throws ClassCastException if the key is of an inappropriate type for
-     * 		  the composited map (optional).
+     *         the composited map (optional).
      * @throws NullPointerException if the key is <tt>null</tt> and the composited map
      *            does not not permit <tt>null</tt> keys (optional).
      * @throws UnsupportedOperationException if the <tt>remove</tt> method is
@@ -447,7 +447,7 @@ public class CompositeMap<K, V> extends AbstractIterableMap<K, V> {
     public Collection<V> values() {
         CompositeCollection<V> values = new CompositeCollection<V>();
         for (int i = composite.length - 1; i >= 0; --i) {
-            values.addComposited((Collection<V>) composite[i].values());
+            values.addComposited(composite[i].values());
         }
         return values;
     }
@@ -505,16 +505,16 @@ public class CompositeMap<K, V> extends AbstractIterableMap<K, V> {
          * @param key  key with which the specified value is to be associated.
          * @param value  value to be associated with the specified key.
          * @return previous value associated with specified key, or <tt>null</tt>
-         *	       if there was no mapping for key.  A <tt>null</tt> return can
-         *	       also indicate that the map previously associated <tt>null</tt>
-         *	       with the specified key, if the implementation supports
-         *	       <tt>null</tt> values.
+         *         if there was no mapping for key.  A <tt>null</tt> return can
+         *         also indicate that the map previously associated <tt>null</tt>
+         *         with the specified key, if the implementation supports
+         *         <tt>null</tt> values.
          *
          * @throws UnsupportedOperationException if not defined
          * @throws ClassCastException if the class of the specified key or value
-         * 	          prevents it from being stored in this map.
+         *            prevents it from being stored in this map.
          * @throws IllegalArgumentException if some aspect of this key or value
-         *	          prevents it from being stored in this map.
+         *            prevents it from being stored in this map.
          * @throws NullPointerException this map does not permit <tt>null</tt>
          *            keys or values, and the specified key or value is
          *            <tt>null</tt>.
@@ -530,9 +530,9 @@ public class CompositeMap<K, V> extends AbstractIterableMap<K, V> {
          *
          * @throws UnsupportedOperationException if not defined
          * @throws ClassCastException if the class of the specified key or value
-         * 	          prevents it from being stored in this map.
+         *            prevents it from being stored in this map.
          * @throws IllegalArgumentException if some aspect of this key or value
-         *	          prevents it from being stored in this map.
+         *            prevents it from being stored in this map.
          * @throws NullPointerException this map does not permit <tt>null</tt>
          *            keys or values, and the specified key or value is
          *            <tt>null</tt>.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/java/org/apache/commons/collections/map/LazyMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/LazyMap.java b/src/java/org/apache/commons/collections/map/LazyMap.java
index db0f565..d84ff71 100644
--- a/src/java/org/apache/commons/collections/map/LazyMap.java
+++ b/src/java/org/apache/commons/collections/map/LazyMap.java
@@ -91,8 +91,8 @@ public class LazyMap<K, V> extends AbstractMapDecorator<K, V> implements Map<K,
      * @throws IllegalArgumentException if map or factory is null
      */
     public static <K, V> LazyMap<K, V> getLazyMap(Map<K, V> map, Factory< ? extends V> factory) {
-		return new LazyMap<K,V>(map, factory);
-	}
+        return new LazyMap<K,V>(map, factory);
+    }
 
     /**
      * Factory method to create a lazily instantiated map.
@@ -102,21 +102,21 @@ public class LazyMap<K, V> extends AbstractMapDecorator<K, V> implements Map<K,
      * @throws IllegalArgumentException if map or factory is null
      * @deprecated use {@link #getLazyMap(Map, Transformer)} instead.
      */
-	@Deprecated
+    @Deprecated
     public static <K,V> Map<K,V> decorate(Map<K,V> map, Transformer<? super K, ? extends V> factory) {
         return getLazyMap(map, factory);
     }
 
-	/**
+    /**
      * Factory method to create a lazily instantiated map.
      * 
      * @param map  the map to decorate, must not be null
      * @param factory  the factory to use, must not be null
      * @throws IllegalArgumentException if map or factory is null
      */
-	public static <V, K> LazyMap<K, V> getLazyMap(Map<K, V> map, Transformer<? super K, ? extends V> factory) {
-		return new LazyMap<K,V>(map, factory);
-	}
+    public static <V, K> LazyMap<K, V> getLazyMap(Map<K, V> map, Transformer<? super K, ? extends V> factory) {
+        return new LazyMap<K,V>(map, factory);
+    }
 
     //-----------------------------------------------------------------------
     /**
@@ -171,17 +171,17 @@ public class LazyMap<K, V> extends AbstractMapDecorator<K, V> implements Map<K,
      * @since Commons Collections 3.1
      */
     @SuppressWarnings("unchecked")
-	private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
         map = (Map) in.readObject();
     }
 
     //-----------------------------------------------------------------------
     @Override
-	public V get(Object key) {
+    public V get(Object key) {
         // create value for key if key is not currently in the map
         if (map.containsKey(key) == false) {
-        	K castKey = cast(key);
+            K castKey = cast(key);
             V value = factory.transform(castKey);
             map.put(castKey, value);
             return value;
@@ -195,10 +195,10 @@ public class LazyMap<K, V> extends AbstractMapDecorator<K, V> implements Map<K,
      * @param key .
      * @return the cast key.
      */
-	@SuppressWarnings("unchecked")
-	private K cast(Object key) {
-		return (K) key;
-	}
+    @SuppressWarnings("unchecked")
+    private K cast(Object key) {
+        return (K) key;
+    }
 
     // no need to wrap keySet, entrySet or values as they are views of
     // existing map entries - you can't do a map-style get on them.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/java/org/apache/commons/collections/map/LazySortedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/LazySortedMap.java b/src/java/org/apache/commons/collections/map/LazySortedMap.java
index ff56d0b..0cada69 100644
--- a/src/java/org/apache/commons/collections/map/LazySortedMap.java
+++ b/src/java/org/apache/commons/collections/map/LazySortedMap.java
@@ -85,19 +85,19 @@ public class LazySortedMap<K,V>
      * @param factory  the factory to use, must not be null
      * @throws IllegalArgumentException if map or factory is null
      */
-	public static <K, V> SortedMap<K, V> getLazySortedMap(SortedMap<K, V> map, Factory<? extends V> factory) {
-		return new LazySortedMap<K,V>(map, factory);
-	}
-
-	/**
-	 * Factory method to create a lazily instantiated sorted map.
-	 * 
-	 * @param map  the map to decorate, must not be null
-	 * @param factory  the factory to use, must not be null
-	 * @throws IllegalArgumentException if map or factory is null
-	 * @deprecated
-	 */
-	@Deprecated
+    public static <K, V> SortedMap<K, V> getLazySortedMap(SortedMap<K, V> map, Factory<? extends V> factory) {
+        return new LazySortedMap<K,V>(map, factory);
+    }
+
+    /**
+     * Factory method to create a lazily instantiated sorted map.
+     * 
+     * @param map  the map to decorate, must not be null
+     * @param factory  the factory to use, must not be null
+     * @throws IllegalArgumentException if map or factory is null
+     * @deprecated
+     */
+    @Deprecated
     public static <K,V> SortedMap<K,V> decorate(SortedMap<K,V> map, Transformer<? super K, ? extends V> factory) {
         return getLazySortedMap(map, factory);
     }
@@ -109,9 +109,9 @@ public class LazySortedMap<K,V>
      * @param factory  the factory to use, must not be null
      * @throws IllegalArgumentException if map or factory is null
      */
-	public static <K, V> SortedMap<K, V> getLazySortedMap(SortedMap<K, V> map, Transformer<? super K, ? extends V> factory) {
-		return new LazySortedMap<K,V>(map, factory);
-	}
+    public static <K, V> SortedMap<K, V> getLazySortedMap(SortedMap<K, V> map, Transformer<? super K, ? extends V> factory) {
+        return new LazySortedMap<K,V>(map, factory);
+    }
 
     //-----------------------------------------------------------------------
     /**

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/MockTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/MockTestCase.java b/src/test/org/apache/commons/collections/MockTestCase.java
index 9362fcd..7a3e48c 100644
--- a/src/test/org/apache/commons/collections/MockTestCase.java
+++ b/src/test/org/apache/commons/collections/MockTestCase.java
@@ -31,37 +31,37 @@ import org.easymock.IExpectationSetters;
  * @author Stephen Kestle
  */
 public abstract class MockTestCase {
-	private List<Object> mockObjects = new ArrayList<Object>();
+    private List<Object> mockObjects = new ArrayList<Object>();
 
-	@SuppressWarnings("unchecked")
-	protected <T> T createMock(Class name) {
-		T mock = (T) EasyMock.createMock(name);
-		return registerMock(mock);
-	}
+    @SuppressWarnings("unchecked")
+    protected <T> T createMock(Class name) {
+        T mock = (T) EasyMock.createMock(name);
+        return registerMock(mock);
+    }
 
-	private <T> T registerMock(T mock) {
-		mockObjects.add(mock);
-		return mock;
-	}
+    private <T> T registerMock(T mock) {
+        mockObjects.add(mock);
+        return mock;
+    }
 
-	protected <T> IExpectationSetters<T> expect(T t) {
-		return EasyMock.expect(t);
-	}
+    protected <T> IExpectationSetters<T> expect(T t) {
+        return EasyMock.expect(t);
+    }
 
-	protected final void replay() {
-		for (Object o : mockObjects) {
-			EasyMock.replay(o);
-		}
-	}
+    protected final void replay() {
+        for (Object o : mockObjects) {
+            EasyMock.replay(o);
+        }
+    }
 
-	protected final void verify() {
-		for (ListIterator<Object> i = mockObjects.listIterator(); i.hasNext();) {
-			try {
-				EasyMock.verify(i.next());
-			} catch (AssertionError e) {
-				throw new AssertionError((i.previousIndex() + 1) + ""
-						+ e.getMessage());
-			}
-		}
-	}
+    protected final void verify() {
+        for (ListIterator<Object> i = mockObjects.listIterator(); i.hasNext();) {
+            try {
+                EasyMock.verify(i.next());
+            } catch (AssertionError e) {
+                throw new AssertionError((i.previousIndex() + 1) + ""
+                        + e.getMessage());
+            }
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/TestAllPackages.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestAllPackages.java b/src/test/org/apache/commons/collections/TestAllPackages.java
index a67ca5a..48ec3d6 100644
--- a/src/test/org/apache/commons/collections/TestAllPackages.java
+++ b/src/test/org/apache/commons/collections/TestAllPackages.java
@@ -30,7 +30,7 @@ import org.junit.runners.Suite.SuiteClasses;
  */
 @RunWith(Suite.class)
 @SuiteClasses({
-	org.apache.commons.collections.TestAll.class,
+    org.apache.commons.collections.TestAll.class,
     org.apache.commons.collections.bag.TestAll.class,
     org.apache.commons.collections.bidimap.TestAll.class,
     org.apache.commons.collections.buffer.TestAll.class,

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/TestCollectionUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestCollectionUtils.java b/src/test/org/apache/commons/collections/TestCollectionUtils.java
index 6d102fb..547c7b5 100644
--- a/src/test/org/apache/commons/collections/TestCollectionUtils.java
+++ b/src/test/org/apache/commons/collections/TestCollectionUtils.java
@@ -875,7 +875,7 @@ public class TestCollectionUtils extends MockTestCase {
 
 //Up to here
     @SuppressWarnings("cast")
-	@Test
+    @Test
     public void filter() {
         List<Integer> ints = new ArrayList<Integer>();
         ints.add(1);
@@ -1396,10 +1396,10 @@ public class TestCollectionUtils extends MockTestCase {
     }
 
     /**
-	 * TODO: Should {@link CollectionUtils} be able to be extended? If it is extended, subclasses must 'override' the static methods with
-	 * call-throughs anyhow, otherwise java compiler warnings will result
-	 */
-	@Test
+     * TODO: Should {@link CollectionUtils} be able to be extended? If it is extended, subclasses must 'override' the static methods with
+     * call-throughs anyhow, otherwise java compiler warnings will result
+     */
+    @Test
     public void ensureCollectionUtilsCanBeExtended() {
         new CollectionUtils() {};
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/TestIteratorUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestIteratorUtils.java b/src/test/org/apache/commons/collections/TestIteratorUtils.java
index dc24155..6b797b5 100644
--- a/src/test/org/apache/commons/collections/TestIteratorUtils.java
+++ b/src/test/org/apache/commons/collections/TestIteratorUtils.java
@@ -566,9 +566,9 @@ public class TestIteratorUtils extends BulkTest {
     }
 
     //-----------------------------------------------------------------------
-	/**
-	 * Test next() and hasNext() for an immutable Iterator.
-	 */
+    /**
+     * Test next() and hasNext() for an immutable Iterator.
+     */
     public void testUnmodifiableIteratorIteration() {
         Iterator<String> iterator = getImmutableIterator();
 
@@ -672,7 +672,7 @@ public class TestIteratorUtils extends BulkTest {
      * Test remove() for an immutable ListIterator.
      */
     public void testUnmodifiableListIteratorImmutability() {
-    	ListIterator<String> listIterator = getImmutableListIterator();
+        ListIterator<String> listIterator = getImmutableListIterator();
 
         try {
             listIterator.remove();

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java b/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java
index 3c95033..3ebe3eb 100644
--- a/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java
+++ b/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java
@@ -192,15 +192,15 @@ public abstract class AbstractTestComparator<T> extends AbstractTestObject {
             // test to make sure the canonical form has been preserved
             try {
                 comparator = (Comparator<T>) readExternalFormFromDisk(getCanonicalComparatorName(makeObject()));
-        	} catch (FileNotFoundException exception) {
+            } catch (FileNotFoundException exception) {
     
                 boolean autoCreateSerialized = false;
     
-        	    if (autoCreateSerialized) {
-    	          	comparator = makeObject();
-            		String fileName = getCanonicalComparatorName(comparator);
-            		writeExternalFormToDisk((Serializable) comparator, fileName);
-            		fail("Serialized form could not be found.  A serialized version "
+                if (autoCreateSerialized) {
+                      comparator = makeObject();
+                    String fileName = getCanonicalComparatorName(comparator);
+                    writeExternalFormToDisk((Serializable) comparator, fileName);
+                    fail("Serialized form could not be found.  A serialized version "
                             + "has now been written (and should be added to CVS): " + fileName);
                 } else {
                     fail("The Serialized form could be located to test serialization "

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/comparators/TestNullComparator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/comparators/TestNullComparator.java b/src/test/org/apache/commons/collections/comparators/TestNullComparator.java
index c57f25d..14ffe77 100644
--- a/src/test/org/apache/commons/collections/comparators/TestNullComparator.java
+++ b/src/test/org/apache/commons/collections/comparators/TestNullComparator.java
@@ -48,28 +48,28 @@ public abstract class TestNullComparator extends AbstractTestComparator<Integer>
      **/
     public static class TestNullComparator1 extends TestNullComparator {
 
-    	public TestNullComparator1(String testName) {
-    	    super(testName);
-    	}
+        public TestNullComparator1(String testName) {
+            super(testName);
+        }
 
         public Comparator<Integer> makeObject() {
-    	    return new NullComparator<Integer>();
-    	}
+            return new NullComparator<Integer>();
+        }
 
         public List<Integer> getComparableObjectsOrdered() {
             List<Integer> list = new LinkedList<Integer>();
-    	    list.add(new Integer(1));
-    	    list.add(new Integer(2));
-    	    list.add(new Integer(3));
-    	    list.add(new Integer(4));
-    	    list.add(new Integer(5));
-    	    list.add(null);
-    	    return list;
-    	}
+            list.add(new Integer(1));
+            list.add(new Integer(2));
+            list.add(new Integer(3));
+            list.add(new Integer(4));
+            list.add(new Integer(5));
+            list.add(null);
+            return list;
+        }
 
-    	public String getCanonicalComparatorName(Object object) {
-    	    return super.getCanonicalComparatorName(object) + "1";
-    	}
+        public String getCanonicalComparatorName(Object object) {
+            return super.getCanonicalComparatorName(object) + "1";
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/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 2132302..3cbf500 100644
--- a/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java
@@ -103,12 +103,12 @@ public class TestSingletonListIterator<E> extends AbstractTestListIterator<E> {
         assertEquals( "Iteration next index", 1, iter.nextIndex() );
         assertEquals( "Iteration previous index", 0, iter.previousIndex() );
 
-    	try {
-    	    iter.next();
-    	} catch (Exception e) {
-    	  assertTrue("NoSuchElementException must be thrown", 
-    		 e.getClass().equals((new NoSuchElementException()).getClass()));
-    	}
+        try {
+            iter.next();
+        } catch (Exception e) {
+          assertTrue("NoSuchElementException must be thrown", 
+             e.getClass().equals((new NoSuchElementException()).getClass()));
+        }
         iter.previous();
         try {
             iter.previous();

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/list/TestTreeList.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/list/TestTreeList.java b/src/test/org/apache/commons/collections/list/TestTreeList.java
index 22381ad..9d950ac 100644
--- a/src/test/org/apache/commons/collections/list/TestTreeList.java
+++ b/src/test/org/apache/commons/collections/list/TestTreeList.java
@@ -33,9 +33,9 @@ import org.apache.commons.collections.BulkTest;
  */
 public class TestTreeList<E> extends AbstractTestList<E> {
 
-	public TestTreeList(String name) {
-		super(name);
-	}
+    public TestTreeList(String name) {
+        super(name);
+    }
 
     public static void main(String[] args) {
         junit.textui.TestRunner.run(suite());
@@ -105,29 +105,29 @@ public class TestTreeList<E> extends AbstractTestList<E> {
     }
 
     //-----------------------------------------------------------------------
-	public TreeList<E> makeObject() {
-		return new TreeList<E>();
-	}
+    public TreeList<E> makeObject() {
+        return new TreeList<E>();
+    }
 
     //-----------------------------------------------------------------------
-	@SuppressWarnings("unchecked")
+    @SuppressWarnings("unchecked")
     public void testAddMultiple() {
-		List<E> l = makeObject();
-		l.add((E) "hugo");
-		l.add((E) "erna");
-		l.add((E) "daniel");
-		l.add((E) "andres");
-		l.add((E) "harald");
-		l.add(0, null);
-		assertEquals(null, l.get(0));
-		assertEquals("hugo", l.get(1));
-		assertEquals("erna", l.get(2));
-		assertEquals("daniel", l.get(3));
-		assertEquals("andres", l.get(4));
-		assertEquals("harald", l.get(5));
-	}
-
-	@SuppressWarnings("unchecked")
+        List<E> l = makeObject();
+        l.add((E) "hugo");
+        l.add((E) "erna");
+        l.add((E) "daniel");
+        l.add((E) "andres");
+        l.add((E) "harald");
+        l.add(0, null);
+        assertEquals(null, l.get(0));
+        assertEquals("hugo", l.get(1));
+        assertEquals("erna", l.get(2));
+        assertEquals("daniel", l.get(3));
+        assertEquals("andres", l.get(4));
+        assertEquals("harald", l.get(5));
+    }
+
+    @SuppressWarnings("unchecked")
     public void testRemove() {
         List<E> l = makeObject();
         l.add((E) "hugo");
@@ -136,44 +136,44 @@ public class TestTreeList<E> extends AbstractTestList<E> {
         l.add((E) "andres");
         l.add((E) "harald");
         l.add(0, null);
-		int i = 0;
-		assertEquals(null, l.get(i++));
-		assertEquals("hugo", l.get(i++));
-		assertEquals("erna", l.get(i++));
-		assertEquals("daniel", l.get(i++));
-		assertEquals("andres", l.get(i++));
-		assertEquals("harald", l.get(i++));
-
-		l.remove(0);
-		i = 0;
-		assertEquals("hugo", l.get(i++));
-		assertEquals("erna", l.get(i++));
-		assertEquals("daniel", l.get(i++));
-		assertEquals("andres", l.get(i++));
-		assertEquals("harald", l.get(i++));
-
-		i = 0;
-		l.remove(1);
-		assertEquals("hugo", l.get(i++));
-		assertEquals("daniel", l.get(i++));
-		assertEquals("andres", l.get(i++));
-		assertEquals("harald", l.get(i++));
-
-		i = 0;
-		l.remove(2);
-		assertEquals("hugo", l.get(i++));
-		assertEquals("daniel", l.get(i++));
-		assertEquals("harald", l.get(i++));
-	}
-
-	@SuppressWarnings("unchecked")
+        int i = 0;
+        assertEquals(null, l.get(i++));
+        assertEquals("hugo", l.get(i++));
+        assertEquals("erna", l.get(i++));
+        assertEquals("daniel", l.get(i++));
+        assertEquals("andres", l.get(i++));
+        assertEquals("harald", l.get(i++));
+
+        l.remove(0);
+        i = 0;
+        assertEquals("hugo", l.get(i++));
+        assertEquals("erna", l.get(i++));
+        assertEquals("daniel", l.get(i++));
+        assertEquals("andres", l.get(i++));
+        assertEquals("harald", l.get(i++));
+
+        i = 0;
+        l.remove(1);
+        assertEquals("hugo", l.get(i++));
+        assertEquals("daniel", l.get(i++));
+        assertEquals("andres", l.get(i++));
+        assertEquals("harald", l.get(i++));
+
+        i = 0;
+        l.remove(2);
+        assertEquals("hugo", l.get(i++));
+        assertEquals("daniel", l.get(i++));
+        assertEquals("harald", l.get(i++));
+    }
+
+    @SuppressWarnings("unchecked")
     public void testInsertBefore() {
         List<E> l = makeObject();
         l.add((E) "erna");
         l.add(0, (E) "hugo");
-		assertEquals("hugo", l.get(0));
-		assertEquals("erna", l.get(1));
-	}
+        assertEquals("hugo", l.get(0));
+        assertEquals("erna", l.get(1));
+    }
 
     @SuppressWarnings("unchecked")
     public void testIndexOf() {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/map/TestAll.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestAll.java b/src/test/org/apache/commons/collections/map/TestAll.java
index 7df3d66..711b089 100644
--- a/src/test/org/apache/commons/collections/map/TestAll.java
+++ b/src/test/org/apache/commons/collections/map/TestAll.java
@@ -33,7 +33,7 @@ import org.junit.runners.Suite.SuiteClasses;
  */
 @RunWith(Suite.class)
 @SuiteClasses({
-	TestCaseInsensitiveMap.class,
+    TestCaseInsensitiveMap.class,
     TestCompositeMap.class,
     TestDefaultedMap.class,
     TestFlat3Map.class,

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/map/TestLazyMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestLazyMap.java b/src/test/org/apache/commons/collections/map/TestLazyMap.java
index c7042b2..1e51a3f 100644
--- a/src/test/org/apache/commons/collections/map/TestLazyMap.java
+++ b/src/test/org/apache/commons/collections/map/TestLazyMap.java
@@ -37,7 +37,7 @@ import org.junit.Test;
  */
 public class TestLazyMap<K, V> extends AbstractTestIterableMap<K, V> {
 
-	private static final Factory<Integer> oneFactory = FactoryUtils.constantFactory(1);
+    private static final Factory<Integer> oneFactory = FactoryUtils.constantFactory(1);
 
     public TestLazyMap(String testName) {
         super(testName);
@@ -49,14 +49,14 @@ public class TestLazyMap<K, V> extends AbstractTestIterableMap<K, V> {
     }
 
     @Override
-	public LazyMap<K,V> makeObject() {
+    public LazyMap<K,V> makeObject() {
         return getLazyMap(new HashMap<K,V>(), FactoryUtils.<V>nullFactory());
     }
 
     //-----------------------------------------------------------------------
     @Override
     public void testMapGet() {
-    	//TODO eliminate need for this via superclass - see svn history.
+        //TODO eliminate need for this via superclass - see svn history.
     }
 
     @Test
@@ -79,21 +79,21 @@ public class TestLazyMap<K, V> extends AbstractTestIterableMap<K, V> {
 
     @Test
     public void mapGetWithTransformer() {
-    	Transformer<Number, Integer> intConverter = new Transformer<Number, Integer>(){
-			public Integer transform(Number input) {
-				return input.intValue();
-			}
-    	};
-		Map<Long, Number> map = getLazyMap(new HashMap<Long,Number>(), intConverter );
-    	assertEquals(0, map.size());
-    	Number i1 = map.get(123L);
-    	assertEquals(123, i1);
-    	assertEquals(1, map.size());
+        Transformer<Number, Integer> intConverter = new Transformer<Number, Integer>(){
+            public Integer transform(Number input) {
+                return input.intValue();
+            }
+        };
+        Map<Long, Number> map = getLazyMap(new HashMap<Long,Number>(), intConverter );
+        assertEquals(0, map.size());
+        Number i1 = map.get(123L);
+        assertEquals(123, i1);
+        assertEquals(1, map.size());
     }
 
 
     @Override
-	public String getCompatibilityVersion() {
+    public String getCompatibilityVersion() {
         return "3.1";
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/map/TestLazySortedMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestLazySortedMap.java b/src/test/org/apache/commons/collections/map/TestLazySortedMap.java
index c4841c4..02ca1d4 100644
--- a/src/test/org/apache/commons/collections/map/TestLazySortedMap.java
+++ b/src/test/org/apache/commons/collections/map/TestLazySortedMap.java
@@ -40,7 +40,7 @@ import org.junit.Test;
  */
 public class TestLazySortedMap<K, V> extends AbstractTestSortedMap<K, V> {
     
-	private static final Factory<Integer> oneFactory = FactoryUtils.constantFactory(1);
+    private static final Factory<Integer> oneFactory = FactoryUtils.constantFactory(1);
    
     public TestLazySortedMap(String testName) {
         super(testName);
@@ -52,18 +52,18 @@ public class TestLazySortedMap<K, V> extends AbstractTestSortedMap<K, V> {
     }
 
     @Override
-	public SortedMap<K,V> makeObject() {
+    public SortedMap<K,V> makeObject() {
         return getLazySortedMap(new TreeMap<K,V>(), FactoryUtils.<V>nullFactory());
     }
     
     @Override
-	public boolean isSubMapViewsSerializable() {
+    public boolean isSubMapViewsSerializable() {
         // TODO TreeMap sub map views have a bug in deserialization.
         return false;
     }
 
     @Override
-	public boolean isAllowNullKey() {
+    public boolean isAllowNullKey() {
         return false;
     }
 
@@ -71,7 +71,7 @@ public class TestLazySortedMap<K, V> extends AbstractTestSortedMap<K, V> {
     //-----------------------------------------------------------------------
     @Override
     public void testMapGet() {
-    	//TODO eliminate need for this via superclass - see svn history.
+        //TODO eliminate need for this via superclass - see svn history.
     }
     
     @Test
@@ -128,7 +128,7 @@ public class TestLazySortedMap<K, V> extends AbstractTestSortedMap<K, V> {
     }
     
     @Override
-	public String getCompatibilityVersion() {
+    public String getCompatibilityVersion() {
         return "3.1";
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/splitmap/TestAll.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/splitmap/TestAll.java b/src/test/org/apache/commons/collections/splitmap/TestAll.java
index c3e54a4..005b1f2 100644
--- a/src/test/org/apache/commons/collections/splitmap/TestAll.java
+++ b/src/test/org/apache/commons/collections/splitmap/TestAll.java
@@ -36,7 +36,7 @@ import org.junit.runners.Suite.SuiteClasses;
 @RunWith(Suite.class)
 @SuiteClasses({
     TestSplitMapUtils.class,
-	TestTransformedMap.class
+    TestTransformedMap.class
 })
 public class TestAll extends TestCase {
 }


[56/77] [abbrv] commons-collections git commit: comments

Posted by ch...@apache.org.
comments

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@751901 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/da23d709
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/da23d709
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/da23d709

Branch: refs/heads/collections_jdk5_branch
Commit: da23d7095cdfc22e860c653f6266eaa969fbad93
Parents: 87ac939
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Mon Mar 9 23:06:49 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Mon Mar 9 23:06:49 2009 +0000

----------------------------------------------------------------------
 .../collections/splitmap/TransformedMap.java    | 38 +++++++++++++-------
 1 file changed, 25 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/da23d709/src/java/org/apache/commons/collections/splitmap/TransformedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/splitmap/TransformedMap.java b/src/java/org/apache/commons/collections/splitmap/TransformedMap.java
index 4ef627f..88e309c 100644
--- a/src/java/org/apache/commons/collections/splitmap/TransformedMap.java
+++ b/src/java/org/apache/commons/collections/splitmap/TransformedMap.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.
@@ -22,6 +22,7 @@ import java.io.ObjectOutputStream;
 import java.io.Serializable;
 import java.util.Map;
 
+import org.apache.commons.collections.Get;
 import org.apache.commons.collections.Put;
 import org.apache.commons.collections.Transformer;
 import org.apache.commons.collections.map.LinkedMap;
@@ -40,11 +41,22 @@ import org.apache.commons.collections.map.LinkedMap;
  * is to wrap this map using {@link java.util.Collections#synchronizedMap(Map)}.
  * This class may throw exceptions when accessed by concurrent threads without
  * synchronization.
- * 
+ * <p>
+ * The "put" and "get" type constraints of this class are mutually independent;
+ * contrast with {@link org.apache.commons.collections.map.TransformedMap} which,
+ * by virtue of its implementing {@link Map}&lt;K, V&gt;, must be constructed in such
+ * a way that its read and write parameters are generalized to a common (super-)type.
+ * In practice this would often mean <code>&gt;Object, Object&gt;</code>, defeating
+ * much of the usefulness of having parameterized types.
+ * <p>
+ * On the downside, this class is not a drop-in replacement for {@link java.util.Map}
+ * but is intended to be worked with either directly or by {@link Put} and {@link Get}
+ * generalizations.
+ *
  * @since Commons Collections 5
  * @TODO fix version
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Matt Benson
  */
@@ -66,7 +78,7 @@ public class TransformedMap<J, K, U, V> extends AbstractIterableGetMapDecorator<
      * <p>
      * If there are any elements already in the map being decorated, they are
      * NOT transformed.
-     * 
+     *
      * @param map the map to decorate, must not be null
      * @param keyTransformer the transformer to use for key conversion, null
      * means no transformation
@@ -86,7 +98,7 @@ public class TransformedMap<J, K, U, V> extends AbstractIterableGetMapDecorator<
      * <p>
      * If there are any elements already in the collection being decorated, they
      * are NOT transformed.
-     * 
+     *
      * @param map the map to decorate, must not be null
      * @param keyTransformer the transformer to use for key conversion, null
      * means no conversion
@@ -110,7 +122,7 @@ public class TransformedMap<J, K, U, V> extends AbstractIterableGetMapDecorator<
     //-----------------------------------------------------------------------
     /**
      * Write the map out using a custom routine.
-     * 
+     *
      * @param out the output stream
      * @throws IOException
      */
@@ -121,7 +133,7 @@ public class TransformedMap<J, K, U, V> extends AbstractIterableGetMapDecorator<
 
     /**
      * Read the map in using a custom routine.
-     * 
+     *
      * @param in the input stream
      * @throws IOException
      * @throws ClassNotFoundException
@@ -138,7 +150,7 @@ public class TransformedMap<J, K, U, V> extends AbstractIterableGetMapDecorator<
      * Transforms a key.
      * <p>
      * The transformer itself may throw an exception if necessary.
-     * 
+     *
      * @param object the object to transform
      * @throws the transformed object
      */
@@ -150,7 +162,7 @@ public class TransformedMap<J, K, U, V> extends AbstractIterableGetMapDecorator<
      * Transforms a value.
      * <p>
      * The transformer itself may throw an exception if necessary.
-     * 
+     *
      * @param object the object to transform
      * @throws the transformed object
      */
@@ -162,7 +174,7 @@ public class TransformedMap<J, K, U, V> extends AbstractIterableGetMapDecorator<
      * Transforms a map.
      * <p>
      * The transformer itself may throw an exception if necessary.
-     * 
+     *
      * @param map the map to transform
      * @throws the transformed object
      */
@@ -181,7 +193,7 @@ public class TransformedMap<J, K, U, V> extends AbstractIterableGetMapDecorator<
 
     /**
      * Override to transform the value when using <code>setValue</code>.
-     * 
+     *
      * @param value the value to transform
      * @return the transformed value
      */
@@ -204,5 +216,5 @@ public class TransformedMap<J, K, U, V> extends AbstractIterableGetMapDecorator<
         decorated().putAll(transformMap(mapToCopy));
     }
 
-    
+
 }


[53/77] [abbrv] commons-collections git commit: implement OrderedIterator (subset of ListIterator)

Posted by ch...@apache.org.
implement OrderedIterator (subset of ListIterator)

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@751888 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/7cb8edcf
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/7cb8edcf
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/7cb8edcf

Branch: refs/heads/collections_jdk5_branch
Commit: 7cb8edcf895ee4c2a54eb4b978ddb0d051eef930
Parents: 3338e25
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Mon Mar 9 22:42:14 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Mon Mar 9 22:42:14 2009 +0000

----------------------------------------------------------------------
 .../org/apache/commons/collections/ResettableListIterator.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/7cb8edcf/src/java/org/apache/commons/collections/ResettableListIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/ResettableListIterator.java b/src/java/org/apache/commons/collections/ResettableListIterator.java
index 3484737..deffb6a 100644
--- a/src/java/org/apache/commons/collections/ResettableListIterator.java
+++ b/src/java/org/apache/commons/collections/ResettableListIterator.java
@@ -29,6 +29,6 @@ import java.util.ListIterator;
  * 
  * @author Stephen Colebourne
  */
-public interface ResettableListIterator<E> extends ListIterator<E>, ResettableIterator<E> {
+public interface ResettableListIterator<E> extends ListIterator<E>, ResettableIterator<E>, OrderedIterator<E> {
 
 }


[35/77] [abbrv] commons-collections git commit: cright

Posted by ch...@apache.org.
cright

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@738957 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/47fe5009
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/47fe5009
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/47fe5009

Branch: refs/heads/collections_jdk5_branch
Commit: 47fe5009e427cdf85b5b3b396d5e1074051115ad
Parents: 884baf0
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Thu Jan 29 18:49:15 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Thu Jan 29 18:49:15 2009 +0000

----------------------------------------------------------------------
 NOTICE.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/47fe5009/NOTICE.txt
----------------------------------------------------------------------
diff --git a/NOTICE.txt b/NOTICE.txt
index d029b27..d6d6bc9 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -1,5 +1,5 @@
 Apache Jakarta Commons Collections
-Copyright 2001-2006 The Apache Software Foundation
+Copyright 2001-2009 The Apache Software Foundation
 
 This product includes software developed by
 The Apache Software Foundation (http://www.apache.org/).


[30/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/bidimap/TreeBidiMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bidimap/TreeBidiMap.java b/src/java/org/apache/commons/collections/bidimap/TreeBidiMap.java
index 08684f9..b1192fd 100644
--- a/src/java/org/apache/commons/collections/bidimap/TreeBidiMap.java
+++ b/src/java/org/apache/commons/collections/bidimap/TreeBidiMap.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,7 +24,6 @@ import java.util.Map;
 import java.util.NoSuchElementException;
 import java.util.Set;
 
-import org.apache.commons.collections.BidiMap;
 import org.apache.commons.collections.KeyValue;
 import org.apache.commons.collections.MapIterator;
 import org.apache.commons.collections.OrderedBidiMap;
@@ -32,6 +31,7 @@ import org.apache.commons.collections.OrderedIterator;
 import org.apache.commons.collections.OrderedMapIterator;
 import org.apache.commons.collections.iterators.EmptyOrderedMapIterator;
 import org.apache.commons.collections.keyvalue.UnmodifiableMapEntry;
+import static org.apache.commons.collections.bidimap.TreeBidiMap.DataElement.*;
 
 /**
  * Red-Black tree-based implementation of BidiMap where all objects added
@@ -69,35 +69,50 @@ import org.apache.commons.collections.keyvalue.UnmodifiableMapEntry;
  *
  * @since Commons Collections 3.0 (previously DoubleOrderedMap v2.0)
  * @version $Revision$ $Date$
- * 
+ *
  * @author Marc Johnson
  * @author Stephen Colebourne
+ * @author Matt Benson
  */
-public class TreeBidiMap implements OrderedBidiMap {
-
-    private static final int KEY = 0;
-    private static final int VALUE = 1;
-    private static final int MAPENTRY = 2;
-    private static final int INVERSEMAPENTRY = 3;
-    private static final int SUM_OF_INDICES = KEY + VALUE;
-    private static final int FIRST_INDEX = 0;
-    private static final int NUMBER_OF_INDICES = 2;
-    private static final String[] dataName = new String[] { "key", "value" };
-    
-    private Node[] rootNode = new Node[2];
+public class TreeBidiMap<K extends Comparable<K>, V extends Comparable<V>> implements OrderedBidiMap<K, V> {
+
+    static enum DataElement {
+        KEY("key"), VALUE("value");
+
+        private final String description;
+
+        /**
+         * Create a new TreeBidiMap.DataElement.
+         */
+        private DataElement(String description) {
+            this.description = description;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public String toString() {
+            return description;
+        }
+    }
+
+    private Node<K, V>[] rootNode;
     private int nodeCount = 0;
     private int modifications = 0;
-    private Set keySet;
-    private Set valuesSet;
-    private Set entrySet;
-    private TreeBidiMap.Inverse inverse = null;
+    private Set<K> keySet;
+    private Set<V> valuesSet;
+    private Set<Map.Entry<K, V>> entrySet;
+    private Inverse inverse = null;
 
     //-----------------------------------------------------------------------
     /**
      * Constructs a new empty TreeBidiMap.
      */
+    @SuppressWarnings("unchecked")
     public TreeBidiMap() {
         super();
+        rootNode = new Node[2];
     }
 
     /**
@@ -108,8 +123,8 @@ public class TreeBidiMap implements OrderedBidiMap {
      *  not Comparable or are not mutually comparable
      * @throws NullPointerException if any key or value in the map is null
      */
-    public TreeBidiMap(final Map map) {
-        super();
+    public TreeBidiMap(final Map<K, V> map) {
+        this();
         putAll(map);
     }
 
@@ -144,7 +159,7 @@ public class TreeBidiMap implements OrderedBidiMap {
      */
     public boolean containsKey(final Object key) {
         checkKey(key);
-        return (lookup((Comparable) key, KEY) != null);
+        return (lookupKey(key) != null);
     }
 
     /**
@@ -159,7 +174,7 @@ public class TreeBidiMap implements OrderedBidiMap {
      */
     public boolean containsValue(final Object value) {
         checkValue(value);
-        return (lookup((Comparable) value, VALUE) != null);
+        return (lookupValue(value) != null);
     }
 
     /**
@@ -174,8 +189,10 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @throws ClassCastException if the key is of an inappropriate type
      * @throws NullPointerException if the key is null
      */
-    public Object get(final Object key) {
-        return doGet((Comparable) key, KEY);
+    public V get(final Object key) {
+        checkKey(key);
+        Node<K, V> node = lookupKey(key);
+        return node == null ? null : node.getValue();
     }
 
     /**
@@ -188,7 +205,7 @@ public class TreeBidiMap implements OrderedBidiMap {
      *  BidiMap map1 = new TreeBidiMap();
      *  map.put("A","B");  // contains A mapped to B, as per Map
      *  map.put("A","C");  // contains A mapped to C, as per Map
-     * 
+     *
      *  BidiMap map2 = new TreeBidiMap();
      *  map.put("A","B");  // contains A mapped to B, as per Map
      *  map.put("C","B");  // contains C mapped to B, key A is removed
@@ -202,25 +219,25 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @throws ClassCastException if the key is of an inappropriate type
      * @throws NullPointerException if the key is null
      */
-    public Object put(final Object key, final Object value) {
-        return doPut((Comparable) key, (Comparable) value, KEY);
+    public V put(final K key, final V value) {
+        V result = get(key);
+        doPut(key, value);
+        return result;
     }
 
     /**
      * Puts all the mappings from the specified map into this map.
      * <p>
      * All keys and values must implement <code>Comparable</code>.
-     * 
+     *
      * @param map  the map to copy from
      */
-    public void putAll(Map map) {
-        Iterator it = map.entrySet().iterator();
-        while (it.hasNext()) {
-            Map.Entry entry = (Map.Entry) it.next();
-            put(entry.getKey(), entry.getValue());
+    public void putAll(Map<? extends K, ? extends V> map) {
+        for (Map.Entry<? extends K, ? extends V> e : map.entrySet()) {
+            put(e.getKey(), e.getValue());
         }
     }
-        
+
     /**
      * Removes the mapping for this key from this map if present.
      * <p>
@@ -232,8 +249,8 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @throws ClassCastException if the key is of an inappropriate type
      * @throws NullPointerException if the key is null
      */
-    public Object remove(final Object key) {
-        return doRemove((Comparable) key, KEY);
+    public V remove(final Object key) {
+        return doRemoveKey(key);
     }
 
     /**
@@ -243,8 +260,8 @@ public class TreeBidiMap implements OrderedBidiMap {
         modify();
 
         nodeCount = 0;
-        rootNode[KEY] = null;
-        rootNode[VALUE] = null;
+        rootNode[KEY.ordinal()] = null;
+        rootNode[VALUE.ordinal()] = null;
     }
 
     //-----------------------------------------------------------------------
@@ -260,8 +277,10 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @throws ClassCastException if the value is of an inappropriate type
      * @throws NullPointerException if the value is null
      */
-    public Object getKey(final Object value) {
-        return doGet((Comparable) value, VALUE);
+    public K getKey(final Object value) {
+        checkValue(value);
+        Node<K, V> node = lookupValue(value);
+        return node == null ? null : node.getKey();
     }
 
     /**
@@ -275,8 +294,8 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @throws ClassCastException if the value is of an inappropriate type
      * @throws NullPointerException if the value is null
      */
-    public Object removeValue(final Object value) {
-        return doRemove((Comparable) value, VALUE);
+    public K removeValue(final Object value) {
+        return doRemoveValue(value);
     }
 
     //-----------------------------------------------------------------------
@@ -286,11 +305,11 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @return the first (lowest) key currently in this sorted map
      * @throws NoSuchElementException if this map is empty
      */
-    public Object firstKey() {
+    public K firstKey() {
         if (nodeCount == 0) {
             throw new NoSuchElementException("Map is empty");
         }
-        return leastNode(rootNode[KEY], KEY).getKey();
+        return leastNode(rootNode[KEY.ordinal()], KEY).getKey();
     }
 
     /**
@@ -299,13 +318,13 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @return the last (highest) key currently in this sorted map
      * @throws NoSuchElementException if this map is empty
      */
-    public Object lastKey() {
+    public K lastKey() {
         if (nodeCount == 0) {
             throw new NoSuchElementException("Map is empty");
         }
-        return greatestNode(rootNode[KEY], KEY).getKey();
+        return greatestNode(rootNode[KEY.ordinal()], KEY).getKey();
     }
-    
+
     /**
      * Gets the next key after the one specified.
      * <p>
@@ -314,10 +333,10 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @param key the key to search for next from
      * @return the next key, null if no match or at end
      */
-    public Object nextKey(Object key) {
+    public K nextKey(K key) {
         checkKey(key);
-        Node node = nextGreater(lookup((Comparable) key, KEY), KEY);
-        return (node == null ? null : node.getKey());
+        Node<K, V> node = nextGreater(lookupKey(key), KEY);
+        return node == null ? null : node.getKey();
     }
 
     /**
@@ -328,12 +347,12 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @param key the key to search for previous from
      * @return the previous key, null if no match or at start
      */
-    public Object previousKey(Object key) {
+    public K previousKey(K key) {
         checkKey(key);
-        Node node = nextSmaller(lookup((Comparable) key, KEY), KEY);
-        return (node == null ? null : node.getKey());
+        Node<K, V> node = nextSmaller(lookupKey(key), KEY);
+        return node == null ? null : node.getKey();
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Returns a set view of the keys contained in this map in key order.
@@ -347,9 +366,9 @@ public class TreeBidiMap implements OrderedBidiMap {
      *
      * @return a set view of the keys contained in this map.
      */
-    public Set keySet() {
+    public Set<K> keySet() {
         if (keySet == null) {
-            keySet = new View(this, KEY, KEY);
+            keySet = new KeyView(KEY);
         }
         return keySet;
     }
@@ -368,9 +387,9 @@ public class TreeBidiMap implements OrderedBidiMap {
      *
      * @return a set view of the values contained in this map.
      */
-    public Collection values() {
+    public Collection<V> values() {
         if (valuesSet == null) {
-            valuesSet = new View(this, KEY, VALUE);
+            valuesSet = new ValueView(KEY);
         }
         return valuesSet;
     }
@@ -390,60 +409,33 @@ public class TreeBidiMap implements OrderedBidiMap {
      *
      * @return a set view of the values contained in this map.
      */
-    public Set entrySet() {
+    public Set<Map.Entry<K, V>> entrySet() {
         if (entrySet == null) {
-            return new EntryView(this, KEY, MAPENTRY);
+            return new EntryView();
         }
         return entrySet;
     }
 
     //-----------------------------------------------------------------------
     /**
-     * Gets an iterator over the map entries.
-     * <p>
-     * For this map, this iterator is the fastest way to iterate over the entries.
-     * 
-     * @return an iterator
+     * {@inheritDoc}
      */
-    public MapIterator mapIterator() {
+    public OrderedMapIterator<K, V> mapIterator() {
         if (isEmpty()) {
-            return EmptyOrderedMapIterator.INSTANCE;
+            return EmptyOrderedMapIterator.<K, V>getInstance();
         }
-        return new ViewMapIterator(this, KEY);
-    }
-
-    /**
-     * Gets an ordered iterator over the map entries.
-     * <p>
-     * This iterator allows both forward and reverse iteration over the entries.
-     * 
-     * @return an iterator
-     */
-    public OrderedMapIterator orderedMapIterator() {
-        if (isEmpty()) {
-            return EmptyOrderedMapIterator.INSTANCE;
-        }
-        return new ViewMapIterator(this, KEY);
+        return new ViewMapIterator(KEY);
     }
 
     //-----------------------------------------------------------------------
     /**
      * Gets the inverse map for comparison.
-     * 
-     * @return the inverse map
-     */
-    public BidiMap inverseBidiMap() {
-        return inverseOrderedBidiMap();
-    }
-
-    /**
-     * Gets the inverse map for comparison.
-     * 
+     *
      * @return the inverse map
      */
-    public OrderedBidiMap inverseOrderedBidiMap() {
+    public OrderedBidiMap<V, K> inverseBidiMap() {
         if (inverse == null) {
-            inverse = new Inverse(this);
+            inverse = new Inverse();
         }
         return inverse;
     }
@@ -458,7 +450,7 @@ public class TreeBidiMap implements OrderedBidiMap {
     public boolean equals(Object obj) {
         return this.doEquals(obj, KEY);
     }
-    
+
     /**
      * Gets the hash code value for this map as per the API.
      *
@@ -467,61 +459,43 @@ public class TreeBidiMap implements OrderedBidiMap {
     public int hashCode() {
         return this.doHashCode(KEY);
     }
-    
+
     /**
      * Returns a string version of this Map in standard format.
-     * 
+     *
      * @return a standard format string version of the map
      */
     public String toString() {
         return this.doToString(KEY);
     }
-    
+
     //-----------------------------------------------------------------------
     /**
-     * Common get logic, used to get by key or get by value
+     * Put logic.
      *
-     * @param obj  the key or value that we're looking for
-     * @param index  the KEY or VALUE int
-     * @return the key (if the value was mapped) or the value (if the
-     *         key was mapped); null if we couldn't find the specified
-     *         object
-     */
-    private Object doGet(final Comparable obj, final int index) {
-        checkNonNullComparable(obj, index);
-        Node node = lookup(obj, index);
-        return ((node == null) ? null : node.getData(oppositeIndex(index)));
-    }
-
-    /**
-     * Common put logic, differing only in the return value.
-     * 
      * @param key  the key, always the main map key
      * @param value  the value, always the main map value
-     * @param index  the KEY or VALUE int, for the return value only
-     * @return the previously mapped value
      */
-    private Object doPut(final Comparable key, final Comparable value, final int index) {
+    private void doPut(final K key, final V value) {
         checkKeyAndValue(key, value);
-        
+
         // store previous and remove previous mappings
-        Object prev = (index == KEY ? doGet(key, KEY) :  doGet(value, VALUE));
-        doRemove(key, KEY);
-        doRemove(value, VALUE);
-        
-        Node node = rootNode[KEY];
+        doRemoveKey(key);
+        doRemoveValue(value);
+
+        Node<K, V> node = rootNode[KEY.ordinal()];
         if (node == null) {
             // map is empty
-            Node root = new Node(key, value);
-            rootNode[KEY] = root;
-            rootNode[VALUE] = root;
+            Node<K, V> root = new Node<K, V>(key, value);
+            rootNode[KEY.ordinal()] = root;
+            rootNode[VALUE.ordinal()] = root;
             grow();
-            
+
         } else {
             // add new mapping
             while (true) {
-                int cmp = compare(key, node.getData(KEY));
-        
+                int cmp = compare(key, node.getKey());
+
                 if (cmp == 0) {
                     // shouldn't happen
                     throw new IllegalArgumentException("Cannot store a duplicate key (\"" + key + "\") in this Map");
@@ -529,54 +503,51 @@ public class TreeBidiMap implements OrderedBidiMap {
                     if (node.getLeft(KEY) != null) {
                         node = node.getLeft(KEY);
                     } else {
-                        Node newNode = new Node(key, value);
-        
+                        Node<K, V> newNode = new Node<K, V>(key, value);
+
                         insertValue(newNode);
                         node.setLeft(newNode, KEY);
                         newNode.setParent(node, KEY);
                         doRedBlackInsert(newNode, KEY);
                         grow();
-        
+
                         break;
                     }
                 } else { // cmp > 0
                     if (node.getRight(KEY) != null) {
                         node = node.getRight(KEY);
                     } else {
-                        Node newNode = new Node(key, value);
-        
+                        Node<K, V> newNode = new Node<K, V>(key, value);
+
                         insertValue(newNode);
                         node.setRight(newNode, KEY);
                         newNode.setParent(node, KEY);
                         doRedBlackInsert(newNode, KEY);
                         grow();
-        
+
                         break;
                     }
                 }
             }
         }
-        return prev;
     }
 
-    /**
-     * Remove by object (remove by key or remove by value)
-     *
-     * @param o the key, or value, that we're looking for
-     * @param index  the KEY or VALUE int
-     *
-     * @return the key, if remove by value, or the value, if remove by
-     *         key. null if the specified key or value could not be
-     *         found
-     */
-    private Object doRemove(final Comparable o, final int index) {
-        Node node = lookup(o, index);
-        Object rval = null;
-        if (node != null) {
-            rval = node.getData(oppositeIndex(index));
-            doRedBlackDelete(node);
+    private V doRemoveKey(Object key) {
+        Node<K, V> node = lookupKey(key);
+        if (node == null) {
+            return null;
         }
-        return rval;
+        doRedBlackDelete(node);
+        return node.getValue();
+    }
+
+    private K doRemoveValue(Object value) {
+        Node<K, V> node = lookupValue(value);
+        if (node == null) {
+            return null;
+        }
+        doRedBlackDelete(node);
+        return node.getKey();
     }
 
     /**
@@ -587,23 +558,32 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @return the desired Node, or null if there is no mapping of the
      *         specified data
      */
-    private Node lookup(final Comparable data, final int index) {
-        Node rval = null;
-        Node node = rootNode[index];
+    @SuppressWarnings("unchecked")
+    private <T extends Comparable<T>> Node<K, V> lookup(final Object data, final DataElement dataElement) {
+        Node<K, V> rval = null;
+        Node<K, V> node = rootNode[dataElement.ordinal()];
 
         while (node != null) {
-            int cmp = compare(data, node.getData(index));
+            int cmp = compare((T) data, (T) node.getData(dataElement));
             if (cmp == 0) {
                 rval = node;
                 break;
             } else {
-                node = (cmp < 0) ? node.getLeft(index) : node.getRight(index);
+                node = (cmp < 0) ? node.getLeft(dataElement) : node.getRight(dataElement);
             }
         }
 
         return rval;
     }
 
+    private Node<K, V> lookupKey(Object key) {
+        return this.<K>lookup(key, KEY);
+    }
+
+    private Node<K, V> lookupValue(Object value) {
+        return this.<V>lookup(value, VALUE);
+    }
+
     /**
      * get the next larger node from the specified node
      *
@@ -611,14 +591,14 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @param index  the KEY or VALUE int
      * @return the specified node
      */
-    private Node nextGreater(final Node node, final int index) {
-        Node rval = null;
+    private Node<K, V> nextGreater(final Node<K, V> node, final DataElement dataElement) {
+        Node<K, V> rval = null;
         if (node == null) {
             rval = null;
-        } else if (node.getRight(index) != null) {
+        } else if (node.getRight(dataElement) != null) {
             // everything to the node's right is larger. The least of
             // the right node's descendants is the next larger node
-            rval = leastNode(node.getRight(index), index);
+            rval = leastNode(node.getRight(dataElement), dataElement);
         } else {
             // traverse up our ancestry until we find an ancestor that
             // is null or one whose left child is our ancestor. If we
@@ -626,12 +606,12 @@ public class TreeBidiMap implements OrderedBidiMap {
             // tree, and there is no greater node. Otherwise, we are
             // the largest node in the subtree on that ancestor's left
             // ... and that ancestor is the next greatest node
-            Node parent = node.getParent(index);
-            Node child = node;
+            Node<K, V> parent = node.getParent(dataElement);
+            Node<K, V> child = node;
 
-            while ((parent != null) && (child == parent.getRight(index))) {
+            while ((parent != null) && (child == parent.getRight(dataElement))) {
                 child = parent;
-                parent = parent.getParent(index);
+                parent = parent.getParent(dataElement);
             }
             rval = parent;
         }
@@ -645,14 +625,14 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @param index  the KEY or VALUE int
      * @return the specified node
      */
-    private Node nextSmaller(final Node node, final int index) {
-        Node rval = null;
+    private Node<K, V> nextSmaller(final Node<K, V> node, final DataElement dataElement) {
+        Node<K, V> rval = null;
         if (node == null) {
             rval = null;
-        } else if (node.getLeft(index) != null) {
+        } else if (node.getLeft(dataElement) != null) {
             // everything to the node's left is smaller. The greatest of
             // the left node's descendants is the next smaller node
-            rval = greatestNode(node.getLeft(index), index);
+            rval = greatestNode(node.getLeft(dataElement), dataElement);
         } else {
             // traverse up our ancestry until we find an ancestor that
             // is null or one whose right child is our ancestor. If we
@@ -660,12 +640,12 @@ public class TreeBidiMap implements OrderedBidiMap {
             // tree, and there is no greater node. Otherwise, we are
             // the largest node in the subtree on that ancestor's right
             // ... and that ancestor is the next greatest node
-            Node parent = node.getParent(index);
-            Node child = node;
+            Node<K, V> parent = node.getParent(dataElement);
+            Node<K, V> child = node;
 
-            while ((parent != null) && (child == parent.getLeft(index))) {
+            while ((parent != null) && (child == parent.getLeft(dataElement))) {
                 child = parent;
-                parent = parent.getParent(index);
+                parent = parent.getParent(dataElement);
             }
             rval = parent;
         }
@@ -673,18 +653,6 @@ public class TreeBidiMap implements OrderedBidiMap {
     }
 
     //-----------------------------------------------------------------------
-    /**
-     * Get the opposite index of the specified index
-     *
-     * @param index  the KEY or VALUE int
-     * @return VALUE (if KEY was specified), else KEY
-     */
-    private static int oppositeIndex(final int index) {
-        // old trick ... to find the opposite of a value, m or n,
-        // subtract the value from the sum of the two possible
-        // values. (m + n) - m = n; (m + n) - n = m
-        return SUM_OF_INDICES - index;
-    }
 
     /**
      * Compare two objects
@@ -695,7 +663,7 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @return negative value if o1 &lt; o2; 0 if o1 == o2; positive
      *         value if o1 &gt; o2
      */
-    private static int compare(final Comparable o1, final Comparable o2) {
+    private static <T extends Comparable<T>> int compare(final T o1, final T o2) {
         return o1.compareTo(o2);
     }
 
@@ -707,11 +675,11 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @return the smallest node, from the specified node, in the
      *         specified mapping
      */
-    private static Node leastNode(final Node node, final int index) {
-        Node rval = node;
+    private Node<K, V> leastNode(final Node<K, V> node, final DataElement dataElement) {
+        Node<K, V> rval = node;
         if (rval != null) {
-            while (rval.getLeft(index) != null) {
-                rval = rval.getLeft(index);
+            while (rval.getLeft(dataElement) != null) {
+                rval = rval.getLeft(dataElement);
             }
         }
         return rval;
@@ -724,11 +692,11 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @param index  the KEY or VALUE int
      * @return the greatest node, from the specified node
      */
-    private static Node greatestNode(final Node node, final int index) {
-        Node rval = node;
+    private Node<K, V> greatestNode(final Node<K, V> node, final DataElement dataElement) {
+        Node<K, V> rval = node;
         if (rval != null) {
-            while (rval.getRight(index) != null) {
-                rval = rval.getRight(index);
+            while (rval.getRight(dataElement) != null) {
+                rval = rval.getRight(dataElement);
             }
         }
         return rval;
@@ -742,13 +710,13 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @param to the node whose color we're changing; may be null
      * @param index  the KEY or VALUE int
      */
-    private static void copyColor(final Node from, final Node to, final int index) {
+    private void copyColor(final Node<K, V> from, final Node<K, V> to, final DataElement dataElement) {
         if (to != null) {
             if (from == null) {
                 // by default, make it black
-                to.setBlack(index);
+                to.setBlack(dataElement);
             } else {
-                to.copyColor(from, index);
+                to.copyColor(from, dataElement);
             }
         }
     }
@@ -760,8 +728,8 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @param node the node (may be null) in question
      * @param index  the KEY or VALUE int
      */
-    private static boolean isRed(final Node node, final int index) {
-        return ((node == null) ? false : node.isRed(index));
+    private static boolean isRed(final Node<?, ?> node, final DataElement dataElement) {
+        return node != null && node.isRed(dataElement);
     }
 
     /**
@@ -771,8 +739,8 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @param node the node (may be null) in question
      * @param index  the KEY or VALUE int
      */
-    private static boolean isBlack(final Node node, final int index) {
-        return ((node == null) ? true : node.isBlack(index));
+    private static boolean isBlack(final Node<?, ?> node, final DataElement dataElement) {
+        return node == null || node.isBlack(dataElement);
     }
 
     /**
@@ -781,9 +749,9 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @param node the node (may be null) in question
      * @param index  the KEY or VALUE int
      */
-    private static void makeRed(final Node node, final int index) {
+    private static void makeRed(final Node<?, ?> node, final DataElement dataElement) {
         if (node != null) {
-            node.setRed(index);
+            node.setRed(dataElement);
         }
     }
 
@@ -793,9 +761,9 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @param node the node (may be null) in question
      * @param index  the KEY or VALUE int
      */
-    private static void makeBlack(final Node node, final int index) {
+    private static void makeBlack(final Node<?, ?> node, final DataElement dataElement) {
         if (node != null) {
-            node.setBlack(index);
+            node.setBlack(dataElement);
         }
     }
 
@@ -806,8 +774,8 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @param node the node (may be null) in question
      * @param index  the KEY or VALUE int
      */
-    private static Node getGrandParent(final Node node, final int index) {
-        return getParent(getParent(node, index), index);
+    private Node<K, V> getGrandParent(final Node<K, V> node, final DataElement dataElement) {
+        return getParent(getParent(node, dataElement), dataElement);
     }
 
     /**
@@ -817,8 +785,8 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @param node the node (may be null) in question
      * @param index  the KEY or VALUE int
      */
-    private static Node getParent(final Node node, final int index) {
-        return ((node == null) ? null : node.getParent(index));
+    private Node<K, V> getParent(final Node<K, V> node, final DataElement dataElement) {
+        return node == null ? null : node.getParent(dataElement);
     }
 
     /**
@@ -828,8 +796,8 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @param node the node (may be null) in question
      * @param index  the KEY or VALUE int
      */
-    private static Node getRightChild(final Node node, final int index) {
-        return (node == null) ? null : node.getRight(index);
+    private Node<K, V> getRightChild(final Node<K, V> node, final DataElement dataElement) {
+        return node == null ? null : node.getRight(dataElement);
     }
 
     /**
@@ -839,44 +807,8 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @param node the node (may be null) in question
      * @param index  the KEY or VALUE int
      */
-    private static Node getLeftChild(final Node node, final int index) {
-        return (node == null) ? null : node.getLeft(index);
-    }
-
-    /**
-     * is this node its parent's left child? mind you, the node, or
-     * its parent, may not exist. no problem. if the node doesn't
-     * exist ... it's its non-existent parent's left child. If the
-     * node does exist but has no parent ... no, we're not the
-     * non-existent parent's left child. Otherwise (both the specified
-     * node AND its parent exist), check.
-     *
-     * @param node the node (may be null) in question
-     * @param index  the KEY or VALUE int
-     */
-    private static boolean isLeftChild(final Node node, final int index) {
-        return (node == null)
-            ? true
-            : ((node.getParent(index) == null) ?
-                false : (node == node.getParent(index).getLeft(index)));
-    }
-
-    /**
-     * is this node its parent's right child? mind you, the node, or
-     * its parent, may not exist. no problem. if the node doesn't
-     * exist ... it's its non-existent parent's right child. If the
-     * node does exist but has no parent ... no, we're not the
-     * non-existent parent's right child. Otherwise (both the
-     * specified node AND its parent exist), check.
-     *
-     * @param node the node (may be null) in question
-     * @param index  the KEY or VALUE int
-     */
-    private static boolean isRightChild(final Node node, final int index) {
-        return (node == null)
-            ? true
-            : ((node.getParent(index) == null) ? 
-                false : (node == node.getParent(index).getRight(index)));
+    private Node<K, V> getLeftChild(final Node<K, V> node, final DataElement dataElement) {
+        return node == null ? null : node.getLeft(dataElement);
     }
 
     /**
@@ -885,26 +817,26 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @param node the node to be rotated
      * @param index  the KEY or VALUE int
      */
-    private void rotateLeft(final Node node, final int index) {
-        Node rightChild = node.getRight(index);
-        node.setRight(rightChild.getLeft(index), index);
+    private void rotateLeft(final Node<K, V> node, final DataElement dataElement) {
+        Node<K, V> rightChild = node.getRight(dataElement);
+        node.setRight(rightChild.getLeft(dataElement), dataElement);
 
-        if (rightChild.getLeft(index) != null) {
-            rightChild.getLeft(index).setParent(node, index);
+        if (rightChild.getLeft(dataElement) != null) {
+            rightChild.getLeft(dataElement).setParent(node, dataElement);
         }
-        rightChild.setParent(node.getParent(index), index);
-        
-        if (node.getParent(index) == null) {
+        rightChild.setParent(node.getParent(dataElement), dataElement);
+
+        if (node.getParent(dataElement) == null) {
             // node was the root ... now its right child is the root
-            rootNode[index] = rightChild;
-        } else if (node.getParent(index).getLeft(index) == node) {
-            node.getParent(index).setLeft(rightChild, index);
+            rootNode[dataElement.ordinal()] = rightChild;
+        } else if (node.getParent(dataElement).getLeft(dataElement) == node) {
+            node.getParent(dataElement).setLeft(rightChild, dataElement);
         } else {
-            node.getParent(index).setRight(rightChild, index);
+            node.getParent(dataElement).setRight(rightChild, dataElement);
         }
 
-        rightChild.setLeft(node, index);
-        node.setParent(rightChild, index);
+        rightChild.setLeft(node, dataElement);
+        node.setParent(rightChild, dataElement);
     }
 
     /**
@@ -913,25 +845,25 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @param node the node to be rotated
      * @param index  the KEY or VALUE int
      */
-    private void rotateRight(final Node node, final int index) {
-        Node leftChild = node.getLeft(index);
-        node.setLeft(leftChild.getRight(index), index);
-        if (leftChild.getRight(index) != null) {
-            leftChild.getRight(index).setParent(node, index);
+    private void rotateRight(final Node<K, V> node, final DataElement dataElement) {
+        Node<K, V> leftChild = node.getLeft(dataElement);
+        node.setLeft(leftChild.getRight(dataElement), dataElement);
+        if (leftChild.getRight(dataElement) != null) {
+            leftChild.getRight(dataElement).setParent(node, dataElement);
         }
-        leftChild.setParent(node.getParent(index), index);
+        leftChild.setParent(node.getParent(dataElement), dataElement);
 
-        if (node.getParent(index) == null) {
+        if (node.getParent(dataElement) == null) {
             // node was the root ... now its left child is the root
-            rootNode[index] = leftChild;
-        } else if (node.getParent(index).getRight(index) == node) {
-            node.getParent(index).setRight(leftChild, index);
+            rootNode[dataElement.ordinal()] = leftChild;
+        } else if (node.getParent(dataElement).getRight(dataElement) == node) {
+            node.getParent(dataElement).setRight(leftChild, dataElement);
         } else {
-            node.getParent(index).setLeft(leftChild, index);
+            node.getParent(dataElement).setLeft(leftChild, dataElement);
         }
 
-        leftChild.setRight(node, index);
-        node.setParent(leftChild, index);
+        leftChild.setRight(node, dataElement);
+        node.setParent(leftChild, dataElement);
     }
 
     /**
@@ -939,67 +871,69 @@ public class TreeBidiMap implements OrderedBidiMap {
      * implementation, though it's barely recognizable any more
      *
      * @param insertedNode the node to be inserted
-     * @param index  the KEY or VALUE int
+     * @param dataElement  the KEY or VALUE int
      */
-    private void doRedBlackInsert(final Node insertedNode, final int index) {
-        Node currentNode = insertedNode;
-        makeRed(currentNode, index);
+    private void doRedBlackInsert(final Node<K, V> insertedNode, final DataElement dataElement) {
+        Node<K, V> currentNode = insertedNode;
+        makeRed(currentNode, dataElement);
 
         while ((currentNode != null)
-            && (currentNode != rootNode[index])
-            && (isRed(currentNode.getParent(index), index))) {
-            if (isLeftChild(getParent(currentNode, index), index)) {
-                Node y = getRightChild(getGrandParent(currentNode, index), index);
+            && (currentNode != rootNode[dataElement.ordinal()])
+            && (isRed(currentNode.getParent(dataElement), dataElement))) {
+            if (currentNode.isLeftChild(dataElement)) {
+                Node<K, V> y = getRightChild(getGrandParent(currentNode, dataElement), dataElement);
 
-                if (isRed(y, index)) {
-                    makeBlack(getParent(currentNode, index), index);
-                    makeBlack(y, index);
-                    makeRed(getGrandParent(currentNode, index), index);
+                if (isRed(y, dataElement)) {
+                    makeBlack(getParent(currentNode, dataElement), dataElement);
+                    makeBlack(y, dataElement);
+                    makeRed(getGrandParent(currentNode, dataElement), dataElement);
 
-                    currentNode = getGrandParent(currentNode, index);
+                    currentNode = getGrandParent(currentNode, dataElement);
                 } else {
-                    if (isRightChild(currentNode, index)) {
-                        currentNode = getParent(currentNode, index);
+                    //dead code?
+                    if (currentNode.isRightChild(dataElement)) {
+                        currentNode = getParent(currentNode, dataElement);
 
-                        rotateLeft(currentNode, index);
+                        rotateLeft(currentNode, dataElement);
                     }
 
-                    makeBlack(getParent(currentNode, index), index);
-                    makeRed(getGrandParent(currentNode, index), index);
+                    makeBlack(getParent(currentNode, dataElement), dataElement);
+                    makeRed(getGrandParent(currentNode, dataElement), dataElement);
 
-                    if (getGrandParent(currentNode, index) != null) {
-                        rotateRight(getGrandParent(currentNode, index), index);
+                    if (getGrandParent(currentNode, dataElement) != null) {
+                        rotateRight(getGrandParent(currentNode, dataElement), dataElement);
                     }
                 }
             } else {
 
                 // just like clause above, except swap left for right
-                Node y = getLeftChild(getGrandParent(currentNode, index), index);
+                Node<K, V> y = getLeftChild(getGrandParent(currentNode, dataElement), dataElement);
 
-                if (isRed(y, index)) {
-                    makeBlack(getParent(currentNode, index), index);
-                    makeBlack(y, index);
-                    makeRed(getGrandParent(currentNode, index), index);
+                if (isRed(y, dataElement)) {
+                    makeBlack(getParent(currentNode, dataElement), dataElement);
+                    makeBlack(y, dataElement);
+                    makeRed(getGrandParent(currentNode, dataElement), dataElement);
 
-                    currentNode = getGrandParent(currentNode, index);
+                    currentNode = getGrandParent(currentNode, dataElement);
                 } else {
-                    if (isLeftChild(currentNode, index)) {
-                        currentNode = getParent(currentNode, index);
+                    //dead code?
+                    if (currentNode.isLeftChild(dataElement)) {
+                        currentNode = getParent(currentNode, dataElement);
 
-                        rotateRight(currentNode, index);
+                        rotateRight(currentNode, dataElement);
                     }
 
-                    makeBlack(getParent(currentNode, index), index);
-                    makeRed(getGrandParent(currentNode, index), index);
+                    makeBlack(getParent(currentNode, dataElement), dataElement);
+                    makeRed(getGrandParent(currentNode, dataElement), dataElement);
 
-                    if (getGrandParent(currentNode, index) != null) {
-                        rotateLeft(getGrandParent(currentNode, index), index);
+                    if (getGrandParent(currentNode, dataElement) != null) {
+                        rotateLeft(getGrandParent(currentNode, dataElement), dataElement);
                     }
                 }
             }
         }
 
-        makeBlack(rootNode[index], index);
+        makeBlack(rootNode[dataElement.ordinal()], dataElement);
     }
 
     /**
@@ -1008,57 +942,57 @@ public class TreeBidiMap implements OrderedBidiMap {
      *
      * @param deletedNode the node to be deleted
      */
-    private void doRedBlackDelete(final Node deletedNode) {
-        for (int index = FIRST_INDEX; index < NUMBER_OF_INDICES; index++) {
+    private void doRedBlackDelete(final Node<K, V> deletedNode) {
+        for (DataElement dataElement : DataElement.values()) {
             // if deleted node has both left and children, swap with
             // the next greater node
-            if ((deletedNode.getLeft(index) != null) && (deletedNode.getRight(index) != null)) {
-                swapPosition(nextGreater(deletedNode, index), deletedNode, index);
+            if ((deletedNode.getLeft(dataElement) != null) && (deletedNode.getRight(dataElement) != null)) {
+                swapPosition(nextGreater(deletedNode, dataElement), deletedNode, dataElement);
             }
 
-            Node replacement =
-                ((deletedNode.getLeft(index) != null) ? deletedNode.getLeft(index) : deletedNode.getRight(index));
+            Node<K, V> replacement =
+                ((deletedNode.getLeft(dataElement) != null) ? deletedNode.getLeft(dataElement) : deletedNode.getRight(dataElement));
 
             if (replacement != null) {
-                replacement.setParent(deletedNode.getParent(index), index);
+                replacement.setParent(deletedNode.getParent(dataElement), dataElement);
 
-                if (deletedNode.getParent(index) == null) {
-                    rootNode[index] = replacement;
-                } else if (deletedNode == deletedNode.getParent(index).getLeft(index)) {
-                    deletedNode.getParent(index).setLeft(replacement, index);
+                if (deletedNode.getParent(dataElement) == null) {
+                    rootNode[dataElement.ordinal()] = replacement;
+                } else if (deletedNode == deletedNode.getParent(dataElement).getLeft(dataElement)) {
+                    deletedNode.getParent(dataElement).setLeft(replacement, dataElement);
                 } else {
-                    deletedNode.getParent(index).setRight(replacement, index);
+                    deletedNode.getParent(dataElement).setRight(replacement, dataElement);
                 }
 
-                deletedNode.setLeft(null, index);
-                deletedNode.setRight(null, index);
-                deletedNode.setParent(null, index);
+                deletedNode.setLeft(null, dataElement);
+                deletedNode.setRight(null, dataElement);
+                deletedNode.setParent(null, dataElement);
 
-                if (isBlack(deletedNode, index)) {
-                    doRedBlackDeleteFixup(replacement, index);
+                if (isBlack(deletedNode, dataElement)) {
+                    doRedBlackDeleteFixup(replacement, dataElement);
                 }
             } else {
 
                 // replacement is null
-                if (deletedNode.getParent(index) == null) {
+                if (deletedNode.getParent(dataElement) == null) {
 
                     // empty tree
-                    rootNode[index] = null;
+                    rootNode[dataElement.ordinal()] = null;
                 } else {
 
                     // deleted node had no children
-                    if (isBlack(deletedNode, index)) {
-                        doRedBlackDeleteFixup(deletedNode, index);
+                    if (isBlack(deletedNode, dataElement)) {
+                        doRedBlackDeleteFixup(deletedNode, dataElement);
                     }
 
-                    if (deletedNode.getParent(index) != null) {
-                        if (deletedNode == deletedNode.getParent(index).getLeft(index)) {
-                            deletedNode.getParent(index).setLeft(null, index);
+                    if (deletedNode.getParent(dataElement) != null) {
+                        if (deletedNode == deletedNode.getParent(dataElement).getLeft(dataElement)) {
+                            deletedNode.getParent(dataElement).setLeft(null, dataElement);
                         } else {
-                            deletedNode.getParent(index).setRight(null, index);
+                            deletedNode.getParent(dataElement).setRight(null, dataElement);
                         }
 
-                        deletedNode.setParent(null, index);
+                        deletedNode.setParent(null, dataElement);
                     }
                 }
             }
@@ -1073,80 +1007,80 @@ public class TreeBidiMap implements OrderedBidiMap {
      * perfectly balanced -- perfect balancing takes longer)
      *
      * @param replacementNode the node being replaced
-     * @param index  the KEY or VALUE int
+     * @param dataElement  the KEY or VALUE int
      */
-    private void doRedBlackDeleteFixup(final Node replacementNode, final int index) {
-        Node currentNode = replacementNode;
+    private void doRedBlackDeleteFixup(final Node<K, V> replacementNode, final DataElement dataElement) {
+        Node<K, V> currentNode = replacementNode;
 
-        while ((currentNode != rootNode[index]) && (isBlack(currentNode, index))) {
-            if (isLeftChild(currentNode, index)) {
-                Node siblingNode = getRightChild(getParent(currentNode, index), index);
+        while ((currentNode != rootNode[dataElement.ordinal()]) && (isBlack(currentNode, dataElement))) {
+            if (currentNode.isLeftChild(dataElement)) {
+                Node<K, V> siblingNode = getRightChild(getParent(currentNode, dataElement), dataElement);
 
-                if (isRed(siblingNode, index)) {
-                    makeBlack(siblingNode, index);
-                    makeRed(getParent(currentNode, index), index);
-                    rotateLeft(getParent(currentNode, index), index);
+                if (isRed(siblingNode, dataElement)) {
+                    makeBlack(siblingNode, dataElement);
+                    makeRed(getParent(currentNode, dataElement), dataElement);
+                    rotateLeft(getParent(currentNode, dataElement), dataElement);
 
-                    siblingNode = getRightChild(getParent(currentNode, index), index);
+                    siblingNode = getRightChild(getParent(currentNode, dataElement), dataElement);
                 }
 
-                if (isBlack(getLeftChild(siblingNode, index), index)
-                    && isBlack(getRightChild(siblingNode, index), index)) {
-                    makeRed(siblingNode, index);
+                if (isBlack(getLeftChild(siblingNode, dataElement), dataElement)
+                    && isBlack(getRightChild(siblingNode, dataElement), dataElement)) {
+                    makeRed(siblingNode, dataElement);
 
-                    currentNode = getParent(currentNode, index);
+                    currentNode = getParent(currentNode, dataElement);
                 } else {
-                    if (isBlack(getRightChild(siblingNode, index), index)) {
-                        makeBlack(getLeftChild(siblingNode, index), index);
-                        makeRed(siblingNode, index);
-                        rotateRight(siblingNode, index);
+                    if (isBlack(getRightChild(siblingNode, dataElement), dataElement)) {
+                        makeBlack(getLeftChild(siblingNode, dataElement), dataElement);
+                        makeRed(siblingNode, dataElement);
+                        rotateRight(siblingNode, dataElement);
 
-                        siblingNode = getRightChild(getParent(currentNode, index), index);
+                        siblingNode = getRightChild(getParent(currentNode, dataElement), dataElement);
                     }
 
-                    copyColor(getParent(currentNode, index), siblingNode, index);
-                    makeBlack(getParent(currentNode, index), index);
-                    makeBlack(getRightChild(siblingNode, index), index);
-                    rotateLeft(getParent(currentNode, index), index);
+                    copyColor(getParent(currentNode, dataElement), siblingNode, dataElement);
+                    makeBlack(getParent(currentNode, dataElement), dataElement);
+                    makeBlack(getRightChild(siblingNode, dataElement), dataElement);
+                    rotateLeft(getParent(currentNode, dataElement), dataElement);
 
-                    currentNode = rootNode[index];
+                    currentNode = rootNode[dataElement.ordinal()];
                 }
             } else {
-                Node siblingNode = getLeftChild(getParent(currentNode, index), index);
+                Node<K, V> siblingNode = getLeftChild(getParent(currentNode, dataElement), dataElement);
 
-                if (isRed(siblingNode, index)) {
-                    makeBlack(siblingNode, index);
-                    makeRed(getParent(currentNode, index), index);
-                    rotateRight(getParent(currentNode, index), index);
+                if (isRed(siblingNode, dataElement)) {
+                    makeBlack(siblingNode, dataElement);
+                    makeRed(getParent(currentNode, dataElement), dataElement);
+                    rotateRight(getParent(currentNode, dataElement), dataElement);
 
-                    siblingNode = getLeftChild(getParent(currentNode, index), index);
+                    siblingNode = getLeftChild(getParent(currentNode, dataElement), dataElement);
                 }
 
-                if (isBlack(getRightChild(siblingNode, index), index)
-                    && isBlack(getLeftChild(siblingNode, index), index)) {
-                    makeRed(siblingNode, index);
+                if (isBlack(getRightChild(siblingNode, dataElement), dataElement)
+                    && isBlack(getLeftChild(siblingNode, dataElement), dataElement)) {
+                    makeRed(siblingNode, dataElement);
 
-                    currentNode = getParent(currentNode, index);
+                    currentNode = getParent(currentNode, dataElement);
                 } else {
-                    if (isBlack(getLeftChild(siblingNode, index), index)) {
-                        makeBlack(getRightChild(siblingNode, index), index);
-                        makeRed(siblingNode, index);
-                        rotateLeft(siblingNode, index);
+                    if (isBlack(getLeftChild(siblingNode, dataElement), dataElement)) {
+                        makeBlack(getRightChild(siblingNode, dataElement), dataElement);
+                        makeRed(siblingNode, dataElement);
+                        rotateLeft(siblingNode, dataElement);
 
-                        siblingNode = getLeftChild(getParent(currentNode, index), index);
+                        siblingNode = getLeftChild(getParent(currentNode, dataElement), dataElement);
                     }
 
-                    copyColor(getParent(currentNode, index), siblingNode, index);
-                    makeBlack(getParent(currentNode, index), index);
-                    makeBlack(getLeftChild(siblingNode, index), index);
-                    rotateRight(getParent(currentNode, index), index);
+                    copyColor(getParent(currentNode, dataElement), siblingNode, dataElement);
+                    makeBlack(getParent(currentNode, dataElement), dataElement);
+                    makeBlack(getLeftChild(siblingNode, dataElement), dataElement);
+                    rotateRight(getParent(currentNode, dataElement), dataElement);
 
-                    currentNode = rootNode[index];
+                    currentNode = rootNode[dataElement.ordinal()];
                 }
             }
         }
 
-        makeBlack(currentNode, index);
+        makeBlack(currentNode, dataElement);
     }
 
     /**
@@ -1156,94 +1090,94 @@ public class TreeBidiMap implements OrderedBidiMap {
      *
      * @param x one node
      * @param y another node
-     * @param index  the KEY or VALUE int
+     * @param dataElement  the KEY or VALUE int
      */
-    private void swapPosition(final Node x, final Node y, final int index) {
+    private void swapPosition(final Node<K, V> x, final Node<K, V> y, final DataElement dataElement) {
         // Save initial values.
-        Node xFormerParent = x.getParent(index);
-        Node xFormerLeftChild = x.getLeft(index);
-        Node xFormerRightChild = x.getRight(index);
-        Node yFormerParent = y.getParent(index);
-        Node yFormerLeftChild = y.getLeft(index);
-        Node yFormerRightChild = y.getRight(index);
-        boolean xWasLeftChild = (x.getParent(index) != null) && (x == x.getParent(index).getLeft(index));
-        boolean yWasLeftChild = (y.getParent(index) != null) && (y == y.getParent(index).getLeft(index));
+        Node<K, V> xFormerParent = x.getParent(dataElement);
+        Node<K, V> xFormerLeftChild = x.getLeft(dataElement);
+        Node<K, V> xFormerRightChild = x.getRight(dataElement);
+        Node<K, V> yFormerParent = y.getParent(dataElement);
+        Node<K, V> yFormerLeftChild = y.getLeft(dataElement);
+        Node<K, V> yFormerRightChild = y.getRight(dataElement);
+        boolean xWasLeftChild = (x.getParent(dataElement) != null) && (x == x.getParent(dataElement).getLeft(dataElement));
+        boolean yWasLeftChild = (y.getParent(dataElement) != null) && (y == y.getParent(dataElement).getLeft(dataElement));
 
         // Swap, handling special cases of one being the other's parent.
         if (x == yFormerParent) { // x was y's parent
-            x.setParent(y, index);
+            x.setParent(y, dataElement);
 
             if (yWasLeftChild) {
-                y.setLeft(x, index);
-                y.setRight(xFormerRightChild, index);
+                y.setLeft(x, dataElement);
+                y.setRight(xFormerRightChild, dataElement);
             } else {
-                y.setRight(x, index);
-                y.setLeft(xFormerLeftChild, index);
+                y.setRight(x, dataElement);
+                y.setLeft(xFormerLeftChild, dataElement);
             }
         } else {
-            x.setParent(yFormerParent, index);
+            x.setParent(yFormerParent, dataElement);
 
             if (yFormerParent != null) {
                 if (yWasLeftChild) {
-                    yFormerParent.setLeft(x, index);
+                    yFormerParent.setLeft(x, dataElement);
                 } else {
-                    yFormerParent.setRight(x, index);
+                    yFormerParent.setRight(x, dataElement);
                 }
             }
 
-            y.setLeft(xFormerLeftChild, index);
-            y.setRight(xFormerRightChild, index);
+            y.setLeft(xFormerLeftChild, dataElement);
+            y.setRight(xFormerRightChild, dataElement);
         }
 
         if (y == xFormerParent) { // y was x's parent
-            y.setParent(x, index);
+            y.setParent(x, dataElement);
 
             if (xWasLeftChild) {
-                x.setLeft(y, index);
-                x.setRight(yFormerRightChild, index);
+                x.setLeft(y, dataElement);
+                x.setRight(yFormerRightChild, dataElement);
             } else {
-                x.setRight(y, index);
-                x.setLeft(yFormerLeftChild, index);
+                x.setRight(y, dataElement);
+                x.setLeft(yFormerLeftChild, dataElement);
             }
         } else {
-            y.setParent(xFormerParent, index);
+            y.setParent(xFormerParent, dataElement);
 
             if (xFormerParent != null) {
                 if (xWasLeftChild) {
-                    xFormerParent.setLeft(y, index);
+                    xFormerParent.setLeft(y, dataElement);
                 } else {
-                    xFormerParent.setRight(y, index);
+                    xFormerParent.setRight(y, dataElement);
                 }
             }
 
-            x.setLeft(yFormerLeftChild, index);
-            x.setRight(yFormerRightChild, index);
+            x.setLeft(yFormerLeftChild, dataElement);
+            x.setRight(yFormerRightChild, dataElement);
         }
 
         // Fix children's parent pointers
-        if (x.getLeft(index) != null) {
-            x.getLeft(index).setParent(x, index);
+        if (x.getLeft(dataElement) != null) {
+            x.getLeft(dataElement).setParent(x, dataElement);
         }
 
-        if (x.getRight(index) != null) {
-            x.getRight(index).setParent(x, index);
+        if (x.getRight(dataElement) != null) {
+            x.getRight(dataElement).setParent(x, dataElement);
         }
 
-        if (y.getLeft(index) != null) {
-            y.getLeft(index).setParent(y, index);
+        if (y.getLeft(dataElement) != null) {
+            y.getLeft(dataElement).setParent(y, dataElement);
         }
 
-        if (y.getRight(index) != null) {
-            y.getRight(index).setParent(y, index);
+        if (y.getRight(dataElement) != null) {
+            y.getRight(dataElement).setParent(y, dataElement);
         }
 
-        x.swapColors(y, index);
+        x.swapColors(y, dataElement);
 
         // Check if root changed
-        if (rootNode[index] == x) {
-            rootNode[index] = y;
-        } else if (rootNode[index] == y) {
-            rootNode[index] = x;
+        if (rootNode[dataElement.ordinal()] == x) {
+            rootNode[dataElement.ordinal()] = y;
+        } else if (rootNode[dataElement.ordinal()] == y) {
+            rootNode[dataElement.ordinal()] = x;
         }
     }
 
@@ -1258,12 +1192,12 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @throws NullPointerException if o is null
      * @throws ClassCastException if o is not Comparable
      */
-    private static void checkNonNullComparable(final Object o, final int index) {
+    private static void checkNonNullComparable(final Object o, final DataElement dataElement) {
         if (o == null) {
-            throw new NullPointerException(dataName[index] + " cannot be null");
+            throw new NullPointerException(dataElement + " cannot be null");
         }
         if (!(o instanceof Comparable)) {
-            throw new ClassCastException(dataName[index] + " must be Comparable");
+            throw new ClassCastException(dataElement + " must be Comparable");
         }
     }
 
@@ -1339,11 +1273,11 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @throws IllegalArgumentException if the node already exists
      *                                     in the value mapping
      */
-    private void insertValue(final Node newNode) throws IllegalArgumentException {
-        Node node = rootNode[VALUE];
+    private void insertValue(final Node<K, V> newNode) throws IllegalArgumentException {
+        Node<K, V> node = rootNode[VALUE.ordinal()];
 
         while (true) {
-            int cmp = compare(newNode.getData(VALUE), node.getData(VALUE));
+            int cmp = compare(newNode.getValue(), node.getValue());
 
             if (cmp == 0) {
                 throw new IllegalArgumentException(
@@ -1371,7 +1305,7 @@ public class TreeBidiMap implements OrderedBidiMap {
             }
         }
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Compares for equals as per the API.
@@ -1380,21 +1314,21 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @param type  the KEY or VALUE int
      * @return true if equal
      */
-    private boolean doEquals(Object obj, final int type) {
+    private boolean doEquals(Object obj, DataElement dataElement) {
         if (obj == this) {
             return true;
         }
         if (obj instanceof Map == false) {
             return false;
         }
-        Map other = (Map) obj;
+        Map<?, ?> other = (Map<?, ?>) obj;
         if (other.size() != size()) {
             return false;
         }
 
         if (nodeCount > 0) {
             try {
-                for (MapIterator it = new ViewMapIterator(this, type); it.hasNext(); ) {
+                for (MapIterator<?, ?> it = getMapIterator(dataElement); it.hasNext(); ) {
                     Object key = it.next();
                     Object value = it.getValue();
                     if (value.equals(other.get(key)) == false) {
@@ -1416,10 +1350,10 @@ public class TreeBidiMap implements OrderedBidiMap {
      * @param type  the KEY or VALUE int
      * @return the hash code value for this map
      */
-    private int doHashCode(final int type) {
+    private int doHashCode(DataElement dataElement) {
         int total = 0;
         if (nodeCount > 0) {
-            for (MapIterator it = new ViewMapIterator(this, type); it.hasNext(); ) {
+            for (MapIterator<?, ?> it = getMapIterator(dataElement); it.hasNext(); ) {
                 Object key = it.next();
                 Object value = it.getValue();
                 total += (key.hashCode() ^ value.hashCode());
@@ -1427,20 +1361,20 @@ public class TreeBidiMap implements OrderedBidiMap {
         }
         return total;
     }
-    
+
     /**
      * Gets the string form of this map as per AbstractMap.
      *
      * @param type  the KEY or VALUE int
      * @return the string form of this map
      */
-    private String doToString(final int type) {
+    private String doToString(DataElement dataElement) {
         if (nodeCount == 0) {
             return "{}";
         }
         StringBuffer buf = new StringBuffer(nodeCount * 32);
         buf.append('{');
-        MapIterator it = new ViewMapIterator(this, type);
+        MapIterator<?, ?> it = getMapIterator(dataElement);
         boolean hasNext = it.hasNext();
         while (hasNext) {
             Object key = it.next();
@@ -1459,52 +1393,174 @@ public class TreeBidiMap implements OrderedBidiMap {
         return buf.toString();
     }
 
+    private MapIterator<?, ?> getMapIterator(DataElement dataElement) {
+        switch (dataElement) {
+        case KEY:
+            return new ViewMapIterator(KEY);
+        case VALUE:
+            return new InverseViewMapIterator(VALUE);
+        default:
+            throw new IllegalArgumentException();
+        }
+    }
+
     //-----------------------------------------------------------------------
     /**
      * A view of this map.
      */
-    static class View extends AbstractSet {
-        
-        /** The parent map. */
-        protected final TreeBidiMap main;
+    abstract class View<E> extends AbstractSet<E> {
+
         /** Whether to return KEY or VALUE order. */
-        protected final int orderType;
-        /** Whether to return KEY, VALUE, MAPENTRY or INVERSEMAPENTRY data. */
-        protected final int dataType;
+        protected final DataElement orderType;
 
         /**
          * Constructor.
-         *
-         * @param main  the main map
          * @param orderType  the KEY or VALUE int for the order
-         * @param dataType  the KEY, VALUE, MAPENTRY or INVERSEMAPENTRY int
+         * @param main  the main map
          */
-        View(final TreeBidiMap main, final int orderType, final int dataType) {
+        View(final DataElement orderType) {
             super();
-            this.main = main;
             this.orderType = orderType;
-            this.dataType = dataType;
-        }
-        
-        public Iterator iterator() {
-            return new ViewIterator(main, orderType, dataType);
         }
 
         public int size() {
-            return main.size();
+            return TreeBidiMap.this.size();
+        }
+
+        public void clear() {
+            TreeBidiMap.this.clear();
+        }
+    }
+
+    class KeyView extends View<K> {
+
+        /**
+         * Create a new TreeBidiMap.KeyView.
+         */
+        public KeyView(DataElement orderType) {
+            super(orderType);
+        }
+
+        @Override
+        public Iterator<K> iterator() {
+            return new ViewMapIterator(orderType);
         }
 
+        @Override
         public boolean contains(final Object obj) {
-            checkNonNullComparable(obj, dataType);
-            return (main.lookup((Comparable) obj, dataType) != null);
+            checkNonNullComparable(obj, KEY);
+            return (lookupKey(obj) != null);
         }
 
-        public boolean remove(final Object obj) {
-            return (main.doRemove((Comparable) obj, dataType) != null);
+        @Override
+        public boolean remove(Object o) {
+            return doRemoveKey(o) != null;
         }
 
-        public void clear() {
-            main.clear();
+    }
+
+    class ValueView extends View<V> {
+
+        /**
+         * Create a new TreeBidiMap.ValueView.
+         */
+        public ValueView(DataElement orderType) {
+            super(orderType);
+        }
+
+        @Override
+        public Iterator<V> iterator() {
+            return new InverseViewMapIterator(orderType);
+        }
+
+        @Override
+        public boolean contains(final Object obj) {
+            checkNonNullComparable(obj, VALUE);
+            return (lookupValue(obj) != null);
+        }
+
+        @Override
+        public boolean remove(Object o) {
+            return doRemoveValue(o) != null;
+        }
+
+    }
+
+    /**
+     * A view of this map.
+     */
+    class EntryView extends View<Map.Entry<K, V>> {
+
+        EntryView() {
+            super(KEY);
+        }
+
+        public boolean contains(Object obj) {
+            if (obj instanceof Map.Entry == false) {
+                return false;
+            }
+            Map.Entry<?, ?> entry = (Map.Entry<?, ?>) obj;
+            Object value = entry.getValue();
+            Node<K, V> node = lookupKey(entry.getKey());
+            return node != null && node.getValue().equals(value);
+        }
+
+        public boolean remove(Object obj) {
+            if (obj instanceof Map.Entry == false) {
+                return false;
+            }
+            Map.Entry<?, ?> entry = (Map.Entry<?, ?>) obj;
+            Object value = entry.getValue();
+            Node<K, V> node = lookupKey(entry.getKey());
+            if (node != null && node.getValue().equals(value)) {
+                doRedBlackDelete(node);
+                return true;
+            }
+            return false;
+        }
+
+        @Override
+        public Iterator<java.util.Map.Entry<K, V>> iterator() {
+            return new ViewMapEntryIterator();
+        }
+    }
+
+    /**
+     * A view of this map.
+     */
+    class InverseEntryView extends View<Map.Entry<V, K>> {
+
+        InverseEntryView() {
+            super(VALUE);
+        }
+
+        public boolean contains(Object obj) {
+            if (obj instanceof Map.Entry == false) {
+                return false;
+            }
+            Map.Entry<?, ?> entry = (Map.Entry<?, ?>) obj;
+            Object value = entry.getValue();
+            Node<K, V> node = lookupValue(entry.getKey());
+            return node != null && node.getKey().equals(value);
+        }
+
+        public boolean remove(Object obj) {
+            if (obj instanceof Map.Entry == false) {
+                return false;
+            }
+            Map.Entry<?, ?> entry = (Map.Entry<?, ?>) obj;
+            Object value = entry.getValue();
+            Node<K, V> node = lookupValue(entry.getKey());
+            if (node != null && node.getKey().equals(value)) {
+                doRedBlackDelete(node);
+                return true;
+            }
+            return false;
+        }
+
+        @Override
+        public Iterator<java.util.Map.Entry<V, K>> iterator() {
+            return new InverseViewMapEntryIterator();
         }
     }
 
@@ -1512,110 +1568,84 @@ public class TreeBidiMap implements OrderedBidiMap {
     /**
      * An iterator over the map.
      */
-    static class ViewIterator implements OrderedIterator {
+    abstract class ViewIterator {
 
-        /** The parent map. */
-        protected final TreeBidiMap main;
         /** Whether to return KEY or VALUE order. */
-        protected final int orderType;
-        /** Whether to return KEY, VALUE, MAPENTRY or INVERSEMAPENTRY data. */
-        protected final int dataType;
+        protected final DataElement orderType;
         /** The last node returned by the iterator. */
-        protected Node lastReturnedNode;
+        protected Node<K, V> lastReturnedNode;
         /** The next node to be returned by the iterator. */
-        protected Node nextNode;
+        protected Node<K, V> nextNode;
         /** The previous node in the sequence returned by the iterator. */
-        protected Node previousNode;
+        protected Node<K, V> previousNode;
         /** The modification count. */
         private int expectedModifications;
 
         /**
          * Constructor.
-         *
-         * @param main  the main map
          * @param orderType  the KEY or VALUE int for the order
-         * @param dataType  the KEY, VALUE, MAPENTRY or INVERSEMAPENTRY int
+         * @param main  the main map
          */
-        ViewIterator(final TreeBidiMap main, final int orderType, final int dataType) {
+        ViewIterator(final DataElement orderType) {
             super();
-            this.main = main;
             this.orderType = orderType;
-            this.dataType = dataType;
-            expectedModifications = main.modifications;
-            nextNode = leastNode(main.rootNode[orderType], orderType);
+            expectedModifications = modifications;
+            nextNode = leastNode(rootNode[orderType.ordinal()], orderType);
             lastReturnedNode = null;
             previousNode = null;
         }
 
         public final boolean hasNext() {
-            return (nextNode != null);
+            return nextNode != null;
         }
 
-        public final Object next() {
+        protected Node<K, V> navigateNext() {
             if (nextNode == null) {
                 throw new NoSuchElementException();
             }
-            if (main.modifications != expectedModifications) {
+            if (modifications != expectedModifications) {
                 throw new ConcurrentModificationException();
             }
             lastReturnedNode = nextNode;
             previousNode = nextNode;
-            nextNode = main.nextGreater(nextNode, orderType);
-            return doGetData();
+            nextNode = nextGreater(nextNode, orderType);
+            return lastReturnedNode;
         }
 
         public boolean hasPrevious() {
-            return (previousNode != null);
+            return previousNode != null;
         }
 
-        public Object previous() {
+        protected Node<K, V> navigatePrevious() {
             if (previousNode == null) {
                 throw new NoSuchElementException();
             }
-            if (main.modifications != expectedModifications) {
+            if (modifications != expectedModifications) {
                 throw new ConcurrentModificationException();
             }
             nextNode = lastReturnedNode;
             if (nextNode == null) {
-                nextNode = main.nextGreater(previousNode, orderType);
+                nextNode = nextGreater(previousNode, orderType);
             }
             lastReturnedNode = previousNode;
-            previousNode = main.nextSmaller(previousNode, orderType);
-            return doGetData();
-        }
-
-        /**
-         * Gets the data value for the lastReturnedNode field.
-         * @return the data value
-         */
-        protected Object doGetData() {
-            switch (dataType) {
-                case KEY:
-                    return lastReturnedNode.getKey();
-                case VALUE:
-                    return lastReturnedNode.getValue();
-                case MAPENTRY:
-                    return lastReturnedNode;
-                case INVERSEMAPENTRY:
-                    return new UnmodifiableMapEntry(lastReturnedNode.getValue(), lastReturnedNode.getKey());
-            }
-            return null;
+            previousNode = nextSmaller(previousNode, orderType);
+            return lastReturnedNode;
         }
 
         public final void remove() {
             if (lastReturnedNode == null) {
                 throw new IllegalStateException();
             }
-            if (main.modifications != expectedModifications) {
+            if (modifications != expectedModifications) {
                 throw new ConcurrentModificationException();
             }
-            main.doRedBlackDelete(lastReturnedNode);
+            doRedBlackDelete(lastReturnedNode);
             expectedModifications++;
             lastReturnedNode = null;
             if (nextNode == null) {
-                previousNode = TreeBidiMap.greatestNode(main.rootNode[orderType], orderType);
+                previousNode = greatestNode(rootNode[orderType.ordinal()], orderType);
             } else {
-                previousNode = main.nextSmaller(nextNode, orderType);
+                previousNode = nextSmaller(nextNode, orderType);
             }
         }
     }
@@ -1624,95 +1654,139 @@ public class TreeBidiMap implements OrderedBidiMap {
     /**
      * An iterator over the map.
      */
-    static class ViewMapIterator extends ViewIterator implements OrderedMapIterator {
+    class ViewMapIterator extends ViewIterator implements OrderedMapIterator<K, V> {
 
-        private final int oppositeType;
-        
         /**
          * Constructor.
-         *
-         * @param main  the main map
-         * @param orderType  the KEY or VALUE int for the order
          */
-        ViewMapIterator(final TreeBidiMap main, final int orderType) {
-            super(main, orderType, orderType);
-            this.oppositeType = oppositeIndex(dataType);
+        ViewMapIterator(DataElement orderType) {
+            super(orderType);
         }
-        
-        public Object getKey() {
+
+        public K getKey() {
             if (lastReturnedNode == null) {
                 throw new IllegalStateException("Iterator getKey() can only be called after next() and before remove()");
             }
-            return lastReturnedNode.getData(dataType);
+            return lastReturnedNode.getKey();
         }
 
-        public Object getValue() {
+        public V getValue() {
             if (lastReturnedNode == null) {
                 throw new IllegalStateException("Iterator getValue() can only be called after next() and before remove()");
             }
-            return lastReturnedNode.getData(oppositeType);
+            return lastReturnedNode.getValue();
         }
 
-        public Object setValue(final Object obj) {
+        public V setValue(final V obj) {
             throw new UnsupportedOperationException();
         }
+
+        public K next() {
+            return navigateNext().getKey();
+        }
+
+        public K previous() {
+            return navigatePrevious().getKey();
+        }
     }
 
-    //-----------------------------------------------------------------------
     /**
-     * A view of this map.
+     * An iterator over the map.
      */
-    static class EntryView extends View {
-        
-        private final int oppositeType;
-        
+    class InverseViewMapIterator extends ViewIterator implements OrderedMapIterator<V, K> {
+
         /**
-         * Constructor.
-         *
-         * @param main  the main map
-         * @param orderType  the KEY or VALUE int for the order
-         * @param dataType  the MAPENTRY or INVERSEMAPENTRY int for the returned data
+         * Create a new TreeBidiMap.InverseViewMapIterator.
          */
-        EntryView(final TreeBidiMap main, final int orderType, final int dataType) {
-            super(main, orderType, dataType);
-            this.oppositeType = TreeBidiMap.oppositeIndex(orderType);
+        public InverseViewMapIterator(DataElement orderType) {
+            super(orderType);
         }
-        
-        public boolean contains(Object obj) {
-            if (obj instanceof Map.Entry == false) {
-                return false;
+
+        public V getKey() {
+            if (lastReturnedNode == null) {
+                throw new IllegalStateException("Iterator getKey() can only be called after next() and before remove()");
             }
-            Map.Entry entry = (Map.Entry) obj;
-            Object value = entry.getValue();
-            Node node = main.lookup((Comparable) entry.getKey(), orderType);
-            return (node != null && node.getData(oppositeType).equals(value));
+            return lastReturnedNode.getValue();
         }
 
-        public boolean remove(Object obj) {
-            if (obj instanceof Map.Entry == false) {
-                return false;
-            }
-            Map.Entry entry = (Map.Entry) obj;
-            Object value = entry.getValue();
-            Node node = main.lookup((Comparable) entry.getKey(), orderType);
-            if (node != null && node.getData(oppositeType).equals(value)) {
-                main.doRedBlackDelete(node);
-                return true;
+        public K getValue() {
+            if (lastReturnedNode == null) {
+                throw new IllegalStateException("Iterator getValue() can only be called after next() and before remove()");
             }
-            return false;
+            return lastReturnedNode.getKey();
+        }
+
+        public K setValue(final K obj) {
+            throw new UnsupportedOperationException();
+        }
+
+        public V next() {
+            return navigateNext().getValue();
+        }
+
+        public V previous() {
+            return navigatePrevious().getValue();
+        }
+    }
+
+    /**
+     * An iterator over the map entries.
+     */
+    class ViewMapEntryIterator extends ViewIterator implements OrderedIterator<Map.Entry<K, V>> {
+
+        /**
+         * Constructor.
+         */
+        ViewMapEntryIterator() {
+            super(KEY);
+        }
+
+        public Map.Entry<K, V> next() {
+            return navigateNext();
+        }
+
+        public Map.Entry<K, V> previous() {
+            return navigatePrevious();
+        }
+    }
+
+    /**
+     * An iterator over the inverse map entries.
+     */
+    class InverseViewMapEntryIterator extends ViewIterator implements OrderedIterator<Map.Entry<V, K>> {
+
+        /**
+         * Constructor.
+         */
+        InverseViewMapEntryIterator() {
+            super(VALUE);
+        }
+
+        public Map.Entry<V, K> next() {
+            return createEntry(navigateNext());
+        }
+
+        public Map.Entry<V, K> previous() {
+            return createEntry(navigatePrevious());
+        }
+
+        private Map.Entry<V, K> createEntry(Node<K, V> node) {
+            return new UnmodifiableMapEntry<V, K>(node.getValue(), node.getKey());
         }
     }
 
     //-----------------------------------------------------------------------
+    //-----------------------------------------------------------------------
     /**
      * A node used to store the data.
      */
-    static class Node implements Map.Entry, KeyValue {
+    static class Node<K extends Comparable<K>, V extends Comparable<V>> implements Map.Entry<K, V>, KeyValue<K, V> {
 
-        private Comparable[] data;
-        private Node[] leftNode;
-        private Node[] rightNode;
-        private Node[] parentNode;
+        private K key;
+        private V value;
+        private Node<K, V>[] leftNode;
+        private Node<K, V>[] rightNode;
+        private Node<K, V>[] parentNode;
         private boolean[] blackColor;
         private int hashcodeValue;
         private boolean calculatedHashCode;
@@ -1724,9 +1798,11 @@ public class TreeBidiMap implements OrderedBidiMap {
          * @param key
          * @param value
          */
-        Node(final Comparable key, final Comparable value) {
+        @SuppressWarnings("unchecked")
+        Node(final K key, final V value) {
             super();
-            data = new Comparable[] { key, value };
+            this.key = key;
+            this.value = value;
             leftNode = new Node[2];
             rightNode = new Node[2];
             parentNode = new Node[2];
@@ -1734,54 +1810,31 @@ public class TreeBidiMap implements OrderedBidiMap {
             calculatedHashCode = false;
         }
 
-        /**
-         * Get the specified data.
-         *
-         * @param index  the KEY or VALUE int
-         * @return the key or value
-         */
-        private Comparable getData(final int index) {
-            return data[index];
+        private Object getData(final DataElement dataElement) {
+            switch (dataElement) {
+            case KEY:
+                return getKey();
+            case VALUE:
+                return getValue();
+            default:
+                throw new IllegalArgumentException();
+            }
         }
 
-        /**
-         * Set this node's left node.
-         *
-         * @param node  the new left node
-         * @param index  the KEY or VALUE int
-         */
-        private void setLeft(final Node node, final int index) {
-            leftNode[index] = node;
+        private void setLeft(final Node<K, V> node, final DataElement dataElement) {
+            leftNode[dataElement.ordinal()] = node;
         }
 
-        /**
-         * Get the left node.
-         *
-         * @param index  the KEY or VALUE int
-         * @return the left node, may be null
-         */
-        private Node getLeft(final int index) {
-            return leftNode[index];
+        private Node<K, V> getLeft(final DataElement dataElement) {
+            return leftNode[dataElement.ordinal()];
         }
 
-        /**
-         * Set this node's right node.
-         *
-         * @param node  the new right node
-         * @param index  the KEY or VALUE int
-         */
-        private void setRight(final Node node, final int index) {
-            rightNode[index] = node;
+        private void setRight(final Node<K, V> node, final DataElement dataElement) {
+            rightNode[dataElement.ordinal()] = node;
         }
 
-        /**
-         * Get the right node.
-         *
-         * @param index  the KEY or VALUE int
-         * @return the right node, may be null
-         */
-        private Node getRight(final int index) {
-            return rightNode[index];
+        private Node<K, V> getRight(final DataElement dataElement) {
+            return rightNode[dataElement.ordinal()];
         }
 
         /**
@@ -1790,8 +1843,8 @@ public class TreeBidiMap implements OrderedBidiMap {
          * @param node  the new parent node
          * @param index  the KEY or VALUE int
          */
-        private void setParent(final Node node, final int index) {
-            parentNode[index] = node;
+        private void setParent(final Node<K, V> node, final DataElement dataElement) {
+            parentNode[dataElement.ordinal()] = node;
         }
 
         /**
@@ -1800,8 +1853,8 @@ public class TreeBidiMap implements OrderedBidiMap {
          * @param index  the KEY or VALUE int
          * @return the parent node, may be null
          */
-        private Node getParent(final int index) {
-            return parentNode[index];
+        private Node<K, V> getParent(final DataElement dataElement) {
+            return parentNode[dataElement.ordinal()];
         }
 
         /**
@@ -1810,11 +1863,11 @@ public class TreeBidiMap implements OrderedBidiMap {
          * @param node  the node to swap with
          * @param index  the KEY or VALUE int
          */
-        private void swapColors(final Node node, final int index) {
+        private void swapColors(final Node<K, V> node, final DataElement dataElement) {
             // Swap colors -- old hacker's trick
-            blackColor[index]      ^= node.blackColor[index];
-            node.blackColor[index] ^= blackColor[index];
-            blackColor[index]      ^= node.blackColor[index];
+            blackColor[dataElement.ordinal()]      ^= node.blackColor[dataElement.ordinal()];
+            node.blackColor[dataElement.ordinal()] ^= blackColor[dataElement.ordinal()];
+            blackColor[dataElement.ordinal()]      ^= node.blackColor[dataElement.ordinal()];
         }
 
         /**
@@ -1823,8 +1876,8 @@ public class TreeBidiMap implements OrderedBidiMap {
          * @param index  the KEY or VALUE int
          * @return true if black (which is represented as a true boolean)
          */
-        private boolean isBlack(final int index) {
-            return blackColor[index];
+        private boolean isBlack(final DataElement dataElement) {
+            return blackColor[dataElement.ordinal()];
         }
 
         /**
@@ -1833,8 +1886,8 @@ public class TreeBidiMap implements OrderedBidiMap {
          * @param index  the KEY or VALUE int
          * @return true if non-black
          */
-        private boolean isRed(final int index) {
-            return !blackColor[index];
+        private boolean isRed(final DataElement dataElement) {
+            return !blackColor[dataElement.ordinal()];
         }
 
         /**
@@ -1842,8 +1895,8 @@ public class TreeBidiMap implements OrderedBidiMap {
          *
          * @param index  the KEY or VALUE int
          */
-        private void setBlack(final int index) {
-            blackColor[index] = true;
+        private void setBlack(final DataElement dataElement) {
+            blackColor[dataElement.ordinal()] = true;
         }
 
         /**
@@ -1851,8 +1904,8 @@ public class TreeBidiMap implements OrderedBidiMap {
          *
          * @param index  the KEY or VALUE int
          */
-        private void setRed(final int index) {
-            blackColor[index] = false;
+        private void setRed(final DataElement dataElement) {
+            blackColor[dataElement.ordinal()] = false;
         }
 
         /**
@@ -1861,27 +1914,37 @@ public class TreeBidiMap implements OrderedBidiMap {
          * @param node  the node whose color we're adopting
          * @param index  the KEY or VALUE int
          */
-        private void copyColor(final Node node, final int index) {
-            blackColor[index] = node.blackColor[index];
+        private void copyColor(final Node<K, V> node, final DataElement dataElement) {
+            blackColor[dataElement.ordinal()] = node.blackColor[dataElement.ordinal()];
+        }
+
+        private boolean isLeftChild(final DataElement dataElement) {
+            return parentNode[dataElement.ordinal()] != null
+                    && parentNode[dataElement.ordinal()].leftNode[dataElement.ordinal()] == this;
+        }
+
+        private boolean isRightChild(final DataElement dataElement) {
+            return parentNode[dataElement.ordinal()] != null
+                    && parentNode[dataElement.ordinal()].rightNode[dataElement.ordinal()] == this;
         }
 
         //-------------------------------------------------------------------
         /**
          * Gets the key.
-         * 
+         *
          * @return the key corresponding to this entry.
          */
-        public Object getKey() {
-            return data[KEY];
+        public K getKey() {
+            return key;
         }
 
         /**
          * Gets the value.
-         * 
+         *
          * @return the value corresponding to this entry.
          */
-        public Object getValue() {
-            return data[VALUE];
+        public V getValue() {
+            return value;
         }
 
         /**
@@ -1891,10 +1954,8 @@ public class TreeBidiMap impleme

<TRUNCATED>

[18/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/set/SynchronizedSortedSet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/SynchronizedSortedSet.java b/src/java/org/apache/commons/collections/set/SynchronizedSortedSet.java
index 388639e..59a3e16 100644
--- a/src/java/org/apache/commons/collections/set/SynchronizedSortedSet.java
+++ b/src/java/org/apache/commons/collections/set/SynchronizedSortedSet.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.
@@ -31,7 +31,7 @@ import org.apache.commons.collections.collection.SynchronizedCollection;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class SynchronizedSortedSet<E> extends SynchronizedCollection<E> implements SortedSet<E> {
@@ -41,18 +41,18 @@ public class SynchronizedSortedSet<E> extends SynchronizedCollection<E> implemen
 
     /**
      * Factory method to create a synchronized set.
-     * 
+     *
      * @param set  the set to decorate, must not be null
      * @throws IllegalArgumentException if set is null
      */
     public static <T> SortedSet<T> decorate(SortedSet<T> set) {
         return new SynchronizedSortedSet<T>(set);
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Constructor that wraps (not copies).
-     * 
+     *
      * @param set  the set to decorate, must not be null
      * @throws IllegalArgumentException if set is null
      */
@@ -62,7 +62,7 @@ public class SynchronizedSortedSet<E> extends SynchronizedCollection<E> implemen
 
     /**
      * Constructor that wraps (not copies).
-     * 
+     *
      * @param set  the set to decorate, must not be null
      * @param lock  the lock object to use, must not be null
      * @throws IllegalArgumentException if set is null
@@ -73,7 +73,7 @@ public class SynchronizedSortedSet<E> extends SynchronizedCollection<E> implemen
 
     /**
      * Gets the decorated set.
-     * 
+     *
      * @return the decorated set
      */
     protected SortedSet<E> getSortedSet() {
@@ -83,28 +83,28 @@ public class SynchronizedSortedSet<E> extends SynchronizedCollection<E> implemen
     //-----------------------------------------------------------------------
     public SortedSet<E> subSet(E fromElement, E toElement) {
         synchronized (lock) {
-            SortedSet set = getSortedSet().subSet(fromElement, toElement);
+            SortedSet<E> set = getSortedSet().subSet(fromElement, toElement);
             // the lock is passed into the constructor here to ensure that the
             // subset is synchronized on the same lock as the parent
-            return new SynchronizedSortedSet(set, lock);
+            return new SynchronizedSortedSet<E>(set, lock);
         }
     }
 
     public SortedSet<E> headSet(E toElement) {
         synchronized (lock) {
-            SortedSet set = getSortedSet().headSet(toElement);
+            SortedSet<E> set = getSortedSet().headSet(toElement);
             // the lock is passed into the constructor here to ensure that the
             // headset is synchronized on the same lock as the parent
-            return new SynchronizedSortedSet(set, lock);
+            return new SynchronizedSortedSet<E>(set, lock);
         }
     }
 
     public SortedSet<E> tailSet(E fromElement) {
         synchronized (lock) {
-            SortedSet set = getSortedSet().tailSet(fromElement);
+            SortedSet<E> set = getSortedSet().tailSet(fromElement);
             // the lock is passed into the constructor here to ensure that the
             // tailset is synchronized on the same lock as the parent
-            return new SynchronizedSortedSet(set, lock);
+            return new SynchronizedSortedSet<E>(set, lock);
         }
     }
 
@@ -120,7 +120,7 @@ public class SynchronizedSortedSet<E> extends SynchronizedCollection<E> implemen
         }
     }
 
-    public Comparator comparator() {
+    public Comparator<? super E> comparator() {
         synchronized (lock) {
             return getSortedSet().comparator();
         }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/set/TransformedSet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/TransformedSet.java b/src/java/org/apache/commons/collections/set/TransformedSet.java
index 7f4b32b..2a90556 100644
--- a/src/java/org/apache/commons/collections/set/TransformedSet.java
+++ b/src/java/org/apache/commons/collections/set/TransformedSet.java
@@ -36,7 +36,7 @@ import org.apache.commons.collections.collection.TransformedCollection;
  * 
  * @author Stephen Colebourne
  */
-public class TransformedSet extends TransformedCollection implements Set {
+public class TransformedSet<E> extends TransformedCollection<E> implements Set<E> {
 
     /** Serialization version */
     private static final long serialVersionUID = 306127383500410386L;
@@ -51,8 +51,8 @@ public class TransformedSet extends TransformedCollection implements Set {
      * @param transformer  the transformer to use for conversion, must not be null
      * @throws IllegalArgumentException if set or transformer is null
      */
-    public static Set decorate(Set set, Transformer transformer) {
-        return new TransformedSet(set, transformer);
+    public static <E> Set<E> decorate(Set<E> set, Transformer<? super E, ? extends E> transformer) {
+        return new TransformedSet<E>(set, transformer);
     }
     
     //-----------------------------------------------------------------------
@@ -66,7 +66,7 @@ public class TransformedSet extends TransformedCollection implements Set {
      * @param transformer  the transformer to use for conversion, must not be null
      * @throws IllegalArgumentException if set or transformer is null
      */
-    protected TransformedSet(Set set, Transformer transformer) {
+    protected TransformedSet(Set<E> set, Transformer<? super E, ? extends E> transformer) {
         super(set, transformer);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/set/TransformedSortedSet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/TransformedSortedSet.java b/src/java/org/apache/commons/collections/set/TransformedSortedSet.java
index 64f26aa..7961faa 100644
--- a/src/java/org/apache/commons/collections/set/TransformedSortedSet.java
+++ b/src/java/org/apache/commons/collections/set/TransformedSortedSet.java
@@ -36,7 +36,7 @@ import org.apache.commons.collections.Transformer;
  * 
  * @author Stephen Colebourne
  */
-public class TransformedSortedSet extends TransformedSet implements SortedSet {
+public class TransformedSortedSet<E> extends TransformedSet<E> implements SortedSet<E> {
 
     /** Serialization version */
     private static final long serialVersionUID = -1675486811351124386L;
@@ -51,8 +51,8 @@ public class TransformedSortedSet extends TransformedSet implements SortedSet {
      * @param transformer  the transformer to use for conversion, must not be null
      * @throws IllegalArgumentException if set or transformer is null
      */
-    public static SortedSet decorate(SortedSet set, Transformer transformer) {
-        return new TransformedSortedSet(set, transformer);
+    public static <E> SortedSet<E> decorate(SortedSet<E> set, Transformer<? super E, ? extends E> transformer) {
+        return new TransformedSortedSet<E>(set, transformer);
     }
     
     //-----------------------------------------------------------------------
@@ -66,7 +66,7 @@ public class TransformedSortedSet extends TransformedSet implements SortedSet {
      * @param transformer  the transformer to use for conversion, must not be null
      * @throws IllegalArgumentException if set or transformer is null
      */
-    protected TransformedSortedSet(SortedSet set, Transformer transformer) {
+    protected TransformedSortedSet(SortedSet<E> set, Transformer<? super E, ? extends E> transformer) {
         super(set, transformer);
     }
 
@@ -75,37 +75,37 @@ public class TransformedSortedSet extends TransformedSet implements SortedSet {
      * 
      * @return the decorated set
      */
-    protected SortedSet getSortedSet() {
-        return (SortedSet) collection;
+    protected SortedSet<E> getSortedSet() {
+        return (SortedSet<E>) collection;
     }
 
     //-----------------------------------------------------------------------
-    public Object first() {
+    public E first() {
         return getSortedSet().first();
     }
 
-    public Object last() {
+    public E last() {
         return getSortedSet().last();
     }
 
-    public Comparator comparator() {
+    public Comparator<? super E> comparator() {
         return getSortedSet().comparator();
     }
 
     //-----------------------------------------------------------------------
-    public SortedSet subSet(Object fromElement, Object toElement) {
-        SortedSet set = getSortedSet().subSet(fromElement, toElement);
-        return new TransformedSortedSet(set, transformer);
+    public SortedSet<E> subSet(E fromElement, E toElement) {
+        SortedSet<E> set = getSortedSet().subSet(fromElement, toElement);
+        return new TransformedSortedSet<E>(set, transformer);
     }
 
-    public SortedSet headSet(Object toElement) {
-        SortedSet set = getSortedSet().headSet(toElement);
-        return new TransformedSortedSet(set, transformer);
+    public SortedSet<E> headSet(E toElement) {
+        SortedSet<E> set = getSortedSet().headSet(toElement);
+        return new TransformedSortedSet<E>(set, transformer);
     }
 
-    public SortedSet tailSet(Object fromElement) {
-        SortedSet set = getSortedSet().tailSet(fromElement);
-        return new TransformedSortedSet(set, transformer);
+    public SortedSet<E> tailSet(E fromElement) {
+        SortedSet<E> set = getSortedSet().tailSet(fromElement);
+        return new TransformedSortedSet<E>(set, transformer);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/set/UnmodifiableSet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/UnmodifiableSet.java b/src/java/org/apache/commons/collections/set/UnmodifiableSet.java
index 29df1cc..c3e126c 100644
--- a/src/java/org/apache/commons/collections/set/UnmodifiableSet.java
+++ b/src/java/org/apache/commons/collections/set/UnmodifiableSet.java
@@ -33,8 +33,8 @@ import org.apache.commons.collections.iterators.UnmodifiableIterator;
  * 
  * @author Stephen Colebourne
  */
-public final class UnmodifiableSet
-        extends AbstractSerializableSetDecorator
+public final class UnmodifiableSet<E>
+        extends AbstractSerializableSetDecorator<E>
         implements Unmodifiable {
 
     /** Serialization version */
@@ -46,11 +46,11 @@ public final class UnmodifiableSet
      * @param set  the set to decorate, must not be null
      * @throws IllegalArgumentException if set is null
      */
-    public static Set decorate(Set set) {
+    public static <E> Set<E> decorate(Set<E> set) {
         if (set instanceof Unmodifiable) {
             return set;
         }
-        return new UnmodifiableSet(set);
+        return new UnmodifiableSet<E>(set);
     }
 
     //-----------------------------------------------------------------------
@@ -60,20 +60,20 @@ public final class UnmodifiableSet
      * @param set  the set to decorate, must not be null
      * @throws IllegalArgumentException if set is null
      */
-    private UnmodifiableSet(Set set) {
+    private UnmodifiableSet(Set<E> set) {
         super(set);
     }
 
     //-----------------------------------------------------------------------
-    public Iterator iterator() {
-        return UnmodifiableIterator.decorate(decorated().iterator());
+    public Iterator<E> iterator() {
+        return UnmodifiableIterator.<E>decorate(decorated().iterator());
     }
 
-    public boolean add(Object object) {
+    public boolean add(E object) {
         throw new UnsupportedOperationException();
     }
 
-    public boolean addAll(Collection coll) {
+    public boolean addAll(Collection<? extends E> coll) {
         throw new UnsupportedOperationException();
     }
 
@@ -85,11 +85,11 @@ public final class UnmodifiableSet
         throw new UnsupportedOperationException();
     }
 
-    public boolean removeAll(Collection coll) {
+    public boolean removeAll(Collection<?> coll) {
         throw new UnsupportedOperationException();
     }
 
-    public boolean retainAll(Collection coll) {
+    public boolean retainAll(Collection<?> coll) {
         throw new UnsupportedOperationException();
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java b/src/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java
index 2fd72e0..58cec6b 100644
--- a/src/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java
+++ b/src/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java
@@ -54,7 +54,7 @@ public final class UnmodifiableSortedSet<E>
         if (set instanceof Unmodifiable) {
             return set;
         }
-        return new UnmodifiableSortedSet(set);
+        return new UnmodifiableSortedSet<T>(set);
     }
 
     //-----------------------------------------------------------------------
@@ -76,6 +76,7 @@ public final class UnmodifiableSortedSet<E>
      * @throws IOException
      * @throws ClassNotFoundException
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
         collection = (Collection) in.readObject();
@@ -93,7 +94,7 @@ public final class UnmodifiableSortedSet<E>
     }
 
     //-----------------------------------------------------------------------
-    public Iterator iterator() {
+    public Iterator<E> iterator() {
         return UnmodifiableIterator.decorate(decorated().iterator());
     }
 
@@ -124,17 +125,17 @@ public final class UnmodifiableSortedSet<E>
     //-----------------------------------------------------------------------
     public SortedSet<E> subSet(E fromElement, E toElement) {
         SortedSet<E> sub = decorated().subSet(fromElement, toElement);
-        return new UnmodifiableSortedSet(sub);
+        return new UnmodifiableSortedSet<E>(sub);
     }
 
     public SortedSet<E> headSet(E toElement) {
         SortedSet<E> sub = decorated().headSet(toElement);
-        return new UnmodifiableSortedSet(sub);
+        return new UnmodifiableSortedSet<E>(sub);
     }
 
     public SortedSet<E> tailSet(E fromElement) {
         SortedSet<E> sub = decorated().tailSet(fromElement);
-        return new UnmodifiableSortedSet(sub);
+        return new UnmodifiableSortedSet<E>(sub);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/AbstractTestObject.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/AbstractTestObject.java b/src/test/org/apache/commons/collections/AbstractTestObject.java
index a8ad06c..f692def 100644
--- a/src/test/org/apache/commons/collections/AbstractTestObject.java
+++ b/src/test/org/apache/commons/collections/AbstractTestObject.java
@@ -167,7 +167,7 @@ public abstract class AbstractTestObject extends BulkTest {
         Object o = makeObject();
         if (o instanceof Serializable && isTestSerialization()) {
             byte[] objekt = writeExternalFormToBytes((Serializable) o);
-            Object p = readExternalFormFromBytes(objekt);
+            readExternalFormFromBytes(objekt);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/BulkTest.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/BulkTest.java b/src/test/org/apache/commons/collections/BulkTest.java
index 648b9b5..fd19542 100644
--- a/src/test/org/apache/commons/collections/BulkTest.java
+++ b/src/test/org/apache/commons/collections/BulkTest.java
@@ -246,7 +246,7 @@ public class BulkTest extends TestCase implements Cloneable {
      *  @return  a {@link TestSuite} containing all the simple and bulk tests
      *    defined by that class
      */
-    public static TestSuite makeSuite(Class c) {
+    public static TestSuite makeSuite(Class<? extends BulkTest> c) {
         if (Modifier.isAbstract(c.getModifiers())) {
             throw new IllegalArgumentException("Class must not be abstract.");
         }
@@ -265,10 +265,10 @@ public class BulkTest extends TestCase implements Cloneable {
 class BulkTestSuiteMaker {
 
     /** The class that defines simple and bulk tests methods. */
-    private Class startingClass;
+    private Class<? extends BulkTest> startingClass;
 
     /** List of ignored simple test names. */
-    private List ignored;
+    private List<String> ignored;
    
     /** The TestSuite we're currently populating.  Can change over time. */
     private TestSuite result;
@@ -284,7 +284,7 @@ class BulkTestSuiteMaker {
      *
      *  @param startingClass  the starting class
      */     
-    public BulkTestSuiteMaker(Class startingClass) {
+    public BulkTestSuiteMaker(Class<? extends BulkTest> startingClass) {
         this.startingClass = startingClass;
     }
 
@@ -299,7 +299,7 @@ class BulkTestSuiteMaker {
          result.setName(prefix);
 
          BulkTest bulk = makeFirstTestCase(startingClass);
-         ignored = new ArrayList();
+         ignored = new ArrayList<String>();
          String[] s = bulk.ignoredTests();
          if (s != null) {
              ignored.addAll(Arrays.asList(s));
@@ -316,7 +316,7 @@ class BulkTestSuiteMaker {
      *    tests for us to append
      */
     void make(BulkTest bulk) {
-        Class c = bulk.getClass();
+        Class<? extends BulkTest> c = bulk.getClass();
         Method[] all = c.getMethods();
         for (int i = 0; i < all.length; i++) {
             if (isTest(all[i])) addTest(bulk, all[i]);
@@ -388,7 +388,7 @@ class BulkTestSuiteMaker {
      *  @param c  the class
      *  @return the name of that class, minus any package names
      */
-    private static String getBaseName(Class c) {
+    private static String getBaseName(Class<?> c) {
         String name = c.getName();
         int p = name.lastIndexOf('.');
         if (p > 0) {
@@ -401,7 +401,7 @@ class BulkTestSuiteMaker {
     // These three methods are used to create a valid BulkTest instance
     // from a class.
 
-    private static Constructor getTestCaseConstructor(Class c) {
+    private static <T> Constructor<T> getTestCaseConstructor(Class<T> c) {
         try {
             return c.getConstructor(new Class[] { String.class });
         } catch (NoSuchMethodException e) {
@@ -410,10 +410,10 @@ class BulkTestSuiteMaker {
         }
     }
 
-    private static BulkTest makeTestCase(Class c, Method m) {
-        Constructor con = getTestCaseConstructor(c);
+    private static <T extends BulkTest> BulkTest makeTestCase(Class<T> c, Method m) {
+        Constructor<T> con = getTestCaseConstructor(c);
         try {
-            return (BulkTest)con.newInstance(new Object[] {m.getName()});
+            return (BulkTest) con.newInstance(new Object[] { m.getName() });
         } catch (InvocationTargetException e) {
             e.printStackTrace();
             throw new RuntimeException(); // FIXME;
@@ -424,7 +424,7 @@ class BulkTestSuiteMaker {
         }
     }
 
-    private static BulkTest makeFirstTestCase(Class c) {
+    private static <T extends BulkTest> BulkTest makeFirstTestCase(Class<T> c) {
         Method[] all = c.getMethods();
         for (int i = 0; i < all.length; i++) {
             if (isTest(all[i])) return makeTestCase(c, all[i]);

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/LocalTestNode.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/LocalTestNode.java b/src/test/org/apache/commons/collections/LocalTestNode.java
index ec31aeb..6eb0138 100644
--- a/src/test/org/apache/commons/collections/LocalTestNode.java
+++ b/src/test/org/apache/commons/collections/LocalTestNode.java
@@ -23,46 +23,50 @@ package org.apache.commons.collections;
  *
  * @author Marc Johnson (marcj at users dot sourceforge dot net)
  */
-class LocalTestNode implements Comparable {
+class LocalTestNode<K extends Comparable<K>, V extends Comparable<V>> implements Comparable<LocalTestNode<K, V>> {
 
-    private Comparable key;
-    private Comparable value;
+    private K key;
+    private V value;
+
+    static LocalTestNode<Integer, String> createLocalTestNode(final int key) {
+        return new LocalTestNode<Integer, String>(key, String.valueOf(key));
+    }
 
     /**
      * construct a LocalTestNode
      *
      * @param key value used to create the key and value
      */
-    LocalTestNode(final int key) {
-        this.key   = new Integer(key);
-        this.value = String.valueOf(key);
+    private LocalTestNode(K key, V value) {
+        this.key = key;
+        this.value = value;
     }
 
     /**
      * @param key the unique key associated with the current node.
      */
-    void setKey(Comparable key) {
+    void setKey(K key) {
         this.key = key;
     }
 
     /**
      * @return the unique key associated with the current node
      */
-    Comparable getKey() {
+    K getKey() {
         return key;
     }
 
     /**
      * @param value the unique value associated with the current node.
      */
-    void setValue(Comparable value) {
+    void setValue(V value) {
         this.value = value;
     }
 
     /**
      * @return the unique value associated with the current node
      */
-    Comparable getValue() {
+    V getValue() {
         return value;
     }
 
@@ -73,10 +77,9 @@ class LocalTestNode implements Comparable {
      *
      * @return
      */
-    public int compareTo(Object o) {
+    public int compareTo(LocalTestNode<K, V> other) {
 
-        LocalTestNode other = (LocalTestNode) o;
-        int           rval  = getKey().compareTo(other.getKey());
+        int rval = getKey().compareTo(other.getKey());
 
         if (rval == 0) {
             rval = getValue().compareTo(other.getValue());
@@ -92,6 +95,7 @@ class LocalTestNode implements Comparable {
      *
      * @return true if equal
      */
+    @SuppressWarnings("unchecked")
     public boolean equals(Object o) {
 
         if (o == null) {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/MapPerformance.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/MapPerformance.java b/src/test/org/apache/commons/collections/MapPerformance.java
index 85596f0..a7f6e0a 100644
--- a/src/test/org/apache/commons/collections/MapPerformance.java
+++ b/src/test/org/apache/commons/collections/MapPerformance.java
@@ -17,11 +17,11 @@
 package org.apache.commons.collections;
 
 import java.util.Collection;
-import java.util.Collections;
+//import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
-import java.util.TreeMap;
+//import java.util.TreeMap;
 
 import org.apache.commons.collections.map.Flat3Map;
 
@@ -43,17 +43,17 @@ public class MapPerformance {
     }
     
     private static void testAll() {
-        Map dummyMap = new DummyMap();
-        Map hashMap = new HashMap();
+        Map<String, String> dummyMap = new DummyMap<String, String>();
+        Map<String, String> hashMap = new HashMap<String, String>();
 //        hashMap.put("Alpha", "A");
 //        hashMap.put("Beta", "B");
 //        hashMap.put("Gamma", "C");
 //        hashMap.put("Delta", "D");
-        Map flatMap = new Flat3Map(hashMap);
+        Map<String, String> flatMap = new Flat3Map<String, String>(hashMap);
         System.out.println(flatMap);
-        Map unmodHashMap = Collections.unmodifiableMap(new HashMap(hashMap));
+//        Map<String, String> unmodHashMap = Collections.unmodifiableMap(new HashMap<String, String>(hashMap));
 //        Map fastHashMap = new FastHashMap(hashMap);
-        Map treeMap = new TreeMap(hashMap);
+//        Map<String, String> treeMap = new TreeMap<String, String>(hashMap);
 //        Map linkedMap = new LinkedHashMap(hashMap);
 //        Map syncMap = Collections.unmodifiableMap(new HashMap(hashMap));
 //        Map bucketMap = new StaticBucketMap();
@@ -109,9 +109,9 @@ public class MapPerformance {
 //        test(doubleMap,     "     DoubleMap ");
     }
 
-    private static void test(Map map, String name) {
+    private static void test(Map<String, String> map, String name) {
         long start = 0, end = 0;
-        int total = 0;
+//        int total = 0;
         start = System.currentTimeMillis();
         for (int i = RUNS; i > 0; i--) {
 //            if (map.get("Alpha") != null) total++;
@@ -133,7 +133,7 @@ public class MapPerformance {
 
     // ----------------------------------------------------------------------
 
-    private static class DummyMap implements Map {
+    private static class DummyMap<K, V> implements Map<K, V> {
         public void clear() {
         }
         public boolean containsKey(Object key) {
@@ -142,30 +142,30 @@ public class MapPerformance {
         public boolean containsValue(Object value) {
             return false;
         }
-        public Set entrySet() {
+        public Set<Map.Entry<K, V>> entrySet() {
             return null;
         }
-        public Object get(Object key) {
+        public V get(Object key) {
             return null;
         }
         public boolean isEmpty() {
             return false;
         }
-        public Set keySet() {
+        public Set<K> keySet() {
             return null;
         }
-        public Object put(Object key, Object value) {
+        public V put(K key, V value) {
             return null;
         }
-        public void putAll(Map t) {
+        public void putAll(Map<? extends K, ? extends V> t) {
         }
-        public Object remove(Object key) {
+        public V remove(Object key) {
             return null;
         }
         public int size() {
             return 0;
         }
-        public Collection values() {
+        public Collection<V> values() {
             return null;
         }
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/MockTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/MockTestCase.java b/src/test/org/apache/commons/collections/MockTestCase.java
index c1b47f2..9362fcd 100644
--- a/src/test/org/apache/commons/collections/MockTestCase.java
+++ b/src/test/org/apache/commons/collections/MockTestCase.java
@@ -17,7 +17,6 @@
 package org.apache.commons.collections;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 import java.util.ListIterator;
 
@@ -50,13 +49,13 @@ public abstract class MockTestCase {
 	}
 
 	protected final void replay() {
-		for (Iterator i = mockObjects.iterator(); i.hasNext();) {
-			EasyMock.replay(i.next());
+		for (Object o : mockObjects) {
+			EasyMock.replay(o);
 		}
 	}
 
 	protected final void verify() {
-		for (ListIterator i = mockObjects.listIterator(); i.hasNext();) {
+		for (ListIterator<Object> i = mockObjects.listIterator(); i.hasNext();) {
 			try {
 				EasyMock.verify(i.next());
 			} catch (AssertionError e) {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/TestArrayList.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestArrayList.java b/src/test/org/apache/commons/collections/TestArrayList.java
index 7107add..8251663 100644
--- a/src/test/org/apache/commons/collections/TestArrayList.java
+++ b/src/test/org/apache/commons/collections/TestArrayList.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.
@@ -25,15 +25,13 @@ import org.apache.commons.collections.list.AbstractTestList;
 
 /**
  * Abstract test class for ArrayList.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Jason van Zyl
  */
-public abstract class TestArrayList extends AbstractTestList {
-    
-    protected ArrayList list = null;
-    
+public abstract class TestArrayList<E> extends AbstractTestList<E> {
+
     public TestArrayList(String testName) {
         super(testName);
     }
@@ -47,12 +45,15 @@ public abstract class TestArrayList extends AbstractTestList {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public void setUp() {
-        list = (ArrayList) makeEmptyList();
-    }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public abstract ArrayList<E> makeObject();
 
     //-----------------------------------------------------------------------
     public void testNewArrayList() {
+        ArrayList<E> list = makeObject();
         assertTrue("New list is empty", list.isEmpty());
         assertEquals("New list has size zero", list.size(), 0);
 
@@ -64,9 +65,11 @@ public abstract class TestArrayList extends AbstractTestList {
         }
     }
 
+    @SuppressWarnings("unchecked")
     public void testSearch() {
-        list.add("First Item");
-        list.add("Last Item");
+        ArrayList<E> list = makeObject();
+        list.add((E) "First Item");
+        list.add((E) "Last Item");
         assertEquals("First item is 'First Item'", list.get(0), "First Item");
         assertEquals("Last Item is 'Last Item'", list.get(1), "Last Item");
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/TestArrayStack.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestArrayStack.java b/src/test/org/apache/commons/collections/TestArrayStack.java
index 54e8122..03a826a 100644
--- a/src/test/org/apache/commons/collections/TestArrayStack.java
+++ b/src/test/org/apache/commons/collections/TestArrayStack.java
@@ -17,7 +17,6 @@
 package org.apache.commons.collections;
 
 import java.util.EmptyStackException;
-import java.util.List;
 
 import junit.framework.Test;
 
@@ -28,10 +27,8 @@ import junit.framework.Test;
  * 
  * @author Craig McClanahan
  */
-public class TestArrayStack extends TestArrayList {
+public class TestArrayStack<E> extends TestArrayList<E> {
     
-    protected ArrayStack stack = null;
-
     public TestArrayStack(String testName) {
         super(testName);
     }
@@ -45,18 +42,13 @@ public class TestArrayStack extends TestArrayList {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public List makeEmptyList() {
-        return new ArrayStack();
-    }
-
-    public void setUp() {
-        stack = (ArrayStack) makeEmptyList();
-        list = stack;
+    public ArrayStack<E> makeObject() {
+        return new ArrayStack<E>();
     }
 
     //-----------------------------------------------------------------------
     public void testNewStack() {
-
+        ArrayStack<E> stack = makeObject();
         assertTrue("New stack is empty", stack.empty());
         assertEquals("New stack has size zero", stack.size(), 0);
 
@@ -76,16 +68,18 @@ public class TestArrayStack extends TestArrayList {
 
     }
 
+    @SuppressWarnings("unchecked")
     public void testPushPeekPop() {
+        ArrayStack<E> stack = makeObject();
 
-        stack.push("First Item");
+        stack.push((E) "First Item");
         assertTrue("Stack is not empty", !stack.empty());
         assertEquals("Stack size is one", stack.size(), 1);
         assertEquals("Top item is 'First Item'",
                      (String) stack.peek(), "First Item");
         assertEquals("Stack size is one", stack.size(), 1);
 
-        stack.push("Second Item");
+        stack.push((E) "Second Item");
         assertEquals("Stack size is two", stack.size(), 2);
         assertEquals("Top item is 'Second Item'",
                      (String) stack.peek(), "Second Item");
@@ -103,10 +97,12 @@ public class TestArrayStack extends TestArrayList {
 
     }
 
+    @SuppressWarnings("unchecked")
     public void testSearch() {
+        ArrayStack<E> stack = makeObject();
 
-        stack.push("First Item");
-        stack.push("Second Item");
+        stack.push((E) "First Item");
+        stack.push((E) "Second Item");
         assertEquals("Top item is 'Second Item'",
                      stack.search("Second Item"), 1);
         assertEquals("Next Item is 'First Item'",

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/TestBagUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestBagUtils.java b/src/test/org/apache/commons/collections/TestBagUtils.java
index 54600a4..ed0b351 100644
--- a/src/test/org/apache/commons/collections/TestBagUtils.java
+++ b/src/test/org/apache/commons/collections/TestBagUtils.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.
@@ -28,10 +28,11 @@ import org.apache.commons.collections.bag.TransformedSortedBag;
 import org.apache.commons.collections.bag.TreeBag;
 import org.apache.commons.collections.bag.UnmodifiableBag;
 import org.apache.commons.collections.bag.UnmodifiableSortedBag;
+import org.apache.commons.collections.functors.TruePredicate;
 
 /**
  * Tests for BagUtils factory methods.
- * 
+ *
  * @version $Revision$ $Date$
  *
  * @author Phil Steitz
@@ -46,17 +47,17 @@ public class TestBagUtils extends BulkTest {
     public static Test suite() {
         return BulkTest.makeSuite(TestBagUtils.class);
     }
-    
+
     //----------------------------------------------------------------------
 
-    protected Class stringClass = this.getName().getClass();
-    protected Predicate truePredicate = PredicateUtils.truePredicate();
-    protected Transformer nopTransformer = TransformerUtils.nopTransformer();
-    
+    protected Class<?> stringClass = this.getName().getClass();
+    protected Predicate<Object> truePredicate = TruePredicate.truePredicate();
+    protected Transformer<Object, Object> nopTransformer = TransformerUtils.nopTransformer();
+
     //----------------------------------------------------------------------
-    
+
     public void testSynchronizedBag() {
-        Bag bag = BagUtils.synchronizedBag(new HashBag());
+        Bag<Object> bag = BagUtils.synchronizedBag(new HashBag<Object>());
         assertTrue("Returned object should be a SynchronizedBag.",
             bag instanceof SynchronizedBag);
         try {
@@ -64,11 +65,11 @@ public class TestBagUtils extends BulkTest {
             fail("Expecting IllegalArgumentException for null bag.");
         } catch (IllegalArgumentException ex) {
             // expected
-        }  
+        }
     }
-    
+
     public void testUnmodifiableBag() {
-        Bag bag = BagUtils.unmodifiableBag(new HashBag());
+        Bag<Object> bag = BagUtils.unmodifiableBag(new HashBag<Object>());
         assertTrue("Returned object should be an UnmodifiableBag.",
             bag instanceof UnmodifiableBag);
         try {
@@ -76,11 +77,11 @@ public class TestBagUtils extends BulkTest {
             fail("Expecting IllegalArgumentException for null bag.");
         } catch (IllegalArgumentException ex) {
             // expected
-        }  
+        }
     }
-    
+
     public void testPredicatedBag() {
-        Bag bag = BagUtils.predicatedBag(new HashBag(), truePredicate);
+        Bag<Object> bag = BagUtils.predicatedBag(new HashBag<Object>(), truePredicate);
         assertTrue("Returned object should be a PredicatedBag.",
             bag instanceof PredicatedBag);
         try {
@@ -88,35 +89,35 @@ public class TestBagUtils extends BulkTest {
             fail("Expecting IllegalArgumentException for null bag.");
         } catch (IllegalArgumentException ex) {
             // expected
-        } 
+        }
         try {
-            bag = BagUtils.predicatedBag(new HashBag(), null);
+            bag = BagUtils.predicatedBag(new HashBag<Object>(), null);
             fail("Expecting IllegalArgumentException for null predicate.");
         } catch (IllegalArgumentException ex) {
             // expected
-        }  
+        }
     }
-    
+
      public void testTransformedBag() {
-        Bag bag = BagUtils.transformedBag(new HashBag(), nopTransformer);      
+        Bag<Object> bag = BagUtils.transformedBag(new HashBag<Object>(), nopTransformer);
         assertTrue("Returned object should be an TransformedBag.",
             bag instanceof TransformedBag);
         try {
-            bag = BagUtils.transformedBag(null, nopTransformer);      
+            bag = BagUtils.transformedBag(null, nopTransformer);
             fail("Expecting IllegalArgumentException for null bag.");
         } catch (IllegalArgumentException ex) {
             // expected
-        } 
+        }
         try {
-            bag = BagUtils.transformedBag(new HashBag(), null);  
+            bag = BagUtils.transformedBag(new HashBag<Object>(), null);
             fail("Expecting IllegalArgumentException for null transformer.");
         } catch (IllegalArgumentException ex) {
             // expected
-        }  
+        }
     }
-     
+
     public void testSynchronizedSortedBag() {
-        Bag bag = BagUtils.synchronizedSortedBag(new TreeBag());
+        Bag<Object> bag = BagUtils.synchronizedSortedBag(new TreeBag<Object>());
         assertTrue("Returned object should be a SynchronizedSortedBag.",
             bag instanceof SynchronizedSortedBag);
         try {
@@ -124,11 +125,11 @@ public class TestBagUtils extends BulkTest {
             fail("Expecting IllegalArgumentException for null bag.");
         } catch (IllegalArgumentException ex) {
             // expected
-        }  
+        }
     }
-    
+
     public void testUnmodifiableSortedBag() {
-        Bag bag = BagUtils.unmodifiableSortedBag(new TreeBag());
+        Bag<Object> bag = BagUtils.unmodifiableSortedBag(new TreeBag<Object>());
         assertTrue("Returned object should be an UnmodifiableSortedBag.",
             bag instanceof UnmodifiableSortedBag);
         try {
@@ -136,11 +137,11 @@ public class TestBagUtils extends BulkTest {
             fail("Expecting IllegalArgumentException for null bag.");
         } catch (IllegalArgumentException ex) {
             // expected
-        }  
+        }
     }
-    
+
     public void testPredicatedSortedBag() {
-        Bag bag = BagUtils.predicatedSortedBag(new TreeBag(), truePredicate);
+        Bag<Object> bag = BagUtils.predicatedSortedBag(new TreeBag<Object>(), truePredicate);
         assertTrue("Returned object should be a PredicatedSortedBag.",
             bag instanceof PredicatedSortedBag);
         try {
@@ -148,31 +149,31 @@ public class TestBagUtils extends BulkTest {
             fail("Expecting IllegalArgumentException for null bag.");
         } catch (IllegalArgumentException ex) {
             // expected
-        } 
+        }
         try {
-            bag = BagUtils.predicatedSortedBag(new TreeBag(), null);
+            bag = BagUtils.predicatedSortedBag(new TreeBag<Object>(), null);
             fail("Expecting IllegalArgumentException for null predicate.");
         } catch (IllegalArgumentException ex) {
             // expected
-        }  
+        }
     }
-    
+
     public void testTransformedSortedBag() {
-        Bag bag = BagUtils.transformedSortedBag(new TreeBag(), nopTransformer);      
+        Bag<Object> bag = BagUtils.transformedSortedBag(new TreeBag<Object>(), nopTransformer);
         assertTrue("Returned object should be an TransformedSortedBag",
             bag instanceof TransformedSortedBag);
         try {
-            bag = BagUtils.transformedSortedBag(null, nopTransformer);      
+            bag = BagUtils.transformedSortedBag(null, nopTransformer);
             fail("Expecting IllegalArgumentException for null bag.");
         } catch (IllegalArgumentException ex) {
             // expected
-        } 
+        }
         try {
-            bag = BagUtils.transformedSortedBag(new TreeBag(), null);  
+            bag = BagUtils.transformedSortedBag(new TreeBag<Object>(), null);
             fail("Expecting IllegalArgumentException for null transformer.");
         } catch (IllegalArgumentException ex) {
             // expected
-        }  
+        }
     }
 }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/TestBufferUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestBufferUtils.java b/src/test/org/apache/commons/collections/TestBufferUtils.java
index 503e5f0..5d860b2 100644
--- a/src/test/org/apache/commons/collections/TestBufferUtils.java
+++ b/src/test/org/apache/commons/collections/TestBufferUtils.java
@@ -42,16 +42,16 @@ public class TestBufferUtils extends BulkTest {
     }
 
     public void testpredicatedBuffer() {
-        Predicate predicate = new Predicate() {
+        Predicate<Object> predicate = new Predicate<Object>() {
             public boolean evaluate(Object o) {
                 return o instanceof String;
             }
         };
-        Buffer buffer = BufferUtils.predicatedBuffer(new ArrayStack(), predicate);
+        Buffer<Object> buffer = BufferUtils.predicatedBuffer(new ArrayStack<Object>(), predicate);
         assertTrue("returned object should be a PredicatedBuffer",
             buffer instanceof PredicatedBuffer);
         try {
-            buffer = BufferUtils.predicatedBuffer(new ArrayStack(), null);
+            buffer = BufferUtils.predicatedBuffer(new ArrayStack<Object>(), null);
             fail("Expecting IllegalArgumentException for null predicate.");
         } catch (IllegalArgumentException ex) {
             // expected

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/TestClosureUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestClosureUtils.java b/src/test/org/apache/commons/collections/TestClosureUtils.java
index 297e5db..dc2de5d 100644
--- a/src/test/org/apache/commons/collections/TestClosureUtils.java
+++ b/src/test/org/apache/commons/collections/TestClosureUtils.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.
@@ -27,11 +27,13 @@ import junit.framework.TestSuite;
 import junit.textui.TestRunner;
 
 import org.apache.commons.collections.functors.EqualPredicate;
+import org.apache.commons.collections.functors.FalsePredicate;
 import org.apache.commons.collections.functors.NOPClosure;
+import org.apache.commons.collections.functors.TruePredicate;
 
 /**
  * Tests the org.apache.commons.collections.ClosureUtils class.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
@@ -51,7 +53,7 @@ public class TestClosureUtils extends junit.framework.TestCase {
     /**
      * Main.
      * @param args
-     */    
+     */
     public static void main(String[] args) {
         TestRunner.run(suite());
     }
@@ -74,18 +76,23 @@ public class TestClosureUtils extends junit.framework.TestCase {
      */
     public void tearDown() {
     }
-    
-    static class MockClosure implements Closure {
+
+    static class MockClosure<T> implements Closure<T> {
         int count = 0;
-        
-        public void execute(Object object) {
+
+        public void execute(T object) {
             count++;
         }
+
+        public void reset() {
+            count = 0;
+        }
     }
-    static class MockTransformer implements Transformer {
+
+    static class MockTransformer<T> implements Transformer<T, T> {
         int count = 0;
-        
-        public Object transform(Object object) {
+
+        public T transform(T object) {
             count++;
             return object;
         }
@@ -108,7 +115,7 @@ public class TestClosureUtils extends junit.framework.TestCase {
         }
         fail();
     }
-    
+
     // nopClosure
     //------------------------------------------------------------------
 
@@ -136,11 +143,11 @@ public class TestClosureUtils extends junit.framework.TestCase {
     //------------------------------------------------------------------
 
     public void testForClosure() {
-        MockClosure cmd = new MockClosure();
+        MockClosure<Object> cmd = new MockClosure<Object>();
         ClosureUtils.forClosure(5, cmd).execute(null);
         assertEquals(5, cmd.count);
-        assertSame(NOPClosure.INSTANCE, ClosureUtils.forClosure(0, new MockClosure()));
-        assertSame(NOPClosure.INSTANCE, ClosureUtils.forClosure(-1, new MockClosure()));
+        assertSame(NOPClosure.INSTANCE, ClosureUtils.forClosure(0, new MockClosure<Object>()));
+        assertSame(NOPClosure.INSTANCE, ClosureUtils.forClosure(-1, new MockClosure<Object>()));
         assertSame(NOPClosure.INSTANCE, ClosureUtils.forClosure(1, null));
         assertSame(NOPClosure.INSTANCE, ClosureUtils.forClosure(3, null));
         assertSame(cmd, ClosureUtils.forClosure(1, cmd));
@@ -150,20 +157,20 @@ public class TestClosureUtils extends junit.framework.TestCase {
     //------------------------------------------------------------------
 
     public void testWhileClosure() {
-        MockClosure cmd = new MockClosure();
-        ClosureUtils.whileClosure(PredicateUtils.falsePredicate(), cmd).execute(null);
+        MockClosure<Object> cmd = new MockClosure<Object>();
+        ClosureUtils.whileClosure(FalsePredicate.falsePredicate(), cmd).execute(null);
         assertEquals(0, cmd.count);
-        
-        cmd = new MockClosure();
+
+        cmd = new MockClosure<Object>();
         ClosureUtils.whileClosure(PredicateUtils.uniquePredicate(), cmd).execute(null);
         assertEquals(1, cmd.count);
-        
+
         try {
             ClosureUtils.whileClosure(null, ClosureUtils.nopClosure());
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            ClosureUtils.whileClosure(PredicateUtils.falsePredicate(), null);
+            ClosureUtils.whileClosure(FalsePredicate.falsePredicate(), null);
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
@@ -176,14 +183,14 @@ public class TestClosureUtils extends junit.framework.TestCase {
     //------------------------------------------------------------------
 
     public void testDoWhileClosure() {
-        MockClosure cmd = new MockClosure();
-        ClosureUtils.doWhileClosure(cmd, PredicateUtils.falsePredicate()).execute(null);
+        MockClosure<Object> cmd = new MockClosure<Object>();
+        ClosureUtils.doWhileClosure(cmd, FalsePredicate.falsePredicate()).execute(null);
         assertEquals(1, cmd.count);
-        
-        cmd = new MockClosure();
+
+        cmd = new MockClosure<Object>();
         ClosureUtils.doWhileClosure(cmd, PredicateUtils.uniquePredicate()).execute(null);
         assertEquals(2, cmd.count);
-        
+
         try {
             ClosureUtils.doWhileClosure(null, null);
             fail();
@@ -193,135 +200,137 @@ public class TestClosureUtils extends junit.framework.TestCase {
     // chainedClosure
     //------------------------------------------------------------------
 
+    @SuppressWarnings("unchecked")
     public void testChainedClosure() {
-        MockClosure a = new MockClosure();
-        MockClosure b = new MockClosure();
+        MockClosure<Object> a = new MockClosure<Object>();
+        MockClosure<Object> b = new MockClosure<Object>();
         ClosureUtils.chainedClosure(a, b).execute(null);
         assertEquals(1, a.count);
         assertEquals(1, b.count);
-        
-        a = new MockClosure();
-        b = new MockClosure();
-        ClosureUtils.chainedClosure(new Closure[] {a, b, a}).execute(null);
+
+        a = new MockClosure<Object>();
+        b = new MockClosure<Object>();
+        ClosureUtils.<Object>chainedClosure(new Closure[] {a, b, a}).execute(null);
         assertEquals(2, a.count);
         assertEquals(1, b.count);
-        
-        a = new MockClosure();
-        b = new MockClosure();
-        Collection coll = new ArrayList();
+
+        a = new MockClosure<Object>();
+        b = new MockClosure<Object>();
+        Collection<Closure<Object>> coll = new ArrayList<Closure<Object>>();
         coll.add(b);
         coll.add(a);
         coll.add(b);
-        ClosureUtils.chainedClosure(coll).execute(null);
+        ClosureUtils.<Object>chainedClosure(coll).execute(null);
         assertEquals(1, a.count);
         assertEquals(2, b.count);
-        
-        assertSame(NOPClosure.INSTANCE, ClosureUtils.chainedClosure(new Closure[0]));
-        assertSame(NOPClosure.INSTANCE, ClosureUtils.chainedClosure(Collections.EMPTY_LIST));
-        
+
+        assertSame(NOPClosure.INSTANCE, ClosureUtils.<Object>chainedClosure(new Closure[0]));
+        assertSame(NOPClosure.INSTANCE, ClosureUtils.<Object>chainedClosure(Collections.<Closure<Object>>emptyList()));
+
         try {
             ClosureUtils.chainedClosure(null, null);
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            ClosureUtils.chainedClosure((Closure[]) null);
+            ClosureUtils.<Object>chainedClosure((Closure[]) null);
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            ClosureUtils.chainedClosure((Collection) null);
+            ClosureUtils.<Object>chainedClosure((Collection<Closure<Object>>) null);
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            ClosureUtils.chainedClosure(new Closure[] {null, null});
+            ClosureUtils.<Object>chainedClosure(new Closure[] {null, null});
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            coll = new ArrayList();
+            coll = new ArrayList<Closure<Object>>();
             coll.add(null);
             coll.add(null);
             ClosureUtils.chainedClosure(coll);
             fail();
         } catch (IllegalArgumentException ex) {}
     }
-    
+
     // ifClosure
     //------------------------------------------------------------------
 
     public void testIfClosure() {
-        MockClosure a = new MockClosure();
-        MockClosure b = null;
-        ClosureUtils.ifClosure(PredicateUtils.truePredicate(), a).execute(null);
+        MockClosure<Object> a = new MockClosure<Object>();
+        MockClosure<Object> b = null;
+        ClosureUtils.ifClosure(TruePredicate.truePredicate(), a).execute(null);
         assertEquals(1, a.count);
 
-        a = new MockClosure();
-        ClosureUtils.ifClosure(PredicateUtils.falsePredicate(), a).execute(null);
+        a = new MockClosure<Object>();
+        ClosureUtils.ifClosure(FalsePredicate.<Object>falsePredicate(), a).execute(null);
         assertEquals(0, a.count);
 
-        a = new MockClosure();
-        b = new MockClosure();
-        ClosureUtils.ifClosure(PredicateUtils.truePredicate(), a, b).execute(null);
+        a = new MockClosure<Object>();
+        b = new MockClosure<Object>();
+        ClosureUtils.ifClosure(TruePredicate.<Object>truePredicate(), a, b).execute(null);
         assertEquals(1, a.count);
         assertEquals(0, b.count);
-        
-        a = new MockClosure();
-        b = new MockClosure();
-        ClosureUtils.ifClosure(PredicateUtils.falsePredicate(), a, b).execute(null);
+
+        a = new MockClosure<Object>();
+        b = new MockClosure<Object>();
+        ClosureUtils.ifClosure(FalsePredicate.<Object>falsePredicate(), a, b).execute(null);
         assertEquals(0, a.count);
         assertEquals(1, b.count);
-    }        
+    }
 
     // switchClosure
     //------------------------------------------------------------------
 
+    @SuppressWarnings("unchecked")
     public void testSwitchClosure() {
-        MockClosure a = new MockClosure();
-        MockClosure b = new MockClosure();
-        ClosureUtils.switchClosure(
-            new Predicate[] {EqualPredicate.equalPredicate("HELLO"), EqualPredicate.equalPredicate("THERE")}, 
-            new Closure[] {a, b}).execute("WELL");
+        MockClosure<String> a = new MockClosure<String>();
+        MockClosure<String> b = new MockClosure<String>();
+        ClosureUtils.<String>switchClosure(
+            new Predicate[] { EqualPredicate.equalPredicate("HELLO"), EqualPredicate.equalPredicate("THERE") },
+            new Closure[] { a, b }).execute("WELL");
         assertEquals(0, a.count);
         assertEquals(0, b.count);
-        
-        a = new MockClosure();
-        b = new MockClosure();
-        ClosureUtils.switchClosure(
-            new Predicate[] {EqualPredicate.equalPredicate("HELLO"), EqualPredicate.equalPredicate("THERE")}, 
-            new Closure[] {a, b}).execute("HELLO");
+
+        a.reset();
+        b.reset();
+        ClosureUtils.<String>switchClosure(
+            new Predicate[] { EqualPredicate.equalPredicate("HELLO"), EqualPredicate.equalPredicate("THERE") },
+            new Closure[] { a, b }).execute("HELLO");
         assertEquals(1, a.count);
         assertEquals(0, b.count);
-        
-        a = new MockClosure();
-        b = new MockClosure();
-        MockClosure c = new MockClosure();
-        ClosureUtils.switchClosure(
-            new Predicate[] {EqualPredicate.equalPredicate("HELLO"), EqualPredicate.equalPredicate("THERE")}, 
-            new Closure[] {a, b}, c).execute("WELL");
+
+        a.reset();
+        b.reset();
+        MockClosure<String> c = new MockClosure<String>();
+        ClosureUtils.<String>switchClosure(
+            new Predicate[] { EqualPredicate.equalPredicate("HELLO"), EqualPredicate.equalPredicate("THERE") },
+            new Closure[] { a, b }, c).execute("WELL");
         assertEquals(0, a.count);
         assertEquals(0, b.count);
         assertEquals(1, c.count);
-        
-        a = new MockClosure();
-        b = new MockClosure();
-        Map map = new HashMap();
+
+        a.reset();
+        b.reset();
+        Map<Predicate<String>, Closure<String>> map = new HashMap<Predicate<String>, Closure<String>>();
         map.put(EqualPredicate.equalPredicate("HELLO"), a);
         map.put(EqualPredicate.equalPredicate("THERE"), b);
-        ClosureUtils.switchClosure(map).execute(null);
+        ClosureUtils.<String>switchClosure(map).execute(null);
         assertEquals(0, a.count);
         assertEquals(0, b.count);
 
-        a = new MockClosure();
-        b = new MockClosure();
-        map = new HashMap();
+        a.reset();
+        b.reset();
+        map.clear();
         map.put(EqualPredicate.equalPredicate("HELLO"), a);
         map.put(EqualPredicate.equalPredicate("THERE"), b);
         ClosureUtils.switchClosure(map).execute("THERE");
         assertEquals(0, a.count);
         assertEquals(1, b.count);
 
-        a = new MockClosure();
-        b = new MockClosure();
-        c = new MockClosure();
-        map = new HashMap();
+        a.reset();
+        b.reset();
+        c.reset();
+        map.clear();
         map.put(EqualPredicate.equalPredicate("HELLO"), a);
         map.put(EqualPredicate.equalPredicate("THERE"), b);
         map.put(null, c);
@@ -329,63 +338,63 @@ public class TestClosureUtils extends junit.framework.TestCase {
         assertEquals(0, a.count);
         assertEquals(0, b.count);
         assertEquals(1, c.count);
-        
-        assertSame(NOPClosure.INSTANCE, ClosureUtils.switchClosure(new Predicate[0], new Closure[0]));
-        assertSame(NOPClosure.INSTANCE, ClosureUtils.switchClosure(new HashMap()));
-        map = new HashMap();
+
+        assertEquals(NOPClosure.INSTANCE, ClosureUtils.<String>switchClosure(new Predicate[0], new Closure[0]));
+        assertEquals(NOPClosure.INSTANCE, ClosureUtils.<String>switchClosure(new HashMap<Predicate<String>, Closure<String>>()));
+        map.clear();
         map.put(null, null);
-        assertSame(NOPClosure.INSTANCE, ClosureUtils.switchClosure(map));
+        assertEquals(NOPClosure.INSTANCE, ClosureUtils.switchClosure(map));
 
         try {
             ClosureUtils.switchClosure(null, null);
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            ClosureUtils.switchClosure((Predicate[]) null, (Closure[]) null);
+            ClosureUtils.<String>switchClosure((Predicate<String>[]) null, (Closure<String>[]) null);
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            ClosureUtils.switchClosure((Map) null);
+            ClosureUtils.<String>switchClosure((Map<Predicate<String>, Closure<String>>) null);
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            ClosureUtils.switchClosure(new Predicate[2], new Closure[2]);
+            ClosureUtils.<String>switchClosure(new Predicate[2], new Closure[2]);
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            ClosureUtils.switchClosure(
-                    new Predicate[] {PredicateUtils.truePredicate()},
-                    new Closure[] {a,b});
+            ClosureUtils.<String>switchClosure(
+                    new Predicate[] { TruePredicate.<String>truePredicate() },
+                    new Closure[] { a, b });
             fail();
         } catch (IllegalArgumentException ex) {}
     }
-    
+
     // switchMapClosure
     //------------------------------------------------------------------
 
     public void testSwitchMapClosure() {
-        MockClosure a = new MockClosure();
-        MockClosure b = new MockClosure();
-        Map map = new HashMap();
+        MockClosure<String> a = new MockClosure<String>();
+        MockClosure<String> b = new MockClosure<String>();
+        Map<String, Closure<String>> map = new HashMap<String, Closure<String>>();
         map.put("HELLO", a);
         map.put("THERE", b);
         ClosureUtils.switchMapClosure(map).execute(null);
         assertEquals(0, a.count);
         assertEquals(0, b.count);
 
-        a = new MockClosure();
-        b = new MockClosure();
-        map = new HashMap();
+        a.reset();
+        b.reset();
+        map.clear();
         map.put("HELLO", a);
         map.put("THERE", b);
         ClosureUtils.switchMapClosure(map).execute("THERE");
         assertEquals(0, a.count);
         assertEquals(1, b.count);
 
-        a = new MockClosure();
-        b = new MockClosure();
-        MockClosure c = new MockClosure();
-        map = new HashMap();
+        a.reset();
+        b.reset();
+        map.clear();
+        MockClosure<String> c = new MockClosure<String>();
         map.put("HELLO", a);
         map.put("THERE", b);
         map.put(null, c);
@@ -394,26 +403,26 @@ public class TestClosureUtils extends junit.framework.TestCase {
         assertEquals(0, b.count);
         assertEquals(1, c.count);
 
-        assertSame(NOPClosure.INSTANCE, ClosureUtils.switchMapClosure(new HashMap()));
-        
+        assertEquals(NOPClosure.INSTANCE, ClosureUtils.switchMapClosure(new HashMap<String, Closure<String>>()));
+
         try {
             ClosureUtils.switchMapClosure(null);
             fail();
         } catch (IllegalArgumentException ex) {}
     }
-    
+
     // asClosure
     //------------------------------------------------------------------
 
     public void testTransformerClosure() {
-        MockTransformer mock = new MockTransformer();
-        Closure closure = ClosureUtils.asClosure(mock);
+        MockTransformer<Object> mock = new MockTransformer<Object>();
+        Closure<Object> closure = ClosureUtils.asClosure(mock);
         closure.execute(null);
         assertEquals(1, mock.count);
         closure.execute(null);
         assertEquals(2, mock.count);
-        
-        assertSame(ClosureUtils.nopClosure(), ClosureUtils.asClosure(null));
+
+        assertEquals(ClosureUtils.nopClosure(), ClosureUtils.asClosure(null));
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/TestCollectionUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestCollectionUtils.java b/src/test/org/apache/commons/collections/TestCollectionUtils.java
index 9d792df..02732fc 100644
--- a/src/test/org/apache/commons/collections/TestCollectionUtils.java
+++ b/src/test/org/apache/commons/collections/TestCollectionUtils.java
@@ -31,7 +31,6 @@ import org.apache.commons.collections.collection.PredicatedCollection;
 import org.apache.commons.collections.collection.SynchronizedCollection;
 import org.apache.commons.collections.collection.TransformedCollection;
 import org.apache.commons.collections.collection.UnmodifiableCollection;
-import org.apache.commons.collections.functors.EqualPredicate;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -139,7 +138,7 @@ public class TestCollectionUtils extends MockTestCase {
 
     @Test
     public void getCardinalityMap() {
-        Map<Number, Integer> freqA = CollectionUtils.<Number, Integer>getCardinalityMap(iterableA);
+        Map<Number, Integer> freqA = CollectionUtils.<Number>getCardinalityMap(iterableA);
         assertEquals(1, (int) freqA.get(1));
         assertEquals(2, (int) freqA.get(2));
         assertEquals(3, (int) freqA.get(3));
@@ -185,7 +184,7 @@ public class TestCollectionUtils extends MockTestCase {
         assertEquals(0, CollectionUtils.cardinality("D", set));
         assertEquals(1, CollectionUtils.cardinality("E", set));
 
-        Bag<String> bag = new HashBag();
+        Bag<String> bag = new HashBag<String>();
         bag.add("A", 3);
         bag.add("C");
         bag.add("E");
@@ -202,43 +201,43 @@ public class TestCollectionUtils extends MockTestCase {
         List<String> list = new ArrayList<String>();
         assertEquals(0, CollectionUtils.cardinality(null, list));
         {
-            Map freq = CollectionUtils.getCardinalityMap(list);
+            Map<String, Integer> freq = CollectionUtils.getCardinalityMap(list);
             assertNull(freq.get(null));
         }
         list.add("A");
         assertEquals(0, CollectionUtils.cardinality(null, list));
         {
-            Map freq = CollectionUtils.getCardinalityMap(list);
+            Map<String, Integer> freq = CollectionUtils.getCardinalityMap(list);
             assertNull(freq.get(null));
         }
         list.add(null);
         assertEquals(1, CollectionUtils.cardinality(null, list));
         {
-            Map freq = CollectionUtils.getCardinalityMap(list);
+            Map<String, Integer> freq = CollectionUtils.getCardinalityMap(list);
             assertEquals(1, freq.get(null));
         }
         list.add("B");
         assertEquals(1, CollectionUtils.cardinality(null, list));
         {
-            Map freq = CollectionUtils.getCardinalityMap(list);
+            Map<String, Integer> freq = CollectionUtils.getCardinalityMap(list);
             assertEquals(1, freq.get(null));
         }
         list.add(null);
         assertEquals(2, CollectionUtils.cardinality(null, list));
         {
-            Map freq = CollectionUtils.getCardinalityMap(list);
+            Map<String, Integer> freq = CollectionUtils.getCardinalityMap(list);
             assertEquals(2, freq.get(null));
         }
         list.add("B");
         assertEquals(2, CollectionUtils.cardinality(null, list));
         {
-            Map freq = CollectionUtils.getCardinalityMap(list);
+            Map<String, Integer> freq = CollectionUtils.getCardinalityMap(list);
             assertEquals(2, freq.get(null));
         }
         list.add(null);
         assertEquals(3, CollectionUtils.cardinality(null, list));
         {
-            Map freq = CollectionUtils.getCardinalityMap(list);
+            Map<String, Integer> freq = CollectionUtils.getCardinalityMap(list);
             assertEquals(3, freq.get(null));
         }
     }
@@ -275,7 +274,7 @@ public class TestCollectionUtils extends MockTestCase {
     @Test
     public void union() {
         Collection<Integer> col = CollectionUtils.union(iterableA, iterableC);
-        Map freq = CollectionUtils.getCardinalityMap(col);
+        Map<Integer, Integer> freq = CollectionUtils.getCardinalityMap(col);
         assertEquals(1, freq.get(1));
         assertEquals(4, freq.get(2));
         assertEquals(3, freq.get(3));
@@ -283,7 +282,7 @@ public class TestCollectionUtils extends MockTestCase {
         assertEquals(1, freq.get(5));
 
         Collection<Number> col2 = CollectionUtils.union(collectionC2, iterableA);
-        Map freq2 = CollectionUtils.getCardinalityMap(col2);
+        Map<Number, Integer> freq2 = CollectionUtils.getCardinalityMap(col2);
         assertEquals(1, freq2.get(1));
         assertEquals(4, freq2.get(2));
         assertEquals(3, freq2.get(3));
@@ -294,7 +293,7 @@ public class TestCollectionUtils extends MockTestCase {
     @Test
     public void intersection() {
         Collection<Integer> col = CollectionUtils.intersection(iterableA, iterableC);
-        Map freq = CollectionUtils.getCardinalityMap(col);
+        Map<Integer, Integer> freq = CollectionUtils.getCardinalityMap(col);
         assertNull(freq.get(1));
         assertEquals(2, freq.get(2));
         assertEquals(3, freq.get(3));
@@ -302,7 +301,7 @@ public class TestCollectionUtils extends MockTestCase {
         assertNull(freq.get(5));
 
         Collection<Number> col2 = CollectionUtils.intersection(collectionC2, collectionA);
-        Map freq2 = CollectionUtils.getCardinalityMap(col2);
+        Map<Number, Integer> freq2 = CollectionUtils.getCardinalityMap(col2);
         assertNull(freq2.get(1));
         assertEquals(2, freq2.get(2));
         assertEquals(3, freq2.get(3));
@@ -313,7 +312,7 @@ public class TestCollectionUtils extends MockTestCase {
     @Test
     public void disjunction() {
         Collection<Integer> col = CollectionUtils.disjunction(iterableA, iterableC);
-        Map freq = CollectionUtils.getCardinalityMap(col);
+        Map<Integer, Integer> freq = CollectionUtils.getCardinalityMap(col);
         assertEquals(1, freq.get(1));
         assertEquals(2, freq.get(2));
         assertNull(freq.get(3));
@@ -321,7 +320,7 @@ public class TestCollectionUtils extends MockTestCase {
         assertEquals(1, freq.get(5));
 
         Collection<Number> col2 = CollectionUtils.disjunction(collectionC2, collectionA);
-        Map freq2 = CollectionUtils.getCardinalityMap(col2);
+        Map<Number, Integer> freq2 = CollectionUtils.getCardinalityMap(col2);
         assertEquals(1, freq2.get(1));
         assertEquals(2, freq2.get(2));
         assertNull(freq2.get(3));
@@ -348,7 +347,7 @@ public class TestCollectionUtils extends MockTestCase {
     @Test
     public void testSubtract() {
         Collection<Integer> col = CollectionUtils.subtract(iterableA, iterableC);
-        Map freq = CollectionUtils.getCardinalityMap(col);
+        Map<Integer, Integer> freq = CollectionUtils.getCardinalityMap(col);
         assertEquals(1, freq.get(1));
         assertNull(freq.get(2));
         assertNull(freq.get(3));
@@ -356,7 +355,7 @@ public class TestCollectionUtils extends MockTestCase {
         assertNull(freq.get(5));
 
         Collection<Number> col2 = CollectionUtils.subtract(collectionC2, collectionA);
-        Map freq2 = CollectionUtils.getCardinalityMap(col2);
+        Map<Number, Integer> freq2 = CollectionUtils.getCardinalityMap(col2);
         assertEquals(1, freq2.get(5));
         assertNull(freq2.get(4));
         assertNull(freq2.get(3));
@@ -500,8 +499,8 @@ public class TestCollectionUtils extends MockTestCase {
 
     @Test
     public void forAllDo() {
-        Closure<Collection> testClosure = ClosureUtils.invokerClosure("clear");
-        Collection<List> col = new ArrayList<List>();
+        Closure<List<? extends Number>> testClosure = ClosureUtils.invokerClosure("clear");
+        Collection<List<? extends Number>> col = new ArrayList<List<? extends Number>>();
         col.add(collectionA);
         col.add(collectionB);
         CollectionUtils.forAllDo(col, testClosure);
@@ -601,10 +600,10 @@ public class TestCollectionUtils extends MockTestCase {
     @Test
     public void getFromEnumeration() throws Exception {
         // Enumeration, entry exists
-        Vector vector = new Vector();
+        Vector<String> vector = new Vector<String>();
         vector.addElement("zero");
         vector.addElement("one");
-        Enumeration en = vector.elements();
+        Enumeration<String> en = vector.elements();
         assertEquals("zero", CollectionUtils.get(en, 0));
         en = vector.elements();
         assertEquals("one", CollectionUtils.get(en, 1));
@@ -622,7 +621,7 @@ public class TestCollectionUtils extends MockTestCase {
     @Test(expected = IndexOutOfBoundsException.class)
     public void getFromIterable() throws Exception {
         // Collection, entry exists
-        Bag bag = new HashBag();
+        Bag<String> bag = new HashBag<String>();
         bag.add("element", 1);
         assertEquals("element", CollectionUtils.get(bag, 0));
 
@@ -714,7 +713,7 @@ public class TestCollectionUtils extends MockTestCase {
 
     @Test
     public void testSize_Enumeration() {
-        Vector list = new Vector();
+        Vector<String> list = new Vector<String>();
         assertEquals(0, CollectionUtils.size(list.elements()));
         list.add("a");
         assertEquals(1, CollectionUtils.size(list.elements()));
@@ -724,7 +723,7 @@ public class TestCollectionUtils extends MockTestCase {
 
     @Test
     public void testSize_Iterator() {
-        List list = new ArrayList();
+        List<String> list = new ArrayList<String>();
         assertEquals(0, CollectionUtils.size(list.iterator()));
         list.add("a");
         assertEquals(1, CollectionUtils.size(list.iterator()));
@@ -795,7 +794,7 @@ public class TestCollectionUtils extends MockTestCase {
         assertEquals(true, CollectionUtils.sizeIsEmpty(list.elements()));
         list.add("a");
         assertEquals(false, CollectionUtils.sizeIsEmpty(list.elements()));
-        Enumeration en = list.elements();
+        Enumeration<String> en = list.elements();
         en.nextElement();
         assertEquals(true, CollectionUtils.sizeIsEmpty(en));
     }
@@ -806,7 +805,7 @@ public class TestCollectionUtils extends MockTestCase {
         assertEquals(true, CollectionUtils.sizeIsEmpty(list.iterator()));
         list.add("a");
         assertEquals(false, CollectionUtils.sizeIsEmpty(list.iterator()));
-        Iterator it = list.iterator();
+        Iterator<String> it = list.iterator();
         it.next();
         assertEquals(true, CollectionUtils.sizeIsEmpty(it));
     }
@@ -828,7 +827,7 @@ public class TestCollectionUtils extends MockTestCase {
     // -----------------------------------------------------------------------
     @Test
     public void testIsEmptyWithEmptyCollection() {
-        Collection coll = new ArrayList();
+        Collection<Object> coll = new ArrayList<Object>();
         assertEquals(true, CollectionUtils.isEmpty(coll));
     }
 
@@ -841,13 +840,13 @@ public class TestCollectionUtils extends MockTestCase {
 
     @Test
     public void testIsEmptyWithNull() {
-        Collection coll = null;
+        Collection<?> coll = null;
         assertEquals(true, CollectionUtils.isEmpty(coll));
     }
 
     @Test
     public void testIsNotEmptyWithEmptyCollection() {
-        Collection coll = new ArrayList();
+        Collection<Object> coll = new ArrayList<Object>();
         assertEquals(false, CollectionUtils.isNotEmpty(coll));
     }
 
@@ -860,7 +859,7 @@ public class TestCollectionUtils extends MockTestCase {
 
     @Test
     public void testIsNotEmptyWithNull() {
-        Collection coll = null;
+        Collection<?> coll = null;
         assertEquals(false, CollectionUtils.isNotEmpty(coll));
     }
 
@@ -930,7 +929,7 @@ public class TestCollectionUtils extends MockTestCase {
         list.add(4);
         // Ensure that the collection is the input type or a super type
         Collection<Integer> output1 = CollectionUtils.select(list, EQUALS_TWO);
-        Collection<Number> output2 = CollectionUtils.<Number, Integer>select(list, EQUALS_TWO);
+        Collection<Number> output2 = CollectionUtils.<Number>select(list, EQUALS_TWO);
         HashSet<Number> output3 = CollectionUtils.select(list, EQUALS_TWO, new HashSet<Number>());
         assertTrue(CollectionUtils.isEqualCollection(output1, output3));
         assertEquals(4, list.size());
@@ -946,7 +945,7 @@ public class TestCollectionUtils extends MockTestCase {
         list.add(3L);
         list.add(4L);
         Collection<Long> output1 = CollectionUtils.selectRejected(list, EQUALS_TWO);
-        Collection<Number> output2 = CollectionUtils.<Number, Long>selectRejected(list, EQUALS_TWO);
+        Collection<? extends Number> output2 = CollectionUtils.selectRejected(list, EQUALS_TWO);
         HashSet<Number> output3 = CollectionUtils.selectRejected(list, EQUALS_TWO, new HashSet<Number>());
         assertTrue(CollectionUtils.isEqualCollection(output1, output2));
         assertTrue(CollectionUtils.isEqualCollection(output1, output3));
@@ -1091,7 +1090,7 @@ public class TestCollectionUtils extends MockTestCase {
         }
         assertFalse(CollectionUtils.isFull(set));
 
-        BoundedFifoBuffer buf = new BoundedFifoBuffer(set);
+        BoundedFifoBuffer<String> buf = new BoundedFifoBuffer<String>(set);
         assertEquals(true, CollectionUtils.isFull(buf));
         buf.remove("2");
         assertFalse(CollectionUtils.isFull(buf));
@@ -1125,7 +1124,7 @@ public class TestCollectionUtils extends MockTestCase {
         }
         assertEquals(-1, CollectionUtils.maxSize(set));
 
-        Buffer<String> buf = new BoundedFifoBuffer(set);
+        Buffer<String> buf = new BoundedFifoBuffer<String>(set);
         assertEquals(3, CollectionUtils.maxSize(buf));
         buf.remove("2");
         assertEquals(3, CollectionUtils.maxSize(buf));
@@ -1217,16 +1216,16 @@ public class TestCollectionUtils extends MockTestCase {
 
     @Test
     public void testRemoveAll() {
-        List base = new ArrayList();
+        List<String> base = new ArrayList<String>();
         base.add("A");
         base.add("B");
         base.add("C");
-        List sub = new ArrayList();
+        List<String> sub = new ArrayList<String>();
         sub.add("A");
         sub.add("C");
         sub.add("X");
 
-        Collection result = CollectionUtils.removeAll(base, sub);
+        Collection<String> result = CollectionUtils.removeAll(base, sub);
         assertEquals(1, result.size());
         assertFalse(result.contains("A"));
         assertEquals(true, result.contains("B"));
@@ -1250,11 +1249,11 @@ public class TestCollectionUtils extends MockTestCase {
     // -----------------------------------------------------------------------
     @Test
     public void testTransformedCollection() {
-        Transformer transformer = TransformerUtils.nopTransformer();
-        Collection collection = CollectionUtils.transformedCollection(new ArrayList(), transformer);
+        Transformer<Object, Object> transformer = TransformerUtils.nopTransformer();
+        Collection<Object> collection = CollectionUtils.transformedCollection(new ArrayList<Object>(), transformer);
         assertTrue("returned object should be a TransformedCollection", collection instanceof TransformedCollection);
         try {
-            collection = CollectionUtils.transformedCollection(new ArrayList(), null);
+            collection = CollectionUtils.transformedCollection(new ArrayList<Object>(), null);
             fail("Expecting IllegalArgumentException for null transformer.");
         } catch (IllegalArgumentException ex) {
             // expected
@@ -1269,11 +1268,11 @@ public class TestCollectionUtils extends MockTestCase {
 
     @Test
     public void testTransformedCollection_2() {
-        List list = new ArrayList();
+        List<Object> list = new ArrayList<Object>();
         list.add("1");
         list.add("2");
         list.add("3");
-        Collection result = CollectionUtils.transformedCollection(list, TRANSFORM_TO_INTEGER);
+        Collection<Object> result = CollectionUtils.transformedCollection(list, TRANSFORM_TO_INTEGER);
         assertEquals(true, result.contains("1")); // untransformed
         assertEquals(true, result.contains("2")); // untransformed
         assertEquals(true, result.contains("3")); // untransformed
@@ -1281,7 +1280,7 @@ public class TestCollectionUtils extends MockTestCase {
 
     @Test
     public void testSynchronizedCollection() {
-        Collection col = CollectionUtils.synchronizedCollection(new ArrayList());
+        Collection<Object> col = CollectionUtils.synchronizedCollection(new ArrayList<Object>());
         assertTrue("Returned object should be a SynchronizedCollection.", col instanceof SynchronizedCollection);
         try {
             col = CollectionUtils.synchronizedCollection(null);
@@ -1293,7 +1292,7 @@ public class TestCollectionUtils extends MockTestCase {
 
     @Test
     public void testUnmodifiableCollection() {
-        Collection col = CollectionUtils.unmodifiableCollection(new ArrayList());
+        Collection<Object> col = CollectionUtils.unmodifiableCollection(new ArrayList<Object>());
         assertTrue("Returned object should be a UnmodifiableCollection.", col instanceof UnmodifiableCollection);
         try {
             col = CollectionUtils.unmodifiableCollection(null);
@@ -1353,7 +1352,7 @@ public class TestCollectionUtils extends MockTestCase {
 
     @Test
     public void addAllForEnumeration() {
-        Hashtable<Integer, Integer> h = new Hashtable();
+        Hashtable<Integer, Integer> h = new Hashtable<Integer, Integer>();
         h.put(5, 5);
         Enumeration<? extends Integer> enumeration = h.keys();
         CollectionUtils.addAll(collectionA, enumeration);

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/TestEnumerationUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestEnumerationUtils.java b/src/test/org/apache/commons/collections/TestEnumerationUtils.java
index 90c202a..649ce0a 100644
--- a/src/test/org/apache/commons/collections/TestEnumerationUtils.java
+++ b/src/test/org/apache/commons/collections/TestEnumerationUtils.java
@@ -39,46 +39,46 @@ public class TestEnumerationUtils extends BulkTest {
     public static final String TO_LIST_FIXTURE = "this is a test";
     
     public void testToListWithStringTokenizer() {
-        List expectedList1 = new ArrayList();
+        List<String> expectedList1 = new ArrayList<String>();
         StringTokenizer st = new StringTokenizer(TO_LIST_FIXTURE);
              while (st.hasMoreTokens()) {
                  expectedList1.add(st.nextToken());
-             }        
-        List expectedList2 = new ArrayList();
+             }
+        List<String> expectedList2 = new ArrayList<String>();
         expectedList2.add("this");
         expectedList2.add("is");
         expectedList2.add("a");
         expectedList2.add("test");
-        List actualList = EnumerationUtils.toList(new StringTokenizer(TO_LIST_FIXTURE));
+        List<String> actualList = EnumerationUtils.toList(new StringTokenizer(TO_LIST_FIXTURE));
         Assert.assertEquals(expectedList1, expectedList2);
         Assert.assertEquals(expectedList1, actualList);
         Assert.assertEquals(expectedList2, actualList);
     }
 
     public void testToListWithHashtable() {
-        Hashtable expected = new Hashtable();
+        Hashtable<String, Integer> expected = new Hashtable<String, Integer>();
         expected.put("one", new Integer(1));
         expected.put("two", new Integer(2));
         expected.put("three", new Integer(3));
         // validate elements.
-        List actualEltList = EnumerationUtils.toList(expected.elements());
+        List<Integer> actualEltList = EnumerationUtils.toList(expected.elements());
         Assert.assertEquals(expected.size(), actualEltList.size());
         Assert.assertTrue(actualEltList.contains(new Integer(1)));
         Assert.assertTrue(actualEltList.contains(new Integer(2)));
         Assert.assertTrue(actualEltList.contains(new Integer(3)));
-        List expectedEltList = new ArrayList();
+        List<Integer> expectedEltList = new ArrayList<Integer>();
         expectedEltList.add(new Integer(1));
         expectedEltList.add(new Integer(2));
         expectedEltList.add(new Integer(3));
         Assert.assertTrue(actualEltList.containsAll(expectedEltList));
 
         // validate keys.
-        List actualKeyList = EnumerationUtils.toList(expected.keys());
+        List<String> actualKeyList = EnumerationUtils.toList(expected.keys());
         Assert.assertEquals(expected.size(), actualEltList.size());
         Assert.assertTrue(actualKeyList.contains("one"));
         Assert.assertTrue(actualKeyList.contains("two"));
         Assert.assertTrue(actualKeyList.contains("three"));
-        List expectedKeyList = new ArrayList();
+        List<String> expectedKeyList = new ArrayList<String>();
         expectedKeyList.add("one");
         expectedKeyList.add("two");
         expectedKeyList.add("three");


[68/77] [abbrv] commons-collections git commit: finish extraction of abstract class

Posted by ch...@apache.org.
finish extraction of abstract class

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@814061 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/c673ab5f
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/c673ab5f
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/c673ab5f

Branch: refs/heads/collections_jdk5_branch
Commit: c673ab5f4e38463fe210eb141678206904f39505
Parents: bb91d00
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Fri Sep 11 22:22:41 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Fri Sep 11 22:22:41 2009 +0000

----------------------------------------------------------------------
 .../commons/collections/splitmap/TransformedMap.java   | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c673ab5f/src/java/org/apache/commons/collections/splitmap/TransformedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/splitmap/TransformedMap.java b/src/java/org/apache/commons/collections/splitmap/TransformedMap.java
index 88e309c..67a515f 100644
--- a/src/java/org/apache/commons/collections/splitmap/TransformedMap.java
+++ b/src/java/org/apache/commons/collections/splitmap/TransformedMap.java
@@ -66,8 +66,6 @@ public class TransformedMap<J, K, U, V> extends AbstractIterableGetMapDecorator<
     /** Serialization version */
     private static final long serialVersionUID = 5966875321133456994L;
 
-    /** The decorated map */
-    private Map<K, V> decorated;
     /** The transformer to use for the key */
     private final Transformer<? super J, ? extends K> keyTransformer;
     /** The transformer to use for the value */
@@ -128,7 +126,7 @@ public class TransformedMap<J, K, U, V> extends AbstractIterableGetMapDecorator<
      */
     private void writeObject(ObjectOutputStream out) throws IOException {
         out.defaultWriteObject();
-        out.writeObject(decorated);
+        out.writeObject(decorated());
     }
 
     /**
@@ -142,7 +140,7 @@ public class TransformedMap<J, K, U, V> extends AbstractIterableGetMapDecorator<
     @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
-        decorated = (Map) in.readObject();
+        map = (Map) in.readObject();
     }
 
     //-----------------------------------------------------------------------
@@ -216,5 +214,10 @@ public class TransformedMap<J, K, U, V> extends AbstractIterableGetMapDecorator<
         decorated().putAll(transformMap(mapToCopy));
     }
 
-
+    /**
+     * {@inheritDoc}
+     */
+    public void clear() {
+        decorated().clear();
+    }
 }


[29/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/bidimap/UnmodifiableBidiMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bidimap/UnmodifiableBidiMap.java b/src/java/org/apache/commons/collections/bidimap/UnmodifiableBidiMap.java
index 5d043e6..1684cd5 100644
--- a/src/java/org/apache/commons/collections/bidimap/UnmodifiableBidiMap.java
+++ b/src/java/org/apache/commons/collections/bidimap/UnmodifiableBidiMap.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,39 +33,39 @@ import org.apache.commons.collections.set.UnmodifiableSet;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public final class UnmodifiableBidiMap
-        extends AbstractBidiMapDecorator implements Unmodifiable {
-    
+public final class UnmodifiableBidiMap<K, V>
+        extends AbstractBidiMapDecorator<K, V> implements Unmodifiable {
+
     /** The inverse unmodifiable map */
-    private UnmodifiableBidiMap inverse;
+    private UnmodifiableBidiMap<V, K> inverse;
 
     /**
      * Factory method to create an unmodifiable map.
      * <p>
      * If the map passed in is already unmodifiable, it is returned.
-     * 
+     *
      * @param map  the map to decorate, must not be null
      * @return an unmodifiable BidiMap
      * @throws IllegalArgumentException if map is null
      */
-    public static BidiMap decorate(BidiMap map) {
+    public static <K, V> BidiMap<K, V> decorate(BidiMap<K, V> map) {
         if (map instanceof Unmodifiable) {
             return map;
         }
-        return new UnmodifiableBidiMap(map);
+        return new UnmodifiableBidiMap<K, V>(map);
     }
 
     //-----------------------------------------------------------------------
     /**
      * Constructor that wraps (not copies).
-     * 
+     *
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if map is null
      */
-    private UnmodifiableBidiMap(BidiMap map) {
+    private UnmodifiableBidiMap(BidiMap<K, V> map) {
         super(map);
     }
 
@@ -74,49 +74,49 @@ public final class UnmodifiableBidiMap
         throw new UnsupportedOperationException();
     }
 
-    public Object put(Object key, Object value) {
+    public V put(K key, V value) {
         throw new UnsupportedOperationException();
     }
 
-    public void putAll(Map mapToCopy) {
+    public void putAll(Map<? extends K, ? extends V> mapToCopy) {
         throw new UnsupportedOperationException();
     }
 
-    public Object remove(Object key) {
+    public V remove(Object key) {
         throw new UnsupportedOperationException();
     }
 
-    public Set entrySet() {
-        Set set = super.entrySet();
+    public Set<Map.Entry<K, V>> entrySet() {
+        Set<Map.Entry<K, V>> set = super.entrySet();
         return UnmodifiableEntrySet.decorate(set);
     }
 
-    public Set keySet() {
-        Set set = super.keySet();
+    public Set<K> keySet() {
+        Set<K> set = super.keySet();
         return UnmodifiableSet.decorate(set);
     }
 
-    public Collection values() {
-        Collection coll = super.values();
+    public Collection<V> values() {
+        Collection<V> coll = super.values();
         return UnmodifiableCollection.decorate(coll);
     }
 
     //-----------------------------------------------------------------------
-    public Object removeValue(Object value) {
+    public K removeValue(Object value) {
         throw new UnsupportedOperationException();
     }
 
-    public MapIterator mapIterator() {
-        MapIterator it = getBidiMap().mapIterator();
+    public MapIterator<K, V> mapIterator() {
+        MapIterator<K, V> it = decorated().mapIterator();
         return UnmodifiableMapIterator.decorate(it);
     }
 
-    public BidiMap inverseBidiMap() {
+    public synchronized BidiMap<V, K> inverseBidiMap() {
         if (inverse == null) {
-            inverse = new UnmodifiableBidiMap(getBidiMap().inverseBidiMap());
+            inverse = new UnmodifiableBidiMap<V, K>(decorated().inverseBidiMap());
             inverse.inverse = this;
         }
         return inverse;
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/bidimap/UnmodifiableOrderedBidiMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bidimap/UnmodifiableOrderedBidiMap.java b/src/java/org/apache/commons/collections/bidimap/UnmodifiableOrderedBidiMap.java
index b836a31..19c0f64 100644
--- a/src/java/org/apache/commons/collections/bidimap/UnmodifiableOrderedBidiMap.java
+++ b/src/java/org/apache/commons/collections/bidimap/UnmodifiableOrderedBidiMap.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.
@@ -20,8 +20,6 @@ import java.util.Collection;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.commons.collections.BidiMap;
-import org.apache.commons.collections.MapIterator;
 import org.apache.commons.collections.OrderedBidiMap;
 import org.apache.commons.collections.OrderedMapIterator;
 import org.apache.commons.collections.Unmodifiable;
@@ -35,39 +33,39 @@ import org.apache.commons.collections.set.UnmodifiableSet;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public final class UnmodifiableOrderedBidiMap
-        extends AbstractOrderedBidiMapDecorator implements Unmodifiable {
-    
+public final class UnmodifiableOrderedBidiMap<K, V>
+        extends AbstractOrderedBidiMapDecorator<K, V> implements Unmodifiable {
+
     /** The inverse unmodifiable map */
-    private UnmodifiableOrderedBidiMap inverse;
+    private UnmodifiableOrderedBidiMap<V, K> inverse;
 
     /**
      * Factory method to create an unmodifiable map.
      * <p>
      * If the map passed in is already unmodifiable, it is returned.
-     * 
+     *
      * @param map  the map to decorate, must not be null
      * @return an unmodifiable OrderedBidiMap
      * @throws IllegalArgumentException if map is null
      */
-    public static OrderedBidiMap decorate(OrderedBidiMap map) {
+    public static <K, V> OrderedBidiMap<K, V> decorate(OrderedBidiMap<K, V> map) {
         if (map instanceof Unmodifiable) {
             return map;
         }
-        return new UnmodifiableOrderedBidiMap(map);
+        return new UnmodifiableOrderedBidiMap<K, V>(map);
     }
 
     //-----------------------------------------------------------------------
     /**
      * Constructor that wraps (not copies).
-     * 
+     *
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if map is null
      */
-    private UnmodifiableOrderedBidiMap(OrderedBidiMap map) {
+    private UnmodifiableOrderedBidiMap(OrderedBidiMap<K, V> map) {
         super(map);
     }
 
@@ -76,55 +74,51 @@ public final class UnmodifiableOrderedBidiMap
         throw new UnsupportedOperationException();
     }
 
-    public Object put(Object key, Object value) {
+    public V put(K key, V value) {
         throw new UnsupportedOperationException();
     }
 
-    public void putAll(Map mapToCopy) {
+    public void putAll(Map<? extends K, ? extends V> mapToCopy) {
         throw new UnsupportedOperationException();
     }
 
-    public Object remove(Object key) {
+    public V remove(Object key) {
         throw new UnsupportedOperationException();
     }
 
-    public Set entrySet() {
-        Set set = super.entrySet();
+    public Set<Map.Entry<K, V>> entrySet() {
+        Set<Map.Entry<K, V>> set = super.entrySet();
         return UnmodifiableEntrySet.decorate(set);
     }
 
-    public Set keySet() {
-        Set set = super.keySet();
+    public Set<K> keySet() {
+        Set<K> set = super.keySet();
         return UnmodifiableSet.decorate(set);
     }
 
-    public Collection values() {
-        Collection coll = super.values();
+    public Collection<V> values() {
+        Collection<V> coll = super.values();
         return UnmodifiableCollection.decorate(coll);
     }
 
     //-----------------------------------------------------------------------
-    public Object removeValue(Object value) {
+    public K removeValue(Object value) {
         throw new UnsupportedOperationException();
     }
 
-    public MapIterator mapIterator() {
-        return orderedMapIterator();
-    }
-
-    public BidiMap inverseBidiMap() {
+    public OrderedBidiMap<V, K> inverseBidiMap() {
         return inverseOrderedBidiMap();
     }
-    
+
     //-----------------------------------------------------------------------
-    public OrderedMapIterator orderedMapIterator() {
-        OrderedMapIterator it = getOrderedBidiMap().orderedMapIterator();
+    public OrderedMapIterator<K, V> mapIterator() {
+        OrderedMapIterator<K, V> it = decorated().mapIterator();
         return UnmodifiableOrderedMapIterator.decorate(it);
     }
 
-    public OrderedBidiMap inverseOrderedBidiMap() {
+    public OrderedBidiMap<V, K> inverseOrderedBidiMap() {
         if (inverse == null) {
-            inverse = new UnmodifiableOrderedBidiMap(getOrderedBidiMap().inverseOrderedBidiMap());
+            inverse = new UnmodifiableOrderedBidiMap<V, K>(decorated().inverseBidiMap());
             inverse.inverse = this;
         }
         return inverse;

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/bidimap/UnmodifiableSortedBidiMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bidimap/UnmodifiableSortedBidiMap.java b/src/java/org/apache/commons/collections/bidimap/UnmodifiableSortedBidiMap.java
index 4e47f58..aa73454 100644
--- a/src/java/org/apache/commons/collections/bidimap/UnmodifiableSortedBidiMap.java
+++ b/src/java/org/apache/commons/collections/bidimap/UnmodifiableSortedBidiMap.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.
@@ -21,9 +21,6 @@ import java.util.Map;
 import java.util.Set;
 import java.util.SortedMap;
 
-import org.apache.commons.collections.BidiMap;
-import org.apache.commons.collections.MapIterator;
-import org.apache.commons.collections.OrderedBidiMap;
 import org.apache.commons.collections.OrderedMapIterator;
 import org.apache.commons.collections.SortedBidiMap;
 import org.apache.commons.collections.Unmodifiable;
@@ -38,39 +35,39 @@ import org.apache.commons.collections.set.UnmodifiableSet;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public final class UnmodifiableSortedBidiMap
-        extends AbstractSortedBidiMapDecorator implements Unmodifiable {
-    
+public final class UnmodifiableSortedBidiMap<K, V>
+        extends AbstractSortedBidiMapDecorator<K, V> implements Unmodifiable {
+
     /** The inverse unmodifiable map */
-    private UnmodifiableSortedBidiMap inverse;
+    private UnmodifiableSortedBidiMap<V, K> inverse;
 
     /**
      * Factory method to create an unmodifiable map.
      * <p>
      * If the map passed in is already unmodifiable, it is returned.
-     * 
+     *
      * @param map  the map to decorate, must not be null
      * @return an unmodifiable SortedBidiMap
      * @throws IllegalArgumentException if map is null
      */
-    public static SortedBidiMap decorate(SortedBidiMap map) {
+    public static <K, V> SortedBidiMap<K, V> decorate(SortedBidiMap<K, V> map) {
         if (map instanceof Unmodifiable) {
             return map;
         }
-        return new UnmodifiableSortedBidiMap(map);
+        return new UnmodifiableSortedBidiMap<K, V>(map);
     }
 
     //-----------------------------------------------------------------------
     /**
      * Constructor that wraps (not copies).
-     * 
+     *
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if map is null
      */
-    private UnmodifiableSortedBidiMap(SortedBidiMap map) {
+    private UnmodifiableSortedBidiMap(SortedBidiMap<K, V> map) {
         super(map);
     }
 
@@ -79,77 +76,65 @@ public final class UnmodifiableSortedBidiMap
         throw new UnsupportedOperationException();
     }
 
-    public Object put(Object key, Object value) {
+    public V put(K key, V value) {
         throw new UnsupportedOperationException();
     }
 
-    public void putAll(Map mapToCopy) {
+    public void putAll(Map<? extends K, ? extends V> mapToCopy) {
         throw new UnsupportedOperationException();
     }
 
-    public Object remove(Object key) {
+    public V remove(Object key) {
         throw new UnsupportedOperationException();
     }
 
-    public Set entrySet() {
-        Set set = super.entrySet();
+    public Set<Map.Entry<K, V>> entrySet() {
+        Set<Map.Entry<K, V>> set = super.entrySet();
         return UnmodifiableEntrySet.decorate(set);
     }
 
-    public Set keySet() {
-        Set set = super.keySet();
+    public Set<K> keySet() {
+        Set<K> set = super.keySet();
         return UnmodifiableSet.decorate(set);
     }
 
-    public Collection values() {
-        Collection coll = super.values();
+    public Collection<V> values() {
+        Collection<V> coll = super.values();
         return UnmodifiableCollection.decorate(coll);
     }
 
     //-----------------------------------------------------------------------
-    public Object removeValue(Object value) {
+    public K removeValue(Object value) {
         throw new UnsupportedOperationException();
     }
 
-    public MapIterator mapIterator() {
-        return orderedMapIterator();
-    }
-
-    public BidiMap inverseBidiMap() {
-        return inverseSortedBidiMap();
-    }
-    
     //-----------------------------------------------------------------------
-    public OrderedMapIterator orderedMapIterator() {
-        OrderedMapIterator it = getSortedBidiMap().orderedMapIterator();
+    public OrderedMapIterator<K, V> mapIterator() {
+        OrderedMapIterator<K, V> it = decorated().mapIterator();
         return UnmodifiableOrderedMapIterator.decorate(it);
     }
 
-    public OrderedBidiMap inverseOrderedBidiMap() {
-        return inverseSortedBidiMap();
-    }
-
     //-----------------------------------------------------------------------
-    public SortedBidiMap inverseSortedBidiMap() {
+    public SortedBidiMap<V, K> inverseBidiMap() {
         if (inverse == null) {
-            inverse = new UnmodifiableSortedBidiMap(getSortedBidiMap().inverseSortedBidiMap());
+            inverse = new UnmodifiableSortedBidiMap<V, K>(decorated().inverseBidiMap());
             inverse.inverse = this;
         }
         return inverse;
     }
 
-    public SortedMap subMap(Object fromKey, Object toKey) {
-        SortedMap sm = getSortedBidiMap().subMap(fromKey, toKey);
+    public SortedMap<K, V> subMap(K fromKey, K toKey) {
+        SortedMap<K, V> sm = decorated().subMap(fromKey, toKey);
         return UnmodifiableSortedMap.decorate(sm);
     }
 
-    public SortedMap headMap(Object toKey) {
-        SortedMap sm = getSortedBidiMap().headMap(toKey);
+    public SortedMap<K, V> headMap(K toKey) {
+        SortedMap<K, V> sm = decorated().headMap(toKey);
         return UnmodifiableSortedMap.decorate(sm);
     }
 
-    public SortedMap tailMap(Object fromKey) {
-        SortedMap sm = getSortedBidiMap().tailMap(fromKey);
+    public SortedMap<K, V> tailMap(K fromKey) {
+        SortedMap<K, V> sm = decorated().tailMap(fromKey);
         return UnmodifiableSortedMap.decorate(sm);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java b/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java
index a049ef4..90b4ad2 100644
--- a/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java
+++ b/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java
@@ -30,9 +30,11 @@ import org.apache.commons.collections.collection.AbstractCollectionDecorator;
  * 
  * @author Stephen Colebourne
  */
-public abstract class AbstractBufferDecorator<E>
-        extends AbstractCollectionDecorator<E>
-        implements Buffer<E> {
+public abstract class AbstractBufferDecorator<E> extends AbstractCollectionDecorator<E> implements
+        Buffer<E> {
+
+    /** Serialization version */
+    private static final long serialVersionUID = -2629815475789577029L;
 
     /**
      * Constructor only used in deserialization, do not use otherwise.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/buffer/BoundedBuffer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/buffer/BoundedBuffer.java b/src/java/org/apache/commons/collections/buffer/BoundedBuffer.java
index 06d6789..fc92c3e 100644
--- a/src/java/org/apache/commons/collections/buffer/BoundedBuffer.java
+++ b/src/java/org/apache/commons/collections/buffer/BoundedBuffer.java
@@ -45,7 +45,7 @@ import org.apache.commons.collections.iterators.AbstractIteratorDecorator;
  * @version $Revision$ $Date$
  * @since Commons Collections 3.2
  */
-public class BoundedBuffer extends SynchronizedBuffer implements BoundedCollection {
+public class BoundedBuffer<E> extends SynchronizedBuffer<E> implements BoundedCollection<E> {
 
     /** The serialization version. */
     private static final long serialVersionUID = 1536432911093974264L;
@@ -67,8 +67,8 @@ public class BoundedBuffer extends SynchronizedBuffer implements BoundedCollecti
      * @throws IllegalArgumentException if the buffer is null
      * @throws IllegalArgumentException if the maximum size is zero or less
      */
-    public static BoundedBuffer decorate(Buffer buffer, int maximumSize) {
-        return new BoundedBuffer(buffer, maximumSize, 0L);
+    public static <E> BoundedBuffer<E> decorate(Buffer<E> buffer, int maximumSize) {
+        return new BoundedBuffer<E>(buffer, maximumSize, 0L);
     }
 
     /**
@@ -82,8 +82,8 @@ public class BoundedBuffer extends SynchronizedBuffer implements BoundedCollecti
      * @throws IllegalArgumentException if the buffer is null
      * @throws IllegalArgumentException if the maximum size is zero or less
      */
-    public static BoundedBuffer decorate(Buffer buffer, int maximumSize, long timeout) {
-        return new BoundedBuffer(buffer, maximumSize, timeout);
+    public static <E> BoundedBuffer<E> decorate(Buffer<E> buffer, int maximumSize, long timeout) {
+        return new BoundedBuffer<E>(buffer, maximumSize, timeout);
     }
 
     //-----------------------------------------------------------------------
@@ -97,7 +97,7 @@ public class BoundedBuffer extends SynchronizedBuffer implements BoundedCollecti
      * @throws IllegalArgumentException if the buffer is null
      * @throws IllegalArgumentException if the maximum size is zero or less
      */
-    protected BoundedBuffer(Buffer buffer, int maximumSize, long timeout) {
+    protected BoundedBuffer(Buffer<E> buffer, int maximumSize, long timeout) {
         super(buffer);
         if (maximumSize < 1) {
             throw new IllegalArgumentException();
@@ -107,29 +107,29 @@ public class BoundedBuffer extends SynchronizedBuffer implements BoundedCollecti
     }
 
     //-----------------------------------------------------------------------
-    public Object remove() {
+    public E remove() {
         synchronized (lock) {
-            Object returnValue = decorated().remove();
+            E returnValue = decorated().remove();
             lock.notifyAll();
             return returnValue;
         }
     }
 
-    public boolean add(Object o) {
+    public boolean add(E o) {
         synchronized (lock) {
             timeoutWait(1);
             return decorated().add(o);
         }
     }
 
-    public boolean addAll(final Collection c) {
+    public boolean addAll(final Collection<? extends E> c) {
         synchronized (lock) {
             timeoutWait(c.size());
             return decorated().addAll(c);
         }
     }
 
-    public Iterator iterator() {
+    public Iterator<E> iterator() {
         return new NotifyingIterator(collection.iterator());
     }
 
@@ -178,9 +178,9 @@ public class BoundedBuffer extends SynchronizedBuffer implements BoundedCollecti
     /**
      * BoundedBuffer iterator.
      */
-    private class NotifyingIterator extends AbstractIteratorDecorator {
+    private class NotifyingIterator extends AbstractIteratorDecorator<E> {
 
-        public NotifyingIterator(Iterator it) {
+        public NotifyingIterator(Iterator<E> it) {
             super(it);
         }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/buffer/BoundedFifoBuffer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/buffer/BoundedFifoBuffer.java b/src/java/org/apache/commons/collections/buffer/BoundedFifoBuffer.java
index 3b5f0a3..1fdab68 100644
--- a/src/java/org/apache/commons/collections/buffer/BoundedFifoBuffer.java
+++ b/src/java/org/apache/commons/collections/buffer/BoundedFifoBuffer.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.
@@ -35,7 +35,7 @@ import org.apache.commons.collections.BufferUnderflowException;
  * The BoundedFifoBuffer is a very efficient implementation of
  * <code>Buffer</code> that is of a fixed size.
  * <p>
- * The removal order of a <code>BoundedFifoBuffer</code> is based on the 
+ * The removal order of a <code>BoundedFifoBuffer</code> is based on the
  * insertion order; elements are removed in the same order in which they
  * were added.  The iteration order is the same as the removal order.
  * <p>
@@ -55,37 +55,37 @@ import org.apache.commons.collections.BufferUnderflowException;
  *
  * @since Commons Collections 3.0 (previously in main package v2.1)
  * @version $Revision$ $Date$
- * 
+ *
  * @author Avalon
  * @author Berin Loritsch
  * @author Paul Jack
  * @author Stephen Colebourne
  * @author Herve Quiroz
  */
-public class BoundedFifoBuffer extends AbstractCollection
-        implements Buffer, BoundedCollection, Serializable {
+public class BoundedFifoBuffer<E> extends AbstractCollection<E>
+        implements Buffer<E>, BoundedCollection<E>, Serializable {
 
     /** Serialization version */
     private static final long serialVersionUID = 5603722811189451017L;
 
     /** Underlying storage array */
-    private transient Object[] elements;
-    
+    private transient E[] elements;
+
     /** Array index of first (oldest) buffer element */
     private transient int start = 0;
-    
-    /** 
+
+    /**
      * Index mod maxElements of the array position following the last buffer
      * element.  Buffer elements start at elements[start] and "wrap around"
-     * elements[maxElements-1], ending at elements[decrement(end)].  
-     * For example, elements = {c,a,b}, start=1, end=1 corresponds to 
+     * elements[maxElements-1], ending at elements[decrement(end)].
+     * For example, elements = {c,a,b}, start=1, end=1 corresponds to
      * the buffer [a,b,c].
      */
     private transient int end = 0;
-    
+
     /** Flag to indicate if the buffer is currently full. */
     private transient boolean full = false;
-    
+
     /** Capacity of the buffer */
     private final int maxElements;
 
@@ -104,11 +104,12 @@ public class BoundedFifoBuffer extends AbstractCollection
      * @param size  the maximum number of elements for this fifo
      * @throws IllegalArgumentException  if the size is less than 1
      */
+    @SuppressWarnings("unchecked")
     public BoundedFifoBuffer(int size) {
         if (size <= 0) {
             throw new IllegalArgumentException("The size must be greater than 0");
         }
-        elements = new Object[size];
+        elements = (E[]) new Object[size];
         maxElements = elements.length;
     }
 
@@ -120,7 +121,7 @@ public class BoundedFifoBuffer extends AbstractCollection
      * @param coll  the collection whose elements to add, may not be null
      * @throws NullPointerException if the collection is null
      */
-    public BoundedFifoBuffer(Collection coll) {
+    public BoundedFifoBuffer(Collection<? extends E> coll) {
         this(coll.size());
         addAll(coll);
     }
@@ -128,31 +129,32 @@ public class BoundedFifoBuffer extends AbstractCollection
     //-----------------------------------------------------------------------
     /**
      * Write the buffer out using a custom routine.
-     * 
+     *
      * @param out  the output stream
      * @throws IOException
      */
     private void writeObject(ObjectOutputStream out) throws IOException {
         out.defaultWriteObject();
         out.writeInt(size());
-        for (Iterator it = iterator(); it.hasNext();) {
+        for (Iterator<E> it = iterator(); it.hasNext();) {
             out.writeObject(it.next());
         }
     }
 
     /**
      * Read the buffer in using a custom routine.
-     * 
+     *
      * @param in  the input stream
      * @throws IOException
      * @throws ClassNotFoundException
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
-        elements = new Object[maxElements];
+        elements = (E[]) new Object[maxElements];
         int size = in.readInt();
         for (int i = 0; i < size; i++) {
-            elements[i] = in.readObject();
+            elements[i] = (E) in.readObject();
         }
         start = 0;
         full = (size == maxElements);
@@ -200,7 +202,7 @@ public class BoundedFifoBuffer extends AbstractCollection
     public boolean isFull() {
         return size() == maxElements;
     }
-    
+
     /**
      * Gets the maximum size of the collection (the bound).
      *
@@ -209,7 +211,7 @@ public class BoundedFifoBuffer extends AbstractCollection
     public int maxSize() {
         return maxElements;
     }
-    
+
     /**
      * Clears this buffer.
      */
@@ -228,7 +230,7 @@ public class BoundedFifoBuffer extends AbstractCollection
      * @throws NullPointerException  if the given element is null
      * @throws BufferOverflowException  if this buffer is full
      */
-    public boolean add(Object element) {
+    public boolean add(E element) {
         if (null == element) {
             throw new NullPointerException("Attempted to add null object to buffer");
         }
@@ -256,11 +258,10 @@ public class BoundedFifoBuffer extends AbstractCollection
      * @return the least recently inserted element
      * @throws BufferUnderflowException  if the buffer is empty
      */
-    public Object get() {
+    public E get() {
         if (isEmpty()) {
             throw new BufferUnderflowException("The buffer is already empty");
         }
-
         return elements[start];
     }
 
@@ -270,12 +271,12 @@ public class BoundedFifoBuffer extends AbstractCollection
      * @return the least recently inserted element
      * @throws BufferUnderflowException  if the buffer is empty
      */
-    public Object remove() {
+    public E remove() {
         if (isEmpty()) {
             throw new BufferUnderflowException("The buffer is already empty");
         }
 
-        Object element = elements[start];
+        E element = elements[start];
 
         if (null != element) {
             elements[start++] = null;
@@ -283,21 +284,19 @@ public class BoundedFifoBuffer extends AbstractCollection
             if (start >= maxElements) {
                 start = 0;
             }
-
             full = false;
         }
-
         return element;
     }
 
     /**
      * Increments the internal index.
-     * 
+     *
      * @param index  the index to increment
      * @return the updated index
      */
     private int increment(int index) {
-        index++; 
+        index++;
         if (index >= maxElements) {
             index = 0;
         }
@@ -306,7 +305,7 @@ public class BoundedFifoBuffer extends AbstractCollection
 
     /**
      * Decrements the internal index.
-     * 
+     *
      * @param index  the index to decrement
      * @return the updated index
      */
@@ -323,8 +322,8 @@ public class BoundedFifoBuffer extends AbstractCollection
      *
      * @return an iterator over this buffer's elements
      */
-    public Iterator iterator() {
-        return new Iterator() {
+    public Iterator<E> iterator() {
+        return new Iterator<E>() {
 
             private int index = start;
             private int lastReturnedIndex = -1;
@@ -332,10 +331,9 @@ public class BoundedFifoBuffer extends AbstractCollection
 
             public boolean hasNext() {
                 return isFirst || (index != end);
-                
             }
 
-            public Object next() {
+            public E next() {
                 if (!hasNext()) {
                     throw new NoSuchElementException();
                 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/buffer/CircularFifoBuffer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/buffer/CircularFifoBuffer.java b/src/java/org/apache/commons/collections/buffer/CircularFifoBuffer.java
index bd5dea8..1f354fd 100644
--- a/src/java/org/apache/commons/collections/buffer/CircularFifoBuffer.java
+++ b/src/java/org/apache/commons/collections/buffer/CircularFifoBuffer.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,11 +18,11 @@ package org.apache.commons.collections.buffer;
 
 import java.util.Collection;
 
-/** 
+/**
  * CircularFifoBuffer is a first in first out buffer with a fixed size that
  * replaces its oldest element if full.
  * <p>
- * The removal order of a <code>CircularFifoBuffer</code> is based on the 
+ * The removal order of a <code>CircularFifoBuffer</code> is based on the
  * insertion order; elements are removed in the same order in which they
  * were added.  The iteration order is the same as the removal order.
  * <p>
@@ -39,14 +39,14 @@ import java.util.Collection;
  * This buffer prevents null objects from being added.
  * <p>
  * This class is Serializable from Commons Collections 3.1.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stefano Fornari
  * @author Stephen Colebourne
  */
-public class CircularFifoBuffer extends BoundedFifoBuffer {
+public class CircularFifoBuffer<E> extends BoundedFifoBuffer<E> {
 
     /** Serialization version */
     private static final long serialVersionUID = -8423413834657610406L;
@@ -60,7 +60,7 @@ public class CircularFifoBuffer extends BoundedFifoBuffer {
 
     /**
      * Constructor that creates a buffer with the specified size.
-     * 
+     *
      * @param size  the size of the buffer (cannot be changed)
      * @throws IllegalArgumentException  if the size is less than 1
      */
@@ -71,11 +71,11 @@ public class CircularFifoBuffer extends BoundedFifoBuffer {
     /**
      * Constructor that creates a buffer from the specified collection.
      * The collection size also sets the buffer size
-     * 
+     *
      * @param coll  the collection to copy into the buffer, may not be null
      * @throws NullPointerException if the collection is null
      */
-    public CircularFifoBuffer(Collection coll) {
+    public CircularFifoBuffer(Collection<E> coll) {
         super(coll);
     }
 
@@ -86,11 +86,11 @@ public class CircularFifoBuffer extends BoundedFifoBuffer {
      * @param element the element to add
      * @return true, always
      */
-    public boolean add(Object element) {
+    public boolean add(E element) {
         if (isFull()) {
             remove();
         }
         return super.add(element);
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/buffer/PriorityBuffer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/buffer/PriorityBuffer.java b/src/java/org/apache/commons/collections/buffer/PriorityBuffer.java
index b7db824..f6b6e90 100644
--- a/src/java/org/apache/commons/collections/buffer/PriorityBuffer.java
+++ b/src/java/org/apache/commons/collections/buffer/PriorityBuffer.java
@@ -24,6 +24,7 @@ import java.util.NoSuchElementException;
 
 import org.apache.commons.collections.Buffer;
 import org.apache.commons.collections.BufferUnderflowException;
+import org.apache.commons.collections.comparators.ComparableComparator;
 
 /**
  * Binary heap implementation of <code>Buffer</code> that provides for
@@ -62,8 +63,7 @@ import org.apache.commons.collections.BufferUnderflowException;
  * @author Stephen Colebourne
  * @author Steve Phelps
  */
-public class PriorityBuffer extends AbstractCollection
-        implements Buffer, Serializable {
+public class PriorityBuffer<E> extends AbstractCollection<E> implements Buffer<E>, Serializable {
 
     /** Serialization lock. */
     private static final long serialVersionUID = 6891186490470027896L;
@@ -76,21 +76,24 @@ public class PriorityBuffer extends AbstractCollection
     /**
      * The elements in this buffer.
      */
-    protected Object[] elements;
+    protected E[] elements;
+
     /**
      * The number of elements currently in this buffer.
      */
     protected int size;
+
     /**
      * If true, the first element as determined by the sort order will 
      * be returned.  If false, the last element as determined by the
      * sort order will be returned.
      */
     protected boolean ascendingOrder;
+
     /**
      * The comparator used to order the elements
      */
-    protected Comparator comparator;
+    protected Comparator<? super E> comparator;
 
     //-----------------------------------------------------------------------
     /**
@@ -108,7 +111,7 @@ public class PriorityBuffer extends AbstractCollection
      * @param comparator  the comparator used to order the elements,
      *  null means use natural order
      */
-    public PriorityBuffer(Comparator comparator) {
+    public PriorityBuffer(Comparator<? super E> comparator) {
         this(DEFAULT_CAPACITY, true, comparator);
     }
 
@@ -131,7 +134,7 @@ public class PriorityBuffer extends AbstractCollection
      * @param comparator  the comparator used to order the elements,
      *  null means use natural order
      */
-    public PriorityBuffer(boolean ascendingOrder, Comparator comparator) {
+    public PriorityBuffer(boolean ascendingOrder, Comparator<? super E> comparator) {
         this(DEFAULT_CAPACITY, ascendingOrder, comparator);
     }
 
@@ -155,7 +158,7 @@ public class PriorityBuffer extends AbstractCollection
      *  null means use natural order
      * @throws IllegalArgumentException if <code>capacity</code> is &lt;= <code>0</code>
      */
-    public PriorityBuffer(int capacity, Comparator comparator) {
+    public PriorityBuffer(int capacity, Comparator<? super E> comparator) {
         this(capacity, true, comparator);
     }
 
@@ -183,7 +186,8 @@ public class PriorityBuffer extends AbstractCollection
      *  null means use natural order
      * @throws IllegalArgumentException if <code>capacity</code> is <code>&lt;= 0</code>
      */
-    public PriorityBuffer(int capacity, boolean ascendingOrder, Comparator comparator) {
+    @SuppressWarnings("unchecked")
+    public PriorityBuffer(int capacity, boolean ascendingOrder, Comparator<? super E> comparator) {
         super();
         if (capacity <= 0) {
             throw new IllegalArgumentException("invalid capacity");
@@ -191,8 +195,8 @@ public class PriorityBuffer extends AbstractCollection
         this.ascendingOrder = ascendingOrder;
 
         //+1 as 0 is noop
-        this.elements = new Object[capacity + 1];
-        this.comparator = comparator;
+        this.elements = (E[]) new Object[capacity + 1];
+        this.comparator = (Comparator<? super E>) (comparator == null ? ComparableComparator.INSTANCE : comparator);
     }
 
     //-----------------------------------------------------------------------
@@ -210,7 +214,7 @@ public class PriorityBuffer extends AbstractCollection
      * 
      * @return the comparator in use, null is natural order
      */
-    public Comparator comparator() {
+    public Comparator<? super E> comparator() {
         return comparator;
     }
     
@@ -227,8 +231,9 @@ public class PriorityBuffer extends AbstractCollection
     /**
      * Clears all elements from the buffer.
      */
+    @SuppressWarnings("unchecked")
     public void clear() {
-        elements = new Object[elements.length]; // for gc
+        elements = (E[]) new Object[elements.length]; // for gc
         size = 0;
     }
 
@@ -240,11 +245,11 @@ public class PriorityBuffer extends AbstractCollection
      * @param element  the element to be added
      * @return true always
      */
-    public boolean add(Object element) {
+    public boolean add(E element) {
         if (isAtCapacity()) {
             grow();
         }
-        // percolate element to it's place in tree
+        // percolate element to its place in tree
         if (ascendingOrder) {
             percolateUpMinHeap(element);
         } else {
@@ -259,12 +264,11 @@ public class PriorityBuffer extends AbstractCollection
      * @return the next element
      * @throws BufferUnderflowException if the buffer is empty
      */
-    public Object get() {
+    public E get() {
         if (isEmpty()) {
             throw new BufferUnderflowException();
-        } else {
-            return elements[1];
         }
+        return elements[1];
     }
 
     /**
@@ -273,8 +277,8 @@ public class PriorityBuffer extends AbstractCollection
      * @return the next element
      * @throws BufferUnderflowException if the buffer is empty
      */
-    public Object remove() {
-        final Object result = get();
+    public E remove() {
+        final E result = get();
         elements[1] = elements[size--];
 
         // set the unused element to 'null' so that the garbage collector
@@ -313,7 +317,7 @@ public class PriorityBuffer extends AbstractCollection
      * @param index the index for the element
      */
     protected void percolateDownMinHeap(final int index) {
-        final Object element = elements[index];
+        final E element = elements[index];
         int hole = index;
 
         while ((hole * 2) <= size) {
@@ -345,7 +349,7 @@ public class PriorityBuffer extends AbstractCollection
      * @param index the index of the element
      */
     protected void percolateDownMaxHeap(final int index) {
-        final Object element = elements[index];
+        final E element = elements[index];
         int hole = index;
 
         while ((hole * 2) <= size) {
@@ -378,7 +382,7 @@ public class PriorityBuffer extends AbstractCollection
      */
     protected void percolateUpMinHeap(final int index) {
         int hole = index;
-        Object element = elements[hole];
+        E element = elements[hole];
         while (hole > 1 && compare(element, elements[hole / 2]) < 0) {
             // save element that is being pushed down
             // as the element "bubble" is percolated up
@@ -396,7 +400,7 @@ public class PriorityBuffer extends AbstractCollection
      *
      * @param element the element
      */
-    protected void percolateUpMinHeap(final Object element) {
+    protected void percolateUpMinHeap(final E element) {
         elements[++size] = element;
         percolateUpMinHeap(size);
     }
@@ -410,7 +414,7 @@ public class PriorityBuffer extends AbstractCollection
      */
     protected void percolateUpMaxHeap(final int index) {
         int hole = index;
-        Object element = elements[hole];
+        E element = elements[hole];
 
         while (hole > 1 && compare(element, elements[hole / 2]) > 0) {
             // save element that is being pushed down
@@ -430,7 +434,7 @@ public class PriorityBuffer extends AbstractCollection
      *
      * @param element the element
      */
-    protected void percolateUpMaxHeap(final Object element) {
+    protected void percolateUpMaxHeap(final E element) {
         elements[++size] = element;
         percolateUpMaxHeap(size);
     }
@@ -443,19 +447,16 @@ public class PriorityBuffer extends AbstractCollection
      * @param b  the second object
      * @return -ve if a less than b, 0 if they are equal, +ve if a greater than b
      */
-    protected int compare(Object a, Object b) {
-        if (comparator != null) {
-            return comparator.compare(a, b);
-        } else {
-            return ((Comparable) a).compareTo(b);
-        }
+    protected int compare(E a, E b) {
+        return comparator.compare(a, b);
     }
 
     /**
      * Increases the size of the heap to support additional elements
      */
+    @SuppressWarnings("unchecked")
     protected void grow() {
-        final Object[] array = new Object[elements.length * 2];
+        final E[] array = (E[]) new Object[elements.length * 2];
         System.arraycopy(elements, 0, array, 0, elements.length);
         elements = array;
     }
@@ -466,8 +467,8 @@ public class PriorityBuffer extends AbstractCollection
      *
      * @return an iterator over this heap's elements
      */
-    public Iterator iterator() {
-        return new Iterator() {
+    public Iterator<E> iterator() {
+        return new Iterator<E>() {
 
             private int index = 1;
             private int lastReturnedIndex = -1;
@@ -476,7 +477,7 @@ public class PriorityBuffer extends AbstractCollection
                 return index <= size;
             }
 
-            public Object next() {
+            public E next() {
                 if (!hasNext()) {
                     throw new NoSuchElementException();
                 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/buffer/TransformedBuffer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/buffer/TransformedBuffer.java b/src/java/org/apache/commons/collections/buffer/TransformedBuffer.java
index 3ccb0d8..c8ba28e 100644
--- a/src/java/org/apache/commons/collections/buffer/TransformedBuffer.java
+++ b/src/java/org/apache/commons/collections/buffer/TransformedBuffer.java
@@ -35,7 +35,7 @@ import org.apache.commons.collections.collection.TransformedCollection;
  * 
  * @author Stephen Colebourne
  */
-public class TransformedBuffer extends TransformedCollection implements Buffer {
+public class TransformedBuffer<E> extends TransformedCollection<E> implements Buffer<E> {
 
     /** Serialization version */
     private static final long serialVersionUID = -7901091318986132033L;
@@ -51,8 +51,8 @@ public class TransformedBuffer extends TransformedCollection implements Buffer {
      * @return a new transformed Buffer
      * @throws IllegalArgumentException if buffer or transformer is null
      */
-    public static Buffer decorate(Buffer buffer, Transformer transformer) {
-        return new TransformedBuffer(buffer, transformer);
+    public static <E> Buffer<E> decorate(Buffer<E> buffer, Transformer<? super E, ? extends E> transformer) {
+        return new TransformedBuffer<E>(buffer, transformer);
     }
     
     //-----------------------------------------------------------------------
@@ -66,7 +66,7 @@ public class TransformedBuffer extends TransformedCollection implements Buffer {
      * @param transformer  the transformer to use for conversion, must not be null
      * @throws IllegalArgumentException if buffer or transformer is null
      */
-    protected TransformedBuffer(Buffer buffer, Transformer transformer) {
+    protected TransformedBuffer(Buffer<E> buffer, Transformer<? super E, ? extends E> transformer) {
         super(buffer, transformer);
     }
 
@@ -75,16 +75,16 @@ public class TransformedBuffer extends TransformedCollection implements Buffer {
      * 
      * @return the decorated buffer
      */
-    protected Buffer getBuffer() {
-        return (Buffer) collection;
+    protected Buffer<E> getBuffer() {
+        return (Buffer<E>) collection;
     }
 
     //-----------------------------------------------------------------------
-    public Object get() {
+    public E get() {
         return getBuffer().get();
     }
 
-    public Object remove() {
+    public E remove() {
         return getBuffer().remove();
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/buffer/UnboundedFifoBuffer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/buffer/UnboundedFifoBuffer.java b/src/java/org/apache/commons/collections/buffer/UnboundedFifoBuffer.java
index 668b4c8..921ccfa 100644
--- a/src/java/org/apache/commons/collections/buffer/UnboundedFifoBuffer.java
+++ b/src/java/org/apache/commons/collections/buffer/UnboundedFifoBuffer.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.
@@ -50,7 +50,7 @@ import org.apache.commons.collections.BufferUnderflowException;
  * This buffer prevents null objects from being added.
  * <p>
  * This class is Serializable from Commons Collections 3.1.
- * 
+ *
  * @since Commons Collections 3.0 (previously in main package v2.1)
  * @version $Revision$ $Date$
  *
@@ -63,7 +63,7 @@ import org.apache.commons.collections.BufferUnderflowException;
  * @author Thomas Knych
  * @author Jordan Krey
  */
-public class UnboundedFifoBuffer extends AbstractCollection implements Buffer, Serializable {
+public class UnboundedFifoBuffer<E> extends AbstractCollection<E> implements Buffer<E>, Serializable {
     // invariant: buffer.length > size()
     //   ie.buffer always has at least one empty entry
 
@@ -71,9 +71,11 @@ public class UnboundedFifoBuffer extends AbstractCollection implements Buffer, S
     private static final long serialVersionUID = -3482960336579541419L;
 
     /** The array of objects in the buffer. */
-    protected transient Object[] buffer;
+    protected transient E[] buffer;
+
     /** The current head index. */
     protected transient int head;
+
     /** The current tail index. */
     protected transient int tail;
 
@@ -92,15 +94,16 @@ public class UnboundedFifoBuffer extends AbstractCollection implements Buffer, S
     /**
      * Constructs an UnboundedFifoBuffer with the specified number of elements.
      * The integer must be a positive integer.
-     * 
+     *
      * @param initialSize  the initial size of the buffer
      * @throws IllegalArgumentException  if the size is less than 1
      */
+    @SuppressWarnings("unchecked")
     public UnboundedFifoBuffer(int initialSize) {
         if (initialSize <= 0) {
             throw new IllegalArgumentException("The size must be greater than 0");
         }
-        buffer = new Object[initialSize + 1];
+        buffer = (E[]) new Object[initialSize + 1];
         head = 0;
         tail = 0;
     }
@@ -108,31 +111,32 @@ public class UnboundedFifoBuffer extends AbstractCollection implements Buffer, S
     //-----------------------------------------------------------------------
     /**
      * Write the buffer out using a custom routine.
-     * 
+     *
      * @param out  the output stream
      * @throws IOException
      */
     private void writeObject(ObjectOutputStream out) throws IOException {
         out.defaultWriteObject();
         out.writeInt(size());
-        for (Iterator it = iterator(); it.hasNext();) {
+        for (Iterator<E> it = iterator(); it.hasNext();) {
             out.writeObject(it.next());
         }
     }
 
     /**
      * Read the buffer in using a custom routine.
-     * 
+     *
      * @param in  the input stream
      * @throws IOException
      * @throws ClassNotFoundException
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
         int size = in.readInt();
-        buffer = new Object[size + 1];
+        buffer = (E[]) new Object[size + 1];
         for (int i = 0; i < size; i++) {
-            buffer[i] = in.readObject();
+            buffer[i] = (E) in.readObject();
         }
         head = 0;
         tail = size;
@@ -172,14 +176,15 @@ public class UnboundedFifoBuffer extends AbstractCollection implements Buffer, S
      * @return true, always
      * @throws NullPointerException  if the given element is null
      */
-    public boolean add(final Object obj) {
+    @SuppressWarnings("unchecked")
+    public boolean add(final E obj) {
         if (obj == null) {
             throw new NullPointerException("Attempted to add null object to buffer");
         }
 
         if (size() + 1 >= buffer.length) {
             // copy contents to a new buffer array
-            Object[] tmp = new Object[((buffer.length - 1) * 2) + 1];
+            E[] tmp = (E[]) new Object[((buffer.length - 1) * 2) + 1];
             int j = 0;
             // move head to element zero in the new array
             for (int i = head; i != tail;) {
@@ -205,7 +210,7 @@ public class UnboundedFifoBuffer extends AbstractCollection implements Buffer, S
      * @return the next object in the buffer
      * @throws BufferUnderflowException  if this buffer is empty
      */
-    public Object get() {
+    public E get() {
         if (isEmpty()) {
             throw new BufferUnderflowException("The buffer is already empty");
         }
@@ -219,12 +224,12 @@ public class UnboundedFifoBuffer extends AbstractCollection implements Buffer, S
      * @return the removed object
      * @throws BufferUnderflowException  if this buffer is empty
      */
-    public Object remove() {
+    public E remove() {
         if (isEmpty()) {
             throw new BufferUnderflowException("The buffer is already empty");
         }
 
-        Object element = buffer[head];
+        E element = buffer[head];
         if (element != null) {
             buffer[head] = null;
             head = increment(head);
@@ -234,7 +239,7 @@ public class UnboundedFifoBuffer extends AbstractCollection implements Buffer, S
 
     /**
      * Increments the internal index.
-     * 
+     *
      * @param index  the index to increment
      * @return the updated index
      */
@@ -248,7 +253,7 @@ public class UnboundedFifoBuffer extends AbstractCollection implements Buffer, S
 
     /**
      * Decrements the internal index.
-     * 
+     *
      * @param index  the index to decrement
      * @return the updated index
      */
@@ -265,8 +270,8 @@ public class UnboundedFifoBuffer extends AbstractCollection implements Buffer, S
      *
      * @return an iterator over this buffer's elements
      */
-    public Iterator iterator() {
-        return new Iterator() {
+    public Iterator<E> iterator() {
+        return new Iterator<E>() {
 
             private int index = head;
             private int lastReturnedIndex = -1;
@@ -276,7 +281,7 @@ public class UnboundedFifoBuffer extends AbstractCollection implements Buffer, S
 
             }
 
-            public Object next() {
+            public E next() {
                 if (!hasNext()) {
                     throw new NoSuchElementException();
                 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java b/src/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java
index ccd7c5f..a4799ef 100644
--- a/src/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java
+++ b/src/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java
@@ -37,8 +37,8 @@ import org.apache.commons.collections.iterators.UnmodifiableIterator;
  * 
  * @author Stephen Colebourne
  */
-public final class UnmodifiableBuffer
-        extends AbstractBufferDecorator
+public final class UnmodifiableBuffer<E>
+        extends AbstractBufferDecorator<E>
         implements Unmodifiable, Serializable {
 
     /** Serialization version */
@@ -53,11 +53,11 @@ public final class UnmodifiableBuffer
      * @return an unmodifiable Buffer
      * @throws IllegalArgumentException if buffer is null
      */
-    public static Buffer decorate(Buffer buffer) {
+    public static <E> Buffer<E> decorate(Buffer<E> buffer) {
         if (buffer instanceof Unmodifiable) {
             return buffer;
         }
-        return new UnmodifiableBuffer(buffer);
+        return new UnmodifiableBuffer<E>(buffer);
     }
 
     //-----------------------------------------------------------------------
@@ -67,7 +67,7 @@ public final class UnmodifiableBuffer
      * @param buffer  the buffer to decorate, must not be null
      * @throws IllegalArgumentException if buffer is null
      */
-    private UnmodifiableBuffer(Buffer buffer) {
+    private UnmodifiableBuffer(Buffer<E> buffer) {
         super(buffer);
     }
 
@@ -90,13 +90,14 @@ public final class UnmodifiableBuffer
      * @throws IOException
      * @throws ClassNotFoundException
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
-        collection = (Collection) in.readObject();
+        collection = (Collection<E>) in.readObject();
     }
 
     //-----------------------------------------------------------------------
-    public Iterator iterator() {
+    public Iterator<E> iterator() {
         return UnmodifiableIterator.decorate(decorated().iterator());
     }
 
@@ -104,7 +105,7 @@ public final class UnmodifiableBuffer
         throw new UnsupportedOperationException();
     }
 
-    public boolean addAll(Collection coll) {
+    public boolean addAll(Collection<? extends E> coll) {
         throw new UnsupportedOperationException();
     }
 
@@ -116,16 +117,16 @@ public final class UnmodifiableBuffer
         throw new UnsupportedOperationException();
     }
 
-    public boolean removeAll(Collection coll) {
+    public boolean removeAll(Collection<?> coll) {
         throw new UnsupportedOperationException();
     }
 
-    public boolean retainAll(Collection coll) {
+    public boolean retainAll(Collection<?> coll) {
         throw new UnsupportedOperationException();
     }
 
     //-----------------------------------------------------------------------
-    public Object remove() {
+    public E remove() {
         throw new UnsupportedOperationException();
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/collection/AbstractUntypedCollectionDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/collection/AbstractUntypedCollectionDecorator.java b/src/java/org/apache/commons/collections/collection/AbstractUntypedCollectionDecorator.java
new file mode 100644
index 0000000..c67394c
--- /dev/null
+++ b/src/java/org/apache/commons/collections/collection/AbstractUntypedCollectionDecorator.java
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections.collection;
+
+import java.io.Serializable;
+import java.util.Collection;
+
+/**
+ * Decorates another <code>Collection</code> to provide additional behaviour
+ * without guaranteeing that the provided <code>Collection</code> type is the
+ * same as that of the decorated <code>Collection</code>.
+ * <p>
+ * Each untyped method call made on this <code>Collection</code> is forwarded to the
+ * decorated <code>Collection</code>. This class is used as a framework on which
+ * to build to extensions such as synchronized and unmodifiable behaviour. The
+ * main advantage of decoration is that one decorator can wrap any
+ * implementation of <code>Collection</code>, whereas sub-classing requires a
+ * new class to be written for each implementation.
+ * <p>
+ * This implementation does not perform any special processing with
+ * {@link #iterator()}. Instead it simply returns the value from the wrapped
+ * collection. This may be undesirable, for example if you are trying to write
+ * an unmodifiable implementation it might provide a loophole.
+ * 
+ * @param <D> the type of the elements in the decorated collection
+ * @param <E> the element type of the Collection implementation
+ * @since Commons Collections 5
+ * @version $Revision$ $Date$
+ * 
+ * @author Stephen Colebourne
+ * @author Paul Jack
+ * @author Matt Benson
+ */
+public abstract class AbstractUntypedCollectionDecorator<E, D> implements Collection<E>, Serializable {
+
+    /** Serialization version */
+    private static final long serialVersionUID = -8016691444524268856L;
+
+    /** The collection being decorated */
+    protected Collection<D> collection;
+
+    /**
+     * Create a new AbstractUntypedCollectionDecorator.
+     */
+    public AbstractUntypedCollectionDecorator() {
+        super();
+    }
+
+    /**
+     * Gets the collection being decorated. All access to the decorated
+     * collection goes via this method.
+     * 
+     * @return the decorated collection
+     */
+    protected Collection<D> decorated() {
+        return collection;
+    }
+
+    public void clear() {
+        decorated().clear();
+    }
+
+    public boolean contains(Object object) {
+        return decorated().contains(object);
+    }
+
+    public boolean isEmpty() {
+        return decorated().isEmpty();
+    }
+
+    public boolean remove(Object object) {
+        return decorated().remove(object);
+    }
+
+    public int size() {
+        return decorated().size();
+    }
+
+    public Object[] toArray() {
+        return decorated().toArray();
+    }
+
+    public <T> T[] toArray(T[] object) {
+        return decorated().toArray(object);
+    }
+
+    public boolean containsAll(Collection<?> coll) {
+        return decorated().containsAll(coll);
+    }
+
+    public boolean removeAll(Collection<?> coll) {
+        return decorated().removeAll(coll);
+    }
+
+    public boolean retainAll(Collection<?> coll) {
+        return decorated().retainAll(coll);
+    }
+
+    public boolean equals(Object object) {
+        return object == this || decorated().equals(object);
+    }
+
+    public int hashCode() {
+        return decorated().hashCode();
+    }
+
+    public String toString() {
+        return decorated().toString();
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/collection/CompositeCollection.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/collection/CompositeCollection.java b/src/java/org/apache/commons/collections/collection/CompositeCollection.java
index 9e838fb..54b747b 100644
--- a/src/java/org/apache/commons/collections/collection/CompositeCollection.java
+++ b/src/java/org/apache/commons/collections/collection/CompositeCollection.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.
@@ -31,7 +31,7 @@ import org.apache.commons.collections.list.UnmodifiableList;
  * Decorates a collection of other collections to provide a single unified view.
  * <p>
  * Changes made to this collection will actually be made on the decorated collection.
- * Add and remove operations require the use of a pluggable strategy. If no 
+ * Add and remove operations require the use of a pluggable strategy. If no
  * strategy is provided then add and remove are unsupported.
  *
  * @param <E> the type of the elements in the collection
@@ -46,6 +46,7 @@ public class CompositeCollection<E> implements Collection<E> {
 
     /** CollectionMutator to handle changes to the collection */
     protected CollectionMutator<E> mutator;
+
     /** Collections in the composite */
     protected List<Collection<E>> all = new ArrayList<Collection<E>>();
 
@@ -79,7 +80,7 @@ public class CompositeCollection<E> implements Collection<E> {
 
     /**
      * Create a Composite Collection with an array of collections.
-     * 
+     *
      * @param compositeCollections  the collections to composite
      */
     public CompositeCollection(Collection<E>[] compositeCollections) {
@@ -89,7 +90,7 @@ public class CompositeCollection<E> implements Collection<E> {
 
 //    /**
 //     * Create a Composite Collection extracting the collections from an iterable.
-//     * 
+//     *
 //     * @param compositeCollections  the collections to composite
 //     */
 //    public CompositeCollection(Iterable<Collection<E>> compositeCollections) {
@@ -121,7 +122,7 @@ public class CompositeCollection<E> implements Collection<E> {
      * @return true if all of the contained collections are empty
      */
     public boolean isEmpty() {
-        for (Collection<E> item : all) {
+        for (Collection<? extends E> item : all) {
             if (item.isEmpty() == false) {
                 return false;
             }
@@ -138,7 +139,7 @@ public class CompositeCollection<E> implements Collection<E> {
      * @return true if obj is contained in any of the contained collections
      */
     public boolean contains(Object obj) {
-        for (Collection<E> item : all) {
+        for (Collection<? extends E> item : all) {
             if (item.contains(obj)) {
                 return true;
             }
@@ -158,10 +159,10 @@ public class CompositeCollection<E> implements Collection<E> {
      */
     public Iterator<E> iterator() {
         if (all.isEmpty()) {
-            return EmptyIterator.INSTANCE;
+            return EmptyIterator.<E>getInstance();
         }
-        IteratorChain chain = new IteratorChain();
-        for (Collection<E> item : all) {
+        IteratorChain<E> chain = new IteratorChain<E>();
+        for (Collection<? extends E> item : all) {
             chain.addIterator(item.iterator());
         }
         return chain;
@@ -197,11 +198,11 @@ public class CompositeCollection<E> implements Collection<E> {
         } else {
             result = (Object[]) Array.newInstance(array.getClass().getComponentType(), size);
         }
-        
+
         int offset = 0;
-        for (Collection<E> item : all) {
-            for (Iterator<E> it = item.iterator(); it.hasNext();) {
-                result[offset++] = it.next();
+        for (Collection<? extends E> item : all) {
+            for (E e : item) {
+                result[offset++] = e;
             }
         }
         if (result.length > size) {
@@ -301,7 +302,7 @@ public class CompositeCollection<E> implements Collection<E> {
             return false;
         }
         boolean changed = false;
-        for (Collection<E> item : all) {
+        for (Collection<? extends E> item : all) {
             changed |= item.removeAll(coll);
         }
         return changed;
@@ -319,7 +320,7 @@ public class CompositeCollection<E> implements Collection<E> {
      */
     public boolean retainAll(final Collection<?> coll) {
         boolean changed = false;
-        for (Collection<E> item : all) {
+        for (Collection<? extends E> item : all) {
             changed |= item.retainAll(coll);
         }
         return changed;
@@ -333,7 +334,7 @@ public class CompositeCollection<E> implements Collection<E> {
      * @throws UnsupportedOperationException if clear is unsupported
      */
     public void clear() {
-        for (Collection<E> coll : all) {
+        for (Collection<? extends E> coll : all) {
             coll.clear();
         }
     }
@@ -413,18 +414,26 @@ public class CompositeCollection<E> implements Collection<E> {
      *
      * @return Unmodifiable list of all collections in this composite.
      */
-    public List<Collection<E>> getCollections() {
+    public List<? extends Collection<E>> getCollections() {
         return UnmodifiableList.decorate(all);
     }
 
+    /**
+     * Get the collection mutator to be used for this CompositeCollection.
+     * @return CollectionMutator<E>
+     */
+    protected CollectionMutator<E> getMutator() {
+        return mutator;
+    }
+
     //-----------------------------------------------------------------------
     /**
      * Pluggable strategy to handle changes to the composite.
-     * 
+     *
      * @param <E> the element being held in the collection
      */
     public interface CollectionMutator<E> {
-        
+
         /**
          * Called when an object is to be added to the composite.
          *
@@ -438,7 +447,7 @@ public class CompositeCollection<E> implements Collection<E> {
          * @throws IllegalArgumentException if the object cannot be added
          */
         public boolean add(CompositeCollection<E> composite, List<Collection<E>> collections, E obj);
-        
+
         /**
          * Called when a collection is to be added to the composite.
          *
@@ -452,7 +461,7 @@ public class CompositeCollection<E> implements Collection<E> {
          * @throws IllegalArgumentException if the object cannot be added
          */
         public boolean addAll(CompositeCollection<E> composite, List<Collection<E>> collections, Collection<? extends E> coll);
-        
+
         /**
          * Called when an object is to be removed to the composite.
          *
@@ -466,7 +475,7 @@ public class CompositeCollection<E> implements Collection<E> {
          * @throws IllegalArgumentException if the object cannot be removed
          */
         public boolean remove(CompositeCollection<E> composite, List<Collection<E>> collections, Object obj);
-        
+
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/collection/TransformedCollection.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/collection/TransformedCollection.java b/src/java/org/apache/commons/collections/collection/TransformedCollection.java
index 8a652fc..7aaa7a3 100644
--- a/src/java/org/apache/commons/collections/collection/TransformedCollection.java
+++ b/src/java/org/apache/commons/collections/collection/TransformedCollection.java
@@ -44,7 +44,7 @@ public class TransformedCollection<E> extends AbstractCollectionDecorator<E> {
     private static final long serialVersionUID = 8692300188161871514L;
 
     /** The transformer to use */
-    protected final Transformer<E, E> transformer;
+    protected final Transformer<? super E, ? extends E> transformer;
 
     /**
      * Factory method to create a transforming collection.
@@ -57,8 +57,8 @@ public class TransformedCollection<E> extends AbstractCollectionDecorator<E> {
      * @return a new transformed collection
      * @throws IllegalArgumentException if collection or transformer is null
      */
-    public static Collection decorate(Collection coll, Transformer transformer) {
-        return new TransformedCollection(coll, transformer);
+    public static <E> Collection<E> decorate(Collection<E> coll, Transformer<? super E, ? extends E> transformer) {
+        return new TransformedCollection<E>(coll, transformer);
     }
 
     //-----------------------------------------------------------------------
@@ -72,7 +72,7 @@ public class TransformedCollection<E> extends AbstractCollectionDecorator<E> {
      * @param transformer  the transformer to use for conversion, must not be null
      * @throws IllegalArgumentException if collection or transformer is null
      */
-    protected TransformedCollection(Collection coll, Transformer transformer) {
+    protected TransformedCollection(Collection<E> coll, Transformer<? super E, ? extends E> transformer) {
         super(coll);
         if (transformer == null) {
             throw new IllegalArgumentException("Transformer must not be null");
@@ -88,8 +88,8 @@ public class TransformedCollection<E> extends AbstractCollectionDecorator<E> {
      * @param object  the object to transform
      * @return a transformed object
      */
-    protected E transform(Object object) {
-        return transformer.transform((E) object);
+    protected E transform(E object) {
+        return transformer.transform(object);
     }
 
     /**
@@ -100,20 +100,20 @@ public class TransformedCollection<E> extends AbstractCollectionDecorator<E> {
      * @param coll  the collection to transform
      * @return a transformed object
      */
-    protected Collection transform(Collection coll) {
-        List list = new ArrayList(coll.size());
-        for (Object item : coll) {
+    protected Collection<E> transform(Collection<? extends E> coll) {
+        List<E> list = new ArrayList<E>(coll.size());
+        for (E item : coll) {
             list.add(transform(item));
         }
         return list;
     }
 
     //-----------------------------------------------------------------------
-    public boolean add(Object object) {
+    public boolean add(E object) {
         return decorated().add(transform(object));
     }
 
-    public boolean addAll(Collection coll) {
+    public boolean addAll(Collection<? extends E> coll) {
         return decorated().addAll(transform(coll));
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/collection/UnmodifiableBoundedCollection.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/collection/UnmodifiableBoundedCollection.java b/src/java/org/apache/commons/collections/collection/UnmodifiableBoundedCollection.java
index e1ac9b4..f94eef4 100644
--- a/src/java/org/apache/commons/collections/collection/UnmodifiableBoundedCollection.java
+++ b/src/java/org/apache/commons/collections/collection/UnmodifiableBoundedCollection.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,11 +23,11 @@ import org.apache.commons.collections.BoundedCollection;
 import org.apache.commons.collections.iterators.UnmodifiableIterator;
 
 /**
- * <code>UnmodifiableBoundedCollection</code> decorates another 
+ * <code>UnmodifiableBoundedCollection</code> decorates another
  * <code>BoundedCollection</code> to ensure it can't be altered.
  * <p>
  * If a BoundedCollection is first wrapped in some other collection decorator,
- * such as synchronized or predicated, the BoundedCollection methods are no 
+ * such as synchronized or predicated, the BoundedCollection methods are no
  * longer accessible.
  * The factory on this class will attempt to retrieve the bounded nature by
  * examining the package scope variables.
@@ -36,81 +36,80 @@ import org.apache.commons.collections.iterators.UnmodifiableIterator;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public final class UnmodifiableBoundedCollection
-        extends AbstractCollectionDecorator
-        implements BoundedCollection {
+public final class UnmodifiableBoundedCollection<E> extends AbstractCollectionDecorator<E>
+        implements BoundedCollection<E> {
 
     /** Serialization version */
     private static final long serialVersionUID = -7112672385450340330L;
 
     /**
      * Factory method to create an unmodifiable bounded collection.
-     * 
+     *
      * @param coll  the <code>BoundedCollection</code> to decorate, must not be null
      * @return a new unmodifiable bounded collection
      * @throws IllegalArgumentException if bag is null
      */
-    public static BoundedCollection decorate(BoundedCollection coll) {
-        return new UnmodifiableBoundedCollection(coll);
+    public static <E> BoundedCollection<E> decorate(BoundedCollection<E> coll) {
+        return new UnmodifiableBoundedCollection<E>(coll);
     }
-    
+
     /**
      * Factory method to create an unmodifiable bounded collection.
      * <p>
-     * This method is capable of drilling down through up to 1000 other decorators 
+     * This method is capable of drilling down through up to 1000 other decorators
      * to find a suitable BoundedCollection.
-     * 
+     *
      * @param coll  the <code>BoundedCollection</code> to decorate, must not be null
      * @return a new unmodifiable bounded collection
      * @throws IllegalArgumentException if bag is null
      */
-    public static BoundedCollection decorateUsing(Collection coll) {
+    @SuppressWarnings("unchecked")
+    public static <E> BoundedCollection<E> decorateUsing(Collection<? super E> coll) {
         if (coll == null) {
             throw new IllegalArgumentException("The collection must not be null");
         }
-        
+
         // handle decorators
         for (int i = 0; i < 1000; i++) {  // counter to prevent infinite looping
             if (coll instanceof BoundedCollection) {
                 break;  // normal loop exit
-            } else if (coll instanceof AbstractCollectionDecorator) {
-                coll = ((AbstractCollectionDecorator) coll).collection;
+            }
+            if (coll instanceof AbstractCollectionDecorator) {
+                coll = ((AbstractCollectionDecorator<E>) coll).collection;
             } else if (coll instanceof SynchronizedCollection) {
-                coll = ((SynchronizedCollection) coll).collection;
-            } else {
-                break;  // normal loop exit
+                coll = ((SynchronizedCollection<E>) coll).collection;
             }
         }
-            
+
         if (coll instanceof BoundedCollection == false) {
             throw new IllegalArgumentException("The collection is not a bounded collection");
         }
-        return new UnmodifiableBoundedCollection((BoundedCollection) coll);
-    }    
-    
+        return new UnmodifiableBoundedCollection((BoundedCollection<E>) coll);
+    }
+
     /**
      * Constructor that wraps (not copies).
-     * 
+     *
      * @param coll  the collection to decorate, must not be null
      * @throws IllegalArgumentException if coll is null
      */
-    private UnmodifiableBoundedCollection(BoundedCollection coll) {
+    private UnmodifiableBoundedCollection(BoundedCollection<E> coll) {
         super(coll);
     }
 
     //-----------------------------------------------------------------------
-    public Iterator iterator() {
+    public Iterator<E> iterator() {
         return UnmodifiableIterator.decorate(decorated().iterator());
     }
 
-    public boolean add(Object object) {
+    public boolean add(E object) {
         throw new UnsupportedOperationException();
     }
 
-    public boolean addAll(Collection coll) {
+    public boolean addAll(Collection<? extends E> coll) {
         throw new UnsupportedOperationException();
     }
 
@@ -122,21 +121,28 @@ public final class UnmodifiableBoundedCollection
         throw new UnsupportedOperationException();
     }
 
-    public boolean removeAll(Collection coll) {
+    public boolean removeAll(Collection<?> coll) {
         throw new UnsupportedOperationException();
     }
 
-    public boolean retainAll(Collection coll) {
+    public boolean retainAll(Collection<?> coll) {
         throw new UnsupportedOperationException();
     }
 
-    //-----------------------------------------------------------------------    
+    //-----------------------------------------------------------------------
     public boolean isFull() {
-        return ((BoundedCollection) collection).isFull();
+        return decorated().isFull();
     }
 
     public int maxSize() {
-        return ((BoundedCollection) collection).maxSize();
+        return decorated().maxSize();
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected BoundedCollection<E> decorated() {
+        return (BoundedCollection<E>) super.decorated();
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/comparators/BooleanComparator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/comparators/BooleanComparator.java b/src/java/org/apache/commons/collections/comparators/BooleanComparator.java
index 2be6029..0efd38f 100644
--- a/src/java/org/apache/commons/collections/comparators/BooleanComparator.java
+++ b/src/java/org/apache/commons/collections/comparators/BooleanComparator.java
@@ -32,7 +32,7 @@ import java.util.Comparator;
  * 
  * @author Rodney Waldhoff
  */
-public final class BooleanComparator implements Comparator, Serializable {
+public final class BooleanComparator implements Comparator<Boolean>, Serializable {
 
     /** Serialization version. */
     private static final long serialVersionUID = 1830042991606340609L;
@@ -127,22 +127,6 @@ public final class BooleanComparator implements Comparator, Serializable {
 
     //-----------------------------------------------------------------------
     /**
-     * Compares two arbitrary Objects.
-     * When both arguments are <code>Boolean</code>, this method is equivalent to 
-     * {@link #compare(Boolean,Boolean) compare((Boolean)<i>obj1</i>,(Boolean)<i>obj2</i>)}.
-     * When either argument is not a <code>Boolean</code>, this methods throws
-     * a {@link ClassCastException}.
-     * 
-     * @param obj1  the first object to compare
-     * @param obj2  the second object to compare
-     * @return negative if obj1 is less, positive if greater, zero if equal
-     * @throws ClassCastException when either argument is not <code>Boolean</code>
-     */
-    public int compare(Object obj1, Object obj2) {
-        return compare((Boolean)obj1, (Boolean)obj2);
-    }
-    
-    /**
      * Compares two non-<code>null</code> <code>Boolean</code> objects
      * according to the value of {@link #sortsTrueFirst()}.
      * 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/comparators/ComparableComparator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/comparators/ComparableComparator.java b/src/java/org/apache/commons/collections/comparators/ComparableComparator.java
index d643e3e..6cac25c 100644
--- a/src/java/org/apache/commons/collections/comparators/ComparableComparator.java
+++ b/src/java/org/apache/commons/collections/comparators/ComparableComparator.java
@@ -42,13 +42,14 @@ import java.util.Comparator;
  *
  * @see java.util.Collections#reverseOrder()
  */
-public class ComparableComparator implements Comparator, Serializable {
+public class ComparableComparator<E extends Comparable<? super E>> implements Comparator<E>, Serializable {
 
     /** Serialization version. */
     private static final long serialVersionUID=-291439688585137865L;
 
     /** The singleton instance. */
-    private static final ComparableComparator instance = new ComparableComparator();
+    @SuppressWarnings("unchecked")
+    public static final ComparableComparator<?> INSTANCE = new ComparableComparator();
 
     //-----------------------------------------------------------------------
     /**
@@ -60,8 +61,9 @@ public class ComparableComparator implements Comparator, Serializable {
      * 
      * @return the singleton ComparableComparator
      */
-    public static ComparableComparator getInstance() {
-        return instance;
+    @SuppressWarnings("unchecked")
+    public static <E extends Comparable<? super E>> ComparableComparator<E> getInstance() {
+        return (ComparableComparator<E>) INSTANCE;
     }
 
     //-----------------------------------------------------------------------
@@ -88,8 +90,8 @@ public class ComparableComparator implements Comparator, Serializable {
      * @throws ClassCastException when <i>obj1</i> is not a <code>Comparable</code>,
      *         or when <code>((Comparable)obj1).compareTo(obj2)</code> does
      */
-    public int compare(Object obj1, Object obj2) {
-        return ((Comparable)obj1).compareTo(obj2);
+    public int compare(E obj1, E obj2) {
+        return obj1.compareTo(obj2);
     }
 
     //-----------------------------------------------------------------------


[32/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/PredicateUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/PredicateUtils.java b/src/java/org/apache/commons/collections/PredicateUtils.java
index e59b1b6..c2b557b 100644
--- a/src/java/org/apache/commons/collections/PredicateUtils.java
+++ b/src/java/org/apache/commons/collections/PredicateUtils.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,9 +16,6 @@
  */
 package org.apache.commons.collections;
 
-import static org.apache.commons.collections.functors.AllPredicate.allPredicate;
-import static org.apache.commons.collections.functors.TruePredicate.truePredicate;
-
 import java.util.Collection;
 
 import org.apache.commons.collections.functors.AllPredicate;
@@ -71,7 +68,7 @@ import org.apache.commons.collections.functors.UniquePredicate;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Ola Berg
  */
@@ -87,23 +84,23 @@ public class PredicateUtils {
     // Simple predicates
     //-----------------------------------------------------------------------------
 
-    /** 
+    /**
      * Gets a Predicate that always throws an exception.
      * This could be useful during testing as a placeholder.
      *
      * @see org.apache.commons.collections.functors.ExceptionPredicate
-     * 
+     *
      * @return the predicate
      */
-    public static Predicate exceptionPredicate() {
-        return ExceptionPredicate.INSTANCE;
+    public static <T> Predicate<T> exceptionPredicate() {
+        return ExceptionPredicate.<T>getInstance();
     }
 
     /**
      * Gets a Predicate that always returns true.
-     * 
+     *
      * @see org.apache.commons.collections.functors.TruePredicate
-     * 
+     *
      * @return the predicate
      * @deprecated use {@link TruePredicate#truePredicate()} instead.
      */
@@ -114,20 +111,21 @@ public class PredicateUtils {
 
     /**
      * Gets a Predicate that always returns false.
-     * 
+     *
      * @see org.apache.commons.collections.functors.FalsePredicate
-     * 
+     *
      * @return the predicate
+     * @deprecated use {@link FalsePredicate#()} instead.
      */
-    public static Predicate falsePredicate() {
-        return FalsePredicate.INSTANCE;
+    public static <T> Predicate<T> falsePredicate() {
+        return FalsePredicate.<T>getInstance();
     }
 
     /**
      * Gets a Predicate that checks if the input object passed in is null.
-     * 
+     *
      * @see org.apache.commons.collections.functors.NullPredicate
-     * 
+     *
      * @return the predicate
      * @deprecated use {@link NullPredicate#nullPredicate()} instead
      */
@@ -138,21 +136,21 @@ public class PredicateUtils {
 
     /**
      * Gets a Predicate that checks if the input object passed in is not null.
-     * 
+     *
      * @see org.apache.commons.collections.functors.NotNullPredicate
-     * 
+     *
      * @return the predicate
      */
-    public static Predicate notNullPredicate() {
-        return NotNullPredicate.INSTANCE;
+    public static <T> Predicate<T> notNullPredicate() {
+        return NotNullPredicate.<T>getInstance();
     }
 
     /**
      * Creates a Predicate that checks if the input object is equal to the
      * specified object using equals().
-     * 
+     *
      * @see org.apache.commons.collections.functors.EqualPredicate
-     * 
+     *
      * @param value  the value to compare against
      * @return the predicate
      * @deprecated use {@link EqualPredicate#equalPredicate(Object)} instead.
@@ -165,82 +163,82 @@ public class PredicateUtils {
     /**
      * Creates a Predicate that checks if the input object is equal to the
      * specified object by identity.
-     * 
+     *
      * @see org.apache.commons.collections.functors.IdentityPredicate
-     * 
+     *
      * @param value  the value to compare against
      * @return the predicate
      */
-    public static Predicate identityPredicate(Object value) {
-        return IdentityPredicate.getInstance(value);
+    public static <T> Predicate<T> identityPredicate(T value) {
+        return IdentityPredicate.<T>getInstance(value);
     }
-    
+
     /**
      * Creates a Predicate that checks if the object passed in is of
      * a particular type, using instanceof. A <code>null</code> input
      * object will return <code>false</code>.
-     * 
+     *
      * @see org.apache.commons.collections.functors.InstanceofPredicate
-     * 
+     *
      * @param type  the type to check for, may not be null
      * @return the predicate
      * @throws IllegalArgumentException if the class is null
      */
-    public static Predicate instanceofPredicate(Class type) {
+    public static Predicate<Object> instanceofPredicate(Class<?> type) {
         return InstanceofPredicate.getInstance(type);
     }
 
     /**
      * Creates a Predicate that returns true the first time an object is
-     * encountered, and false if the same object is received 
+     * encountered, and false if the same object is received
      * again. The comparison is by equals(). A <code>null</code> input object
      * is accepted and will return true the first time, and false subsequently
      * as well.
-     * 
+     *
      * @see org.apache.commons.collections.functors.UniquePredicate
-     * 
+     *
      * @return the predicate
      */
-    public static Predicate uniquePredicate() {
+    public static <T> Predicate<T> uniquePredicate() {
         // must return new instance each time
-        return UniquePredicate.getInstance();
+        return UniquePredicate.<T>getInstance();
     }
 
     /**
      * Creates a Predicate that invokes a method on the input object.
      * The method must return either a boolean or a non-null Boolean,
-     * and have no parameters. If the input object is null, a 
+     * and have no parameters. If the input object is null, a
      * PredicateException is thrown.
      * <p>
      * For example, <code>PredicateUtils.invokerPredicate("isEmpty");</code>
-     * will call the <code>isEmpty</code> method on the input object to 
+     * will call the <code>isEmpty</code> method on the input object to
      * determine the predicate result.
-     * 
+     *
      * @see org.apache.commons.collections.functors.InvokerTransformer
      * @see org.apache.commons.collections.functors.TransformerPredicate
-     * 
+     *
      * @param methodName  the method name to call on the input object, may not be null
      * @return the predicate
      * @throws IllegalArgumentException if the methodName is null.
      */
-    public static Predicate invokerPredicate(String methodName){
+    public static <T> Predicate<T> invokerPredicate(String methodName){
         // reuse transformer as it has caching - this is lazy really, should have inner class here
-        return asPredicate(InvokerTransformer.getInstance(methodName));
+        return asPredicate(InvokerTransformer.<Object, Boolean>getInstance(methodName));
     }
 
     /**
      * Creates a Predicate that invokes a method on the input object.
      * The method must return either a boolean or a non-null Boolean,
-     * and have no parameters. If the input object is null, a 
+     * and have no parameters. If the input object is null, a
      * PredicateException is thrown.
      * <p>
      * For example, <code>PredicateUtils.invokerPredicate("isEmpty");</code>
-     * will call the <code>isEmpty</code> method on the input object to 
+     * will call the <code>isEmpty</code> method on the input object to
      * determine the predicate result.
-     * 
+     *
      * @see org.apache.commons.collections.functors.InvokerTransformer
      * @see org.apache.commons.collections.functors.TransformerPredicate
-     * 
+     *
      * @param methodName  the method name to call on the input object, may not be null
      * @param paramTypes  the parameter types
      * @param args  the arguments
@@ -248,9 +246,9 @@ public class PredicateUtils {
      * @throws IllegalArgumentException if the method name is null
      * @throws IllegalArgumentException if the paramTypes and args don't match
      */
-    public static Predicate invokerPredicate(String methodName, Class[] paramTypes, Object[] args){
+    public static <T> Predicate<T> invokerPredicate(String methodName, Class<?>[] paramTypes, Object[] args){
         // reuse transformer as it has caching - this is lazy really, should have inner class here
-        return asPredicate(InvokerTransformer.getInstance(methodName, paramTypes, args));
+        return asPredicate(InvokerTransformer.<Object, Boolean>getInstance(methodName, paramTypes, args));
     }
 
     // Boolean combinations
@@ -259,25 +257,25 @@ public class PredicateUtils {
     /**
      * Create a new Predicate that returns true only if both of the specified
      * predicates are true.
-     * 
+     *
      * @see org.apache.commons.collections.functors.AndPredicate
-     * 
+     *
      * @param predicate1  the first predicate, may not be null
      * @param predicate2  the second predicate, may not be null
      * @return the <code>and</code> predicate
      * @throws IllegalArgumentException if either predicate is null
      */
-    public static Predicate andPredicate(Predicate predicate1, Predicate predicate2) {
-        return AndPredicate.getInstance(predicate1, predicate2);
+    public static <T> Predicate<T> andPredicate(Predicate<? super T> predicate1, Predicate<? super T> predicate2) {
+        return AndPredicate.<T>getInstance(predicate1, predicate2);
     }
 
     /**
      * Create a new Predicate that returns true only if all of the specified
      * predicates are true.
      * If the array of predicates is empty, then this predicate returns true.
-     * 
+     *
      * @see org.apache.commons.collections.functors.AllPredicate
-     * 
+     *
      * @param predicates  an array of predicates to check, may not be null
      * @return the <code>all</code> predicate
      * @throws IllegalArgumentException if the predicates array is null
@@ -293,48 +291,46 @@ public class PredicateUtils {
      * Create a new Predicate that returns true only if all of the specified
      * predicates are true. The predicates are checked in iterator order.
      * If the collection of predicates is empty, then this predicate returns true.
-     * 
+     *
      * @see org.apache.commons.collections.functors.AllPredicate
-     * 
+     *
      * @param predicates  a collection of predicates to check, may not be null
      * @return the <code>all</code> predicate
      * @throws IllegalArgumentException if the predicates collection is null
      * @throws IllegalArgumentException if any predicate in the collection is null
-     * @deprecated use {@link AllPredicate#allPredicate(Collection))} instead.
      */
-    @Deprecated
-    public static <T> Predicate<T> allPredicate(Collection<Predicate<? super T>> predicates) {
+    public static <T> Predicate<T> allPredicate(Collection<? extends Predicate<T>> predicates) {
         return AllPredicate.allPredicate(predicates);
     }
 
     /**
      * Create a new Predicate that returns true if either of the specified
      * predicates are true.
-     * 
+     *
      * @see org.apache.commons.collections.functors.OrPredicate
-     * 
+     *
      * @param predicate1  the first predicate, may not be null
      * @param predicate2  the second predicate, may not be null
      * @return the <code>or</code> predicate
      * @throws IllegalArgumentException if either predicate is null
      */
-    public static Predicate orPredicate(Predicate predicate1, Predicate predicate2) {
-        return OrPredicate.getInstance(predicate1, predicate2);
+    public static <T> Predicate<T> orPredicate(Predicate<? super T> predicate1, Predicate<? super T> predicate2) {
+        return OrPredicate.<T>getInstance(predicate1, predicate2);
     }
 
     /**
      * Create a new Predicate that returns true if any of the specified
      * predicates are true.
      * If the array of predicates is empty, then this predicate returns false.
-     * 
+     *
      * @see org.apache.commons.collections.functors.AnyPredicate
-     * 
+     *
      * @param predicates  an array of predicates to check, may not be null
      * @return the <code>any</code> predicate
      * @throws IllegalArgumentException if the predicates array is null
      * @throws IllegalArgumentException if any predicate in the array is null
      */
-    public static Predicate anyPredicate(Predicate[] predicates) {
+    public static <T> Predicate<T> anyPredicate(Predicate<? super T>[] predicates) {
         return AnyPredicate.getInstance(predicates);
     }
 
@@ -342,30 +338,31 @@ public class PredicateUtils {
      * Create a new Predicate that returns true if any of the specified
      * predicates are true. The predicates are checked in iterator order.
      * If the collection of predicates is empty, then this predicate returns false.
-     * 
+     *
      * @see org.apache.commons.collections.functors.AnyPredicate
-     * 
+     *
      * @param predicates  a collection of predicates to check, may not be null
      * @return the <code>any</code> predicate
      * @throws IllegalArgumentException if the predicates collection is null
      * @throws IllegalArgumentException if any predicate in the collection is null
      */
-    public static Predicate anyPredicate(Collection predicates) {
+    public static <T> Predicate<T> anyPredicate(Collection<? extends Predicate<T>> predicates) {
         return AnyPredicate.getInstance(predicates);
     }
 
     /**
      * Create a new Predicate that returns true if one, but not both, of the
-     * specified predicates are true.
-     * 
+     * specified predicates are true. XOR
+     *
      * @see org.apache.commons.collections.functors.OnePredicate
-     * 
+     *
      * @param predicate1  the first predicate, may not be null
      * @param predicate2  the second predicate, may not be null
      * @return the <code>either</code> predicate
      * @throws IllegalArgumentException if either predicate is null
      */
-    public static Predicate eitherPredicate(Predicate predicate1, Predicate predicate2) {
+    @SuppressWarnings("unchecked")
+    public static <T> Predicate<T> eitherPredicate(Predicate<? super T> predicate1, Predicate<? super T> predicate2) {
         return onePredicate(new Predicate[] { predicate1, predicate2 });
     }
 
@@ -373,15 +370,15 @@ public class PredicateUtils {
      * Create a new Predicate that returns true if only one of the specified
      * predicates are true.
      * If the array of predicates is empty, then this predicate returns false.
-     * 
+     *
      * @see org.apache.commons.collections.functors.OnePredicate
-     * 
+     *
      * @param predicates  an array of predicates to check, may not be null
      * @return the <code>one</code> predicate
      * @throws IllegalArgumentException if the predicates array is null
      * @throws IllegalArgumentException if any predicate in the array is null
      */
-    public static Predicate onePredicate(Predicate[] predicates) {
+    public static <T> Predicate<T> onePredicate(Predicate<? super T>[] predicates) {
         return OnePredicate.getInstance(predicates);
     }
 
@@ -389,30 +386,31 @@ public class PredicateUtils {
      * Create a new Predicate that returns true if only one of the specified
      * predicates are true. The predicates are checked in iterator order.
      * If the collection of predicates is empty, then this predicate returns false.
-     * 
+     *
      * @see org.apache.commons.collections.functors.OnePredicate
-     * 
+     *
      * @param predicates  a collection of predicates to check, may not be null
      * @return the <code>one</code> predicate
      * @throws IllegalArgumentException if the predicates collection is null
      * @throws IllegalArgumentException if any predicate in the collection is null
      */
-    public static Predicate onePredicate(Collection predicates) {
+    public static <T> Predicate<T> onePredicate(Collection<Predicate<T>> predicates) {
         return OnePredicate.getInstance(predicates);
     }
 
     /**
-     * Create a new Predicate that returns true if neither of the specified 
+     * Create a new Predicate that returns true if neither of the specified
      * predicates are true.
-     * 
+     *
      * @see org.apache.commons.collections.functors.NonePredicate
-     * 
+     *
      * @param predicate1  the first predicate, may not be null
      * @param predicate2  the second predicate, may not be null
      * @return the <code>neither</code> predicate
      * @throws IllegalArgumentException if either predicate is null
      */
-    public static Predicate neitherPredicate(Predicate predicate1, Predicate predicate2) {
+    @SuppressWarnings("unchecked")
+    public static <T> Predicate<T> neitherPredicate(Predicate<? super T> predicate1, Predicate<? super T> predicate2) {
         return nonePredicate(new Predicate[] { predicate1, predicate2 });
     }
 
@@ -420,15 +418,15 @@ public class PredicateUtils {
      * Create a new Predicate that returns true if none of the specified
      * predicates are true.
      * If the array of predicates is empty, then this predicate returns true.
-     * 
+     *
      * @see org.apache.commons.collections.functors.NonePredicate
-     * 
+     *
      * @param predicates  an array of predicates to check, may not be null
      * @return the <code>none</code> predicate
      * @throws IllegalArgumentException if the predicates array is null
      * @throws IllegalArgumentException if any predicate in the array is null
      */
-    public static Predicate nonePredicate(Predicate[] predicates) {
+    public static <T> Predicate<T> nonePredicate(Predicate<? super T>[] predicates) {
         return NonePredicate.getInstance(predicates);
     }
 
@@ -436,29 +434,29 @@ public class PredicateUtils {
      * Create a new Predicate that returns true if none of the specified
      * predicates are true. The predicates are checked in iterator order.
      * If the collection of predicates is empty, then this predicate returns true.
-     * 
+     *
      * @see org.apache.commons.collections.functors.NonePredicate
-     * 
+     *
      * @param predicates  a collection of predicates to check, may not be null
      * @return the <code>none</code> predicate
      * @throws IllegalArgumentException if the predicates collection is null
      * @throws IllegalArgumentException if any predicate in the collection is null
      */
-    public static Predicate nonePredicate(Collection predicates) {
+    public static <T> Predicate<T> nonePredicate(Collection<? extends Predicate<T>> predicates) {
         return NonePredicate.getInstance(predicates);
     }
 
     /**
      * Create a new Predicate that returns true if the specified predicate
      * returns false and vice versa.
-     * 
+     *
      * @see org.apache.commons.collections.functors.NotPredicate
-     * 
+     *
      * @param predicate  the predicate to not
      * @return the <code>not</code> predicate
      * @throws IllegalArgumentException if the predicate is null
      */
-    public static Predicate notPredicate(Predicate predicate) {
+    public static <T> Predicate<T> notPredicate(Predicate<? super T> predicate) {
         return NotPredicate.getInstance(predicate);
     }
 
@@ -469,14 +467,14 @@ public class PredicateUtils {
      * Create a new Predicate that wraps a Transformer. The Transformer must
      * return either Boolean.TRUE or Boolean.FALSE otherwise a PredicateException
      * will be thrown.
-     * 
+     *
      * @see org.apache.commons.collections.functors.TransformerPredicate
-     * 
+     *
      * @param transformer  the transformer to wrap, may not be null
      * @return the transformer wrapping predicate
      * @throws IllegalArgumentException if the transformer is null
      */
-    public static Predicate asPredicate(Transformer transformer) {
+    public static <T> Predicate<T> asPredicate(Transformer<? super T, Boolean> transformer) {
         return TransformerPredicate.getInstance(transformer);
     }
 
@@ -484,17 +482,17 @@ public class PredicateUtils {
     //-----------------------------------------------------------------------------
 
     /**
-     * Gets a Predicate that throws an exception if the input object is null, 
-     * otherwise it calls the specified Predicate. This allows null handling 
+     * Gets a Predicate that throws an exception if the input object is null,
+     * otherwise it calls the specified Predicate. This allows null handling
      * behaviour to be added to Predicates that don't support nulls.
-     * 
+     *
      * @see org.apache.commons.collections.functors.NullIsExceptionPredicate
-     * 
+     *
      * @param predicate  the predicate to wrap, may not be null
      * @return the predicate
      * @throws IllegalArgumentException if the predicate is null.
      */
-    public static Predicate nullIsExceptionPredicate(Predicate predicate){
+    public static <T> Predicate<T> nullIsExceptionPredicate(Predicate<? super T> predicate){
         return NullIsExceptionPredicate.getInstance(predicate);
     }
 
@@ -502,14 +500,14 @@ public class PredicateUtils {
      * Gets a Predicate that returns false if the input object is null, otherwise
      * it calls the specified Predicate. This allows null handling behaviour to
      * be added to Predicates that don't support nulls.
-     * 
+     *
      * @see org.apache.commons.collections.functors.NullIsFalsePredicate
-     * 
+     *
      * @param predicate  the predicate to wrap, may not be null
      * @return the predicate
      * @throws IllegalArgumentException if the predicate is null.
      */
-    public static Predicate nullIsFalsePredicate(Predicate predicate){
+    public static <T> Predicate<T> nullIsFalsePredicate(Predicate<? super T> predicate){
         return NullIsFalsePredicate.getInstance(predicate);
     }
 
@@ -517,14 +515,14 @@ public class PredicateUtils {
      * Gets a Predicate that returns true if the input object is null, otherwise
      * it calls the specified Predicate. This allows null handling behaviour to
      * be added to Predicates that don't support nulls.
-     * 
+     *
      * @see org.apache.commons.collections.functors.NullIsTruePredicate
-     * 
+     *
      * @param predicate  the predicate to wrap, may not be null
      * @return the predicate
      * @throws IllegalArgumentException if the predicate is null.
      */
-    public static Predicate nullIsTruePredicate(Predicate predicate){
+    public static <T> Predicate<T> nullIsTruePredicate(Predicate<? super T> predicate){
         return NullIsTruePredicate.getInstance(predicate);
     }
 
@@ -533,17 +531,18 @@ public class PredicateUtils {
     /**
      * Creates a predicate that transforms the input object before passing it
      * to the predicate.
-     * 
+     *
      * @see org.apache.commons.collections.functors.TransformedPredicate
-     * 
+     *
      * @param transformer  the transformer to call first
      * @param predicate  the predicate to call with the result of the transform
      * @return the predicate
      * @throws IllegalArgumentException if the transformer or the predicate is null
 	 * @since Commons Collections 3.1
      */
-    public static Predicate transformedPredicate(Transformer transformer, Predicate predicate) {
-        return TransformedPredicate.getInstance(transformer, predicate);
+    public static <T> Predicate<T> transformedPredicate(
+            Transformer<? super T, ? extends T> transformer, Predicate<? super T> predicate) {
+        return TransformedPredicate.<T>getInstance(transformer, predicate);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/SetUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/SetUtils.java b/src/java/org/apache/commons/collections/SetUtils.java
index c45ffff..683be0e 100644
--- a/src/java/org/apache/commons/collections/SetUtils.java
+++ b/src/java/org/apache/commons/collections/SetUtils.java
@@ -18,7 +18,6 @@ package org.apache.commons.collections;
 
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeSet;
@@ -52,12 +51,32 @@ public class SetUtils {
      * This uses the {@link Collections} implementation 
      * and is provided for completeness.
      */
-    public static final Set EMPTY_SET = Collections.EMPTY_SET;
+    public static final Set<?> EMPTY_SET = Collections.EMPTY_SET;
+
+    /**
+     * Get a typed empty unmodifiable Set.
+     * @param <E>
+     * @return Set<E>
+     */
+    public static <E> Set<E> emptySet() {
+        return Collections.<E>emptySet();
+    }
+
     /**
      * An empty unmodifiable sorted set.
      * This is not provided in the JDK.
      */
-    public static final SortedSet EMPTY_SORTED_SET = UnmodifiableSortedSet.decorate(new TreeSet());
+    public static final SortedSet<?> EMPTY_SORTED_SET = UnmodifiableSortedSet.decorate(new TreeSet<Object>());
+
+    /**
+     * Get a typed empty unmodifiable sorted set.
+     * @param <E>
+     * @return SortedSet<E>
+     */
+    @SuppressWarnings("unchecked")
+    public static <E> SortedSet<E> emptySortedSet() {
+        return (SortedSet<E>) EMPTY_SORTED_SET;
+    }
 
     /**
      * <code>SetUtils</code> should not normally be instantiated.
@@ -94,7 +113,7 @@ public class SetUtils {
      * @param set2  the second set, may be null
      * @return whether the sets are equal by value comparison
      */
-    public static boolean isEqualSet(final Collection set1, final Collection set2) {
+    public static boolean isEqualSet(final Collection<?> set1, final Collection<?> set2) {
         if (set1 == set2) {
             return true;
         }
@@ -167,7 +186,7 @@ public class SetUtils {
      * @return an unmodifiable set backed by the given set
      * @throws IllegalArgumentException  if the set is null
      */
-    public static Set unmodifiableSet(Set set) {
+    public static <E> Set<E> unmodifiableSet(Set<E> set) {
         return UnmodifiableSet.decorate(set);
     }
 
@@ -200,7 +219,7 @@ public class SetUtils {
      * @return a transformed set backed by the given set
      * @throws IllegalArgumentException  if the Set or Transformer is null
      */
-    public static Set transformedSet(Set set, Transformer transformer) {
+    public static <E> Set<E> transformedSet(Set<E> set, Transformer<? super E, ? extends E> transformer) {
         return TransformedSet.decorate(set, transformer);
     }
     
@@ -215,7 +234,7 @@ public class SetUtils {
      * @return an ordered set backed by the given set
      * @throws IllegalArgumentException  if the Set is null
      */
-    public static Set orderedSet(Set set) {
+    public static <E> Set<E> orderedSet(Set<E> set) {
         return ListOrderedSet.decorate(set);
     }
     
@@ -288,7 +307,7 @@ public class SetUtils {
      * @return a transformed set backed by the given set
      * @throws IllegalArgumentException  if the Set or Transformer is null
      */
-    public static SortedSet transformedSortedSet(SortedSet set, Transformer transformer) {
+    public static <E> SortedSet<E> transformedSortedSet(SortedSet<E> set, Transformer<? super E, ? extends E> transformer) {
         return TransformedSortedSet.decorate(set, transformer);
     }
     

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/SortedBidiMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/SortedBidiMap.java b/src/java/org/apache/commons/collections/SortedBidiMap.java
index efc70b9..b56d7cf 100644
--- a/src/java/org/apache/commons/collections/SortedBidiMap.java
+++ b/src/java/org/apache/commons/collections/SortedBidiMap.java
@@ -16,6 +16,7 @@
  */
 package org.apache.commons.collections;
 
+import java.util.Comparator;
 import java.util.SortedMap;
 
 /**
@@ -49,23 +50,11 @@ public interface SortedBidiMap<K, V> extends OrderedBidiMap<K, V>, SortedMap<K,
      *
      * @return an inverted bidirectional map
      */
-    public BidiMap<V, K> inverseBidiMap();
+    public SortedBidiMap<V, K> inverseBidiMap();
 
     /**
-     * Gets a view of this map where the keys and values are reversed.
-     * <p>
-     * Changes to one map will be visible in the other and vice versa.
-     * This enables both directions of the map to be accessed as a <code>SortedMap</code>.
-     * <p>
-     * Implementations should seek to avoid creating a new object every time this
-     * method is called. See <code>AbstractMap.values()</code> etc. Calling this
-     * method on the inverse map should return the original.
-     * <p>
-     * The inverse map returned by <code>inverseBidiMap()</code> should be the
-     * same object as returned by this method.
-     *
-     * @return an inverted bidirectional map
+     * Get the comparator used for the values in the value-to-key map aspect.
+     * @return Comparator<? super V>
      */
-    public SortedBidiMap<V, K> inverseSortedBidiMap();
-
+    public Comparator<? super V> valueComparator();
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/TransformerUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/TransformerUtils.java b/src/java/org/apache/commons/collections/TransformerUtils.java
index fb96fa3..e602fbf 100644
--- a/src/java/org/apache/commons/collections/TransformerUtils.java
+++ b/src/java/org/apache/commons/collections/TransformerUtils.java
@@ -17,7 +17,6 @@
 package org.apache.commons.collections;
 
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.commons.collections.functors.ChainedTransformer;
@@ -80,8 +79,8 @@ public class TransformerUtils {
      * 
      * @return the transformer
      */
-    public static Transformer exceptionTransformer() {
-        return ExceptionTransformer.INSTANCE;
+    public static <I, O> Transformer<I, O> exceptionTransformer() {
+        return ExceptionTransformer.<I, O>getInstance();
     }
 
     /**
@@ -91,8 +90,8 @@ public class TransformerUtils {
      * 
      * @return the transformer
      */
-    public static Transformer nullTransformer() {
-        return ConstantTransformer.NULL_INSTANCE;
+    public static <I, O> Transformer<I, O> nullTransformer() {
+        return ConstantTransformer.<I, O>getNullInstance();
     }
 
     /**
@@ -104,8 +103,8 @@ public class TransformerUtils {
      * 
      * @return the transformer
      */
-    public static Transformer nopTransformer() {
-        return NOPTransformer.INSTANCE;
+    public static <T> Transformer<T, T> nopTransformer() {
+        return NOPTransformer.<T>getInstance();
     }
 
     /**
@@ -122,8 +121,8 @@ public class TransformerUtils {
      * 
      * @return the transformer
      */
-    public static Transformer cloneTransformer() {
-        return CloneTransformer.INSTANCE;
+    public static <T> Transformer<T, T> cloneTransformer() {
+        return CloneTransformer.<T>getInstance();
     }
 
     /**
@@ -135,7 +134,7 @@ public class TransformerUtils {
      * @param constantToReturn  the constant object to return each time in the transformer
      * @return the transformer.
      */
-    public static Transformer constantTransformer(Object constantToReturn) {
+    public static <I, O> Transformer<I, O> constantTransformer(O constantToReturn) {
         return ConstantTransformer.getInstance(constantToReturn);
     }
 
@@ -149,7 +148,7 @@ public class TransformerUtils {
      * @return the transformer
      * @throws IllegalArgumentException if the closure is null
      */
-    public static Transformer asTransformer(Closure closure) {
+    public static <T> Transformer<T, T> asTransformer(Closure<? super T> closure) {
         return ClosureTransformer.getInstance(closure);
     }
 
@@ -163,7 +162,7 @@ public class TransformerUtils {
      * @return the transformer
      * @throws IllegalArgumentException if the predicate is null
      */
-    public static Transformer asTransformer(Predicate predicate) {
+    public static <T> Transformer<T, Boolean> asTransformer(Predicate<? super T> predicate) {
         return PredicateTransformer.getInstance(predicate);
     }
 
@@ -177,7 +176,7 @@ public class TransformerUtils {
      * @return the transformer
      * @throws IllegalArgumentException if the factory is null
      */
-    public static Transformer asTransformer(Factory factory) {
+    public static <I, O> Transformer<I, O> asTransformer(Factory<? extends O> factory) {
         return FactoryTransformer.getInstance(factory);
     }
 
@@ -192,8 +191,10 @@ public class TransformerUtils {
      * @return the transformer
      * @throws IllegalArgumentException if either transformer is null
      */
-    public static Transformer chainedTransformer(Transformer transformer1, Transformer transformer2) {
-        return ChainedTransformer.getInstance(transformer1, transformer2);
+    public static <T> Transformer<T, T> chainedTransformer(
+            Transformer<? super T, ? extends T> transformer1,
+            Transformer<? super T, ? extends T> transformer2) {
+        return ChainedTransformer.<T>getInstance(transformer1, transformer2);
     }
 
     /**
@@ -207,7 +208,7 @@ public class TransformerUtils {
      * @throws IllegalArgumentException if the transformers array is null
      * @throws IllegalArgumentException if any transformer in the array is null
      */
-    public static Transformer chainedTransformer(Transformer[] transformers) {
+    public static <T> Transformer<T, T> chainedTransformer(Transformer<? super T, ? extends T>[] transformers) {
         return ChainedTransformer.getInstance(transformers);
     }
 
@@ -223,7 +224,8 @@ public class TransformerUtils {
      * @throws IllegalArgumentException if the transformers collection is null
      * @throws IllegalArgumentException if any transformer in the collection is null
      */
-    public static Transformer chainedTransformer(Collection transformers) {
+    public static <T> Transformer<T, T> chainedTransformer(
+            Collection<? extends Transformer<T, T>> transformers) {
         return ChainedTransformer.getInstance(transformers);
     }
 
@@ -240,8 +242,12 @@ public class TransformerUtils {
      * @throws IllegalArgumentException if the predicate is null
      * @throws IllegalArgumentException if either transformer is null
      */
-    public static Transformer switchTransformer(Predicate predicate, Transformer trueTransformer, Transformer falseTransformer) {
-        return SwitchTransformer.getInstance(new Predicate[] { predicate }, new Transformer[] { trueTransformer }, falseTransformer);
+    @SuppressWarnings("unchecked")
+    public static <I, O> Transformer<I, O> switchTransformer(Predicate<? super I> predicate,
+            Transformer<? super I, ? extends O> trueTransformer,
+            Transformer<? super I, ? extends O> falseTransformer) {
+        return SwitchTransformer.getInstance(new Predicate[] { predicate },
+                new Transformer[] { trueTransformer }, falseTransformer);
     }
 
     /**
@@ -260,8 +266,9 @@ public class TransformerUtils {
      * @throws IllegalArgumentException if any element in the arrays is null
      * @throws IllegalArgumentException if the arrays are different sizes
      */
-    public static Transformer switchTransformer(Predicate[] predicates, Transformer[] transformers) {
-        return SwitchTransformer.getInstance(predicates, transformers, null);
+    public static <I, O> Transformer<I, O> switchTransformer(Predicate<? super I>[] predicates,
+            Transformer<? super I, ? extends O>[] transformers) {
+        return SwitchTransformer.<I, O>getInstance(predicates, transformers, null);
     }
 
     /**
@@ -282,8 +289,10 @@ public class TransformerUtils {
      * @throws IllegalArgumentException if any element in the arrays is null
      * @throws IllegalArgumentException if the arrays are different sizes
      */
-    public static Transformer switchTransformer(Predicate[] predicates, Transformer[] transformers, Transformer defaultTransformer) {
-        return SwitchTransformer.getInstance(predicates, transformers, defaultTransformer);
+    public static <I, O> Transformer<I, O> switchTransformer(Predicate<? super I>[] predicates,
+            Transformer<? super I, ? extends O>[] transformers,
+            Transformer<? super I, ? extends O> defaultTransformer) {
+        return SwitchTransformer.<I, O>getInstance(predicates, transformers, defaultTransformer);
     }
 
     /**
@@ -307,8 +316,9 @@ public class TransformerUtils {
      * @throws IllegalArgumentException if any transformer in the map is null
      * @throws ClassCastException  if the map elements are of the wrong type
      */
-    public static Transformer switchTransformer(Map predicatesAndTransformers) {
-        return SwitchTransformer.getInstance(predicatesAndTransformers);
+    public static <I, O> Transformer<I, O> switchTransformer(
+            Map<Predicate<I>, Transformer<I, O>> predicatesAndTransformers) {
+        return SwitchTransformer.<I, O>getInstance(predicatesAndTransformers);
     }
 
     /**
@@ -328,24 +338,23 @@ public class TransformerUtils {
      * @throws IllegalArgumentException if the map is empty
      * @throws IllegalArgumentException if any transformer in the map is null
      */
-    public static Transformer switchMapTransformer(Map objectsAndTransformers) {
-        Transformer[] trs = null;
-        Predicate[] preds = null;
+    @SuppressWarnings("unchecked")
+    public static <I, O> Transformer<I, O> switchMapTransformer(Map<I, Transformer<I, O>> objectsAndTransformers) {
+        Transformer<? super I, ? extends O>[] trs = null;
+        Predicate<I>[] preds = null;
         if (objectsAndTransformers == null) {
             throw new IllegalArgumentException("The object and transformer map must not be null");
         }
-        Transformer def = (Transformer) objectsAndTransformers.remove(null);
+        Transformer<? super I, ? extends O> def = objectsAndTransformers.remove(null);
         int size = objectsAndTransformers.size();
         trs = new Transformer[size];
         preds = new Predicate[size];
         int i = 0;
-        for (Iterator it = objectsAndTransformers.entrySet().iterator(); it.hasNext();) {
-            Map.Entry entry = (Map.Entry) it.next();
-            preds[i] = EqualPredicate.equalPredicate(entry.getKey());
-            trs[i] = (Transformer) entry.getValue();
-            i++;
+        for (Map.Entry<I, Transformer<I, O>> entry : objectsAndTransformers.entrySet()) {
+            preds[i] = EqualPredicate.<I>equalPredicate(entry.getKey());
+            trs[i++] = entry.getValue();
         }
-        return switchTransformer(preds, trs, def);
+        return TransformerUtils.<I, O>switchTransformer(preds, trs, def);
     }
 
     /**
@@ -355,8 +364,8 @@ public class TransformerUtils {
      * 
      * @return the transformer
      */
-    public static Transformer instantiateTransformer() {
-        return InstantiateTransformer.NO_ARG_INSTANCE;
+    public static <T> Transformer<Class<? extends T>, T> instantiateTransformer() {
+        return InstantiateTransformer.<T>getInstance();
     }
 
     /** 
@@ -371,8 +380,9 @@ public class TransformerUtils {
      * @return the transformer
      * @throws IllegalArgumentException if the paramTypes and args don't match
      */
-    public static Transformer instantiateTransformer(Class[] paramTypes, Object[] args) {
-        return InstantiateTransformer.getInstance(paramTypes, args);
+    public static <T> Transformer<Class<? extends T>, T> instantiateTransformer(
+            Class<?>[] paramTypes, Object[] args) {
+        return InstantiateTransformer.<T>getInstance(paramTypes, args);
     }
 
     /** 
@@ -385,7 +395,7 @@ public class TransformerUtils {
      * @return the transformer
      * @throws IllegalArgumentException if the map is null
      */
-    public static Transformer mapTransformer(Map map) {
+    public static <I, O> Transformer<I, O> mapTransformer(Map<? super I, ? extends O> map) {
         return MapTransformer.getInstance(map);
     }
 
@@ -404,8 +414,8 @@ public class TransformerUtils {
      * @return the transformer
      * @throws IllegalArgumentException if the methodName is null.
      */
-    public static Transformer invokerTransformer(String methodName){
-        return InvokerTransformer.getInstance(methodName, null, null);
+    public static <I, O> Transformer<I, O> invokerTransformer(String methodName){
+        return InvokerTransformer.<I, O>getInstance(methodName, null, null);
     }
 
     /**
@@ -422,8 +432,8 @@ public class TransformerUtils {
      * @throws IllegalArgumentException if the method name is null
      * @throws IllegalArgumentException if the paramTypes and args don't match
      */
-    public static Transformer invokerTransformer(String methodName, Class[] paramTypes, Object[] args){
-        return InvokerTransformer.getInstance(methodName, paramTypes, args);
+    public static <I, O> Transformer<I, O> invokerTransformer(String methodName, Class<?>[] paramTypes, Object[] args){
+        return InvokerTransformer.<I, O>getInstance(methodName, paramTypes, args);
     }
 
     /**
@@ -435,8 +445,8 @@ public class TransformerUtils {
      * 
      * @return the transformer
      */
-    public static Transformer stringValueTransformer() {
-        return StringValueTransformer.INSTANCE;
+    public static <T> Transformer<T, String> stringValueTransformer() {
+        return StringValueTransformer.<T>getInstance();
     }
     
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java b/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java
index 95422cc..ae0f55d 100644
--- a/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java
+++ b/src/java/org/apache/commons/collections/bag/AbstractBagDecorator.java
@@ -34,6 +34,9 @@ import org.apache.commons.collections.collection.AbstractCollectionDecorator;
 public abstract class AbstractBagDecorator<E>
         extends AbstractCollectionDecorator<E> implements Bag<E> {
 
+    /** Serialization version */
+    private static final long serialVersionUID = -3768146017343785417L;
+
     /**
      * Constructor only used in deserialization, do not use otherwise.
      * @since Commons Collections 3.1

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/bag/AbstractMapBag.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/AbstractMapBag.java b/src/java/org/apache/commons/collections/bag/AbstractMapBag.java
index 94569cb..f61c9cc 100644
--- a/src/java/org/apache/commons/collections/bag/AbstractMapBag.java
+++ b/src/java/org/apache/commons/collections/bag/AbstractMapBag.java
@@ -33,12 +33,13 @@ import org.apache.commons.collections.set.UnmodifiableSet;
  * Abstract implementation of the {@link Bag} interface to simplify the creation
  * of subclass implementations.
  * <p>
- * Subclasses specify a Map implementation to use as the internal storage.
- * The map will be used to map bag elements to a number; the number represents
- * the number of occurrences of that element in the bag.
- *
+ * Subclasses specify a Map implementation to use as the internal storage. The
+ * map will be used to map bag elements to a number; the number represents the
+ * number of occurrences of that element in the bag.
+ * 
  * @since Commons Collections 3.0 (previously DefaultMapBag v2.0)
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2006-10-27 19:52:37 -0500 (Fri, 27 Oct
+ * 2006) $
  * 
  * @author Chuck Burdick
  * @author Michael A. Smith
@@ -46,16 +47,16 @@ import org.apache.commons.collections.set.UnmodifiableSet;
  * @author Janek Bogucki
  * @author Steve Clark
  */
-public abstract class AbstractMapBag implements Bag {
-    
+public abstract class AbstractMapBag<E> implements Bag<E> {
+
     /** The map to use to store the data */
-    private transient Map map;
+    private transient Map<E, MutableInteger> map;
     /** The current total size of the bag */
     private int size;
     /** The modification count for fail fast iterators */
     private transient int modCount;
     /** The modification count for fail fast iterators */
-    private transient Set uniqueSet;
+    private transient Set<E> uniqueSet;
 
     /**
      * Constructor needed for subclass serialisation.
@@ -66,30 +67,30 @@ public abstract class AbstractMapBag implements Bag {
     }
 
     /**
-     * Constructor that assigns the specified Map as the backing store.
-     * The map must be empty and non-null.
+     * Constructor that assigns the specified Map as the backing store. The map
+     * must be empty and non-null.
      * 
-     * @param map  the map to assign
+     * @param map the map to assign
      */
-    protected AbstractMapBag(Map map) {
+    protected AbstractMapBag(Map<E, MutableInteger> map) {
         super();
         this.map = map;
     }
 
     /**
-     * Utility method for implementations to access the map that backs
-     * this bag. Not intended for interactive use outside of subclasses.
+     * Utility method for implementations to access the map that backs this bag.
+     * Not intended for interactive use outside of subclasses.
      * 
      * @return the map being used by the Bag
      */
-    protected Map getMap() {
+    protected Map<E, MutableInteger> getMap() {
         return map;
     }
 
     //-----------------------------------------------------------------------
     /**
      * Returns the number of elements in this bag.
-     *
+     * 
      * @return current size of the bag
      */
     public int size() {
@@ -98,7 +99,7 @@ public abstract class AbstractMapBag implements Bag {
 
     /**
      * Returns true if the underlying map is empty.
-     *
+     * 
      * @return true if bag is empty
      */
     public boolean isEmpty() {
@@ -106,14 +107,14 @@ public abstract class AbstractMapBag implements Bag {
     }
 
     /**
-     * Returns the number of occurrence of the given element in this bag
-     * by looking up its count in the underlying map.
-     *
-     * @param object  the object to search for
+     * Returns the number of occurrence of the given element in this bag by
+     * looking up its count in the underlying map.
+     * 
+     * @param object the object to search for
      * @return the number of occurrences of the object, zero if not found
      */
     public int getCount(Object object) {
-        MutableInteger count = (MutableInteger) map.get(object);
+        MutableInteger count = map.get(object);
         if (count != null) {
             return count.value;
         }
@@ -124,8 +125,8 @@ public abstract class AbstractMapBag implements Bag {
     /**
      * Determines if the bag contains the given element by checking if the
      * underlying map contains the element as a key.
-     *
-     * @param object  the object to search for
+     * 
+     * @param object the object to search for
      * @return true if the bag contains the given element
      */
     public boolean contains(Object object) {
@@ -135,26 +136,27 @@ public abstract class AbstractMapBag implements Bag {
     /**
      * Determines if the bag contains the given elements.
      * 
-     * @param coll  the collection to check against
+     * @param coll the collection to check against
      * @return <code>true</code> if the Bag contains all the collection
      */
-    public boolean containsAll(Collection coll) {
+    @SuppressWarnings("unchecked")
+    public boolean containsAll(Collection<?> coll) {
         if (coll instanceof Bag) {
-            return containsAll((Bag) coll);
+            return containsAll((Bag<?>) coll);
         }
-        return containsAll(new HashBag(coll));
+        return containsAll(new HashBag<Object>((Collection<Object>) coll));
     }
 
     /**
-     * Returns <code>true</code> if the bag contains all elements in
-     * the given collection, respecting cardinality.
+     * Returns <code>true</code> if the bag contains all elements in the given
+     * collection, respecting cardinality.
      * 
-     * @param other  the bag to check against
+     * @param other the bag to check against
      * @return <code>true</code> if the Bag contains all the collection
      */
-    boolean containsAll(Bag other) {
+    boolean containsAll(Bag<?> other) {
         boolean result = true;
-        Iterator it = other.uniqueSet().iterator();
+        Iterator<?> it = other.uniqueSet().iterator();
         while (it.hasNext()) {
             Object current = it.next();
             boolean contains = getCount(current) >= other.getCount(current);
@@ -165,22 +167,22 @@ public abstract class AbstractMapBag implements Bag {
 
     //-----------------------------------------------------------------------
     /**
-     * Gets an iterator over the bag elements.
-     * Elements present in the Bag more than once will be returned repeatedly.
+     * Gets an iterator over the bag elements. Elements present in the Bag more
+     * than once will be returned repeatedly.
      * 
      * @return the iterator
      */
-    public Iterator iterator() {
-        return new BagIterator(this);
+    public Iterator<E> iterator() {
+        return new BagIterator<E>(this);
     }
 
     /**
      * Inner class iterator for the Bag.
      */
-    static class BagIterator implements Iterator {
-        private AbstractMapBag parent;
-        private Iterator entryIterator;
-        private Map.Entry current;
+    static class BagIterator<E> implements Iterator<E> {
+        private AbstractMapBag<E> parent;
+        private Iterator<Map.Entry<E, MutableInteger>> entryIterator;
+        private Map.Entry<E, MutableInteger> current;
         private int itemCount;
         private final int mods;
         private boolean canRemove;
@@ -188,9 +190,9 @@ public abstract class AbstractMapBag implements Bag {
         /**
          * Constructor.
          * 
-         * @param parent  the parent bag
+         * @param parent the parent bag
          */
-        public BagIterator(AbstractMapBag parent) {
+        public BagIterator(AbstractMapBag<E> parent) {
             this.parent = parent;
             this.entryIterator = parent.map.entrySet().iterator();
             this.current = null;
@@ -202,13 +204,13 @@ public abstract class AbstractMapBag implements Bag {
             return (itemCount > 0 || entryIterator.hasNext());
         }
 
-        public Object next() {
+        public E next() {
             if (parent.modCount != mods) {
                 throw new ConcurrentModificationException();
             }
             if (itemCount == 0) {
-                current = (Map.Entry) entryIterator.next();
-                itemCount = ((MutableInteger) current.getValue()).value;
+                current = (Map.Entry<E, MutableInteger>) entryIterator.next();
+                itemCount = current.getValue().value;
             }
             canRemove = true;
             itemCount--;
@@ -222,7 +224,7 @@ public abstract class AbstractMapBag implements Bag {
             if (canRemove == false) {
                 throw new IllegalStateException();
             }
-            MutableInteger mut = (MutableInteger) current.getValue();
+            MutableInteger mut = current.getValue();
             if (mut.value > 1) {
                 mut.value--;
             } else {
@@ -235,48 +237,49 @@ public abstract class AbstractMapBag implements Bag {
 
     //-----------------------------------------------------------------------
     /**
-     * Adds a new element to the bag, incrementing its count in the underlying map.
-     *
-     * @param object  the object to add
-     * @return <code>true</code> if the object was not already in the <code>uniqueSet</code>
+     * Adds a new element to the bag, incrementing its count in the underlying
+     * map.
+     * 
+     * @param object the object to add
+     * @return <code>true</code> if the object was not already in the
+     * <code>uniqueSet</code>
      */
-    public boolean add(Object object) {
+    public boolean add(E object) {
         return add(object, 1);
     }
 
     /**
      * Adds a new element to the bag, incrementing its count in the map.
-     *
-     * @param object  the object to search for
-     * @param nCopies  the number of copies to add
-     * @return <code>true</code> if the object was not already in the <code>uniqueSet</code>
+     * 
+     * @param object the object to search for
+     * @param nCopies the number of copies to add
+     * @return <code>true</code> if the object was not already in the
+     * <code>uniqueSet</code>
      */
-    public boolean add(Object object, int nCopies) {
+    public boolean add(E object, int nCopies) {
         modCount++;
         if (nCopies > 0) {
-            MutableInteger mut = (MutableInteger) map.get(object);
+            MutableInteger mut = map.get(object);
             size += nCopies;
             if (mut == null) {
                 map.put(object, new MutableInteger(nCopies));
                 return true;
-            } else {
-                mut.value += nCopies;
-                return false;
             }
-        } else {
+            mut.value += nCopies;
             return false;
         }
+        return false;
     }
 
     /**
      * Invokes {@link #add(Object)} for each element in the given collection.
-     *
-     * @param coll  the collection to add
+     * 
+     * @param coll the collection to add
      * @return <code>true</code> if this call changed the bag
      */
-    public boolean addAll(Collection coll) {
+    public boolean addAll(Collection<? extends E> coll) {
         boolean changed = false;
-        Iterator i = coll.iterator();
+        Iterator<? extends E> i = coll.iterator();
         while (i.hasNext()) {
             boolean added = add(i.next());
             changed = changed || added;
@@ -297,11 +300,11 @@ public abstract class AbstractMapBag implements Bag {
     /**
      * Removes all copies of the specified object from the bag.
      * 
-     * @param object  the object to remove
+     * @param object the object to remove
      * @return true if the bag changed
      */
     public boolean remove(Object object) {
-        MutableInteger mut = (MutableInteger) map.get(object);
+        MutableInteger mut = map.get(object);
         if (mut == null) {
             return false;
         }
@@ -314,12 +317,12 @@ public abstract class AbstractMapBag implements Bag {
     /**
      * Removes a specified number of copies of an object from the bag.
      * 
-     * @param object  the object to remove
-     * @param nCopies  the number of copies to remove
+     * @param object the object to remove
+     * @param nCopies the number of copies to remove
      * @return true if the bag changed
      */
     public boolean remove(Object object, int nCopies) {
-        MutableInteger mut = (MutableInteger) map.get(object);
+        MutableInteger mut = map.get(object);
         if (mut == null) {
             return false;
         }
@@ -338,15 +341,16 @@ public abstract class AbstractMapBag implements Bag {
     }
 
     /**
-     * Removes objects from the bag according to their count in the specified collection.
+     * Removes objects from the bag according to their count in the specified
+     * collection.
      * 
-     * @param coll  the collection to use
+     * @param coll the collection to use
      * @return true if the bag changed
      */
-    public boolean removeAll(Collection coll) {
+    public boolean removeAll(Collection<?> coll) {
         boolean result = false;
         if (coll != null) {
-            Iterator i = coll.iterator();
+            Iterator<?> i = coll.iterator();
             while (i.hasNext()) {
                 boolean changed = remove(i.next(), 1);
                 result = result || changed;
@@ -356,33 +360,34 @@ public abstract class AbstractMapBag implements Bag {
     }
 
     /**
-     * Remove any members of the bag that are not in the given
-     * bag, respecting cardinality.
-     *
-     * @param coll  the collection to retain
+     * Remove any members of the bag that are not in the given bag, respecting
+     * cardinality.
+     * 
+     * @param coll the collection to retain
      * @return true if this call changed the collection
      */
-    public boolean retainAll(Collection coll) {
+    @SuppressWarnings("unchecked")
+    public boolean retainAll(Collection<?> coll) {
         if (coll instanceof Bag) {
-            return retainAll((Bag) coll);
+            return retainAll((Bag<?>) coll);
         }
-        return retainAll(new HashBag(coll));
+        return retainAll(new HashBag<Object>((Collection<Object>) coll));
     }
 
     /**
-     * Remove any members of the bag that are not in the given
-     * bag, respecting cardinality.
+     * Remove any members of the bag that are not in the given bag, respecting
+     * cardinality.
      * @see #retainAll(Collection)
      * 
-     * @param other  the bag to retain
+     * @param other the bag to retain
      * @return <code>true</code> if this call changed the collection
      */
-    boolean retainAll(Bag other) {
+    boolean retainAll(Bag<?> other) {
         boolean result = false;
-        Bag excess = new HashBag();
-        Iterator i = uniqueSet().iterator();
+        Bag<E> excess = new HashBag<E>();
+        Iterator<E> i = uniqueSet().iterator();
         while (i.hasNext()) {
-            Object current = i.next();
+            E current = i.next();
             int myCount = getCount(current);
             int otherCount = other.getCount(current);
             if (1 <= otherCount && otherCount <= myCount) {
@@ -404,15 +409,15 @@ public abstract class AbstractMapBag implements Bag {
     protected static class MutableInteger {
         /** The value of this mutable. */
         protected int value;
-        
+
         /**
          * Constructor.
-         * @param value  the initial value
+         * @param value the initial value
          */
         MutableInteger(int value) {
             this.value = value;
         }
-        
+
         public boolean equals(Object obj) {
             if (obj instanceof MutableInteger == false) {
                 return false;
@@ -424,19 +429,19 @@ public abstract class AbstractMapBag implements Bag {
             return value;
         }
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Returns an array of all of this bag's elements.
-     *
+     * 
      * @return an array of all of this bag's elements
      */
     public Object[] toArray() {
         Object[] result = new Object[size()];
         int i = 0;
-        Iterator it = map.keySet().iterator();
+        Iterator<E> it = map.keySet().iterator();
         while (it.hasNext()) {
-            Object current = it.next();
+            E current = it.next();
             for (int index = getCount(current); index > 0; index--) {
                 result[i++] = current;
             }
@@ -446,38 +451,39 @@ public abstract class AbstractMapBag implements Bag {
 
     /**
      * Returns an array of all of this bag's elements.
-     *
-     * @param array  the array to populate
+     * 
+     * @param array the array to populate
      * @return an array of all of this bag's elements
      */
-    public Object[] toArray(Object[] array) {
+    @SuppressWarnings("unchecked")
+    public <T> T[] toArray(T[] array) {
         int size = size();
         if (array.length < size) {
-            array = (Object[]) Array.newInstance(array.getClass().getComponentType(), size);
+            array = (T[]) Array.newInstance(array.getClass().getComponentType(), size);
         }
 
         int i = 0;
-        Iterator it = map.keySet().iterator();
+        Iterator<E> it = map.keySet().iterator();
         while (it.hasNext()) {
-            Object current = it.next();
+            E current = it.next();
             for (int index = getCount(current); index > 0; index--) {
-                array[i++] = current;
+                array[i++] = (T) current;
             }
         }
-        if (array.length > size) {
-            array[size] = null;
+        while (i < array.length) {
+            array[i++] = null;
         }
         return array;
     }
 
     /**
      * Returns an unmodifiable view of the underlying map's key set.
-     *
+     * 
      * @return the set of unique elements in this bag
      */
-    public Set uniqueSet() {
+    public Set<E> uniqueSet() {
         if (uniqueSet == null) {
-            uniqueSet = UnmodifiableSet.decorate(map.keySet());
+            uniqueSet = UnmodifiableSet.<E> decorate(map.keySet());
         }
         return uniqueSet;
     }
@@ -485,26 +491,28 @@ public abstract class AbstractMapBag implements Bag {
     //-----------------------------------------------------------------------
     /**
      * Write the map out using a custom routine.
-     * @param out  the output stream
+     * @param out the output stream
      * @throws IOException
      */
     protected void doWriteObject(ObjectOutputStream out) throws IOException {
         out.writeInt(map.size());
-        for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
-            Map.Entry entry = (Map.Entry) it.next();
+        for (Iterator<Map.Entry<E, MutableInteger>> it = map.entrySet().iterator(); it.hasNext();) {
+            Map.Entry<E, MutableInteger> entry = it.next();
             out.writeObject(entry.getKey());
-            out.writeInt(((MutableInteger) entry.getValue()).value);
+            out.writeInt(entry.getValue().value);
         }
     }
 
     /**
      * Read the map in using a custom routine.
-     * @param map  the map to use
-     * @param in  the input stream
+     * @param map the map to use
+     * @param in the input stream
      * @throws IOException
      * @throws ClassNotFoundException
      */
-    protected void doReadObject(Map map, ObjectInputStream in) throws IOException, ClassNotFoundException {
+    @SuppressWarnings("unchecked")
+    protected void doReadObject(Map map, ObjectInputStream in) throws IOException,
+            ClassNotFoundException {
         this.map = map;
         int entrySize = in.readInt();
         for (int i = 0; i < entrySize; i++) {
@@ -514,14 +522,13 @@ public abstract class AbstractMapBag implements Bag {
             size += count;
         }
     }
-    
+
     //-----------------------------------------------------------------------
     /**
-     * Compares this Bag to another.
-     * This Bag equals another Bag if it contains the same number of occurrences of
-     * the same elements.
+     * Compares this Bag to another. This Bag equals another Bag if it contains
+     * the same number of occurrences of the same elements.
      * 
-     * @param object  the Bag to compare to
+     * @param object the Bag to compare to
      * @return true if equal
      */
     public boolean equals(Object object) {
@@ -531,12 +538,12 @@ public abstract class AbstractMapBag implements Bag {
         if (object instanceof Bag == false) {
             return false;
         }
-        Bag other = (Bag) object;
+        Bag<?> other = (Bag<?>) object;
         if (other.size() != size()) {
             return false;
         }
-        for (Iterator it = map.keySet().iterator(); it.hasNext();) {
-            Object element = it.next();
+        for (Iterator<E> it = map.keySet().iterator(); it.hasNext();) {
+            E element = it.next();
             if (other.getCount(element) != getCount(element)) {
                 return false;
             }
@@ -546,19 +553,19 @@ public abstract class AbstractMapBag implements Bag {
 
     /**
      * Gets a hash code for the Bag compatible with the definition of equals.
-     * The hash code is defined as the sum total of a hash code for each element.
-     * The per element hash code is defined as
-     * <code>(e==null ? 0 : e.hashCode()) ^ noOccurances)</code>.
-     * This hash code is compatible with the Set interface.
+     * The hash code is defined as the sum total of a hash code for each
+     * element. The per element hash code is defined as
+     * <code>(e==null ? 0 : e.hashCode()) ^ noOccurances)</code>. This hash code
+     * is compatible with the Set interface.
      * 
      * @return the hash code of the Bag
      */
     public int hashCode() {
         int total = 0;
-        for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
-            Map.Entry entry = (Map.Entry) it.next();
-            Object element = entry.getKey();
-            MutableInteger count = (MutableInteger) entry.getValue();
+        for (Iterator<Map.Entry<E, MutableInteger>> it = map.entrySet().iterator(); it.hasNext();) {
+            Map.Entry<E, MutableInteger> entry = it.next();
+            E element = entry.getKey();
+            MutableInteger count = entry.getValue();
             total += (element == null ? 0 : element.hashCode()) ^ count.value;
         }
         return total;
@@ -575,7 +582,7 @@ public abstract class AbstractMapBag implements Bag {
         }
         StringBuffer buf = new StringBuffer();
         buf.append('[');
-        Iterator it = uniqueSet().iterator();
+        Iterator<E> it = uniqueSet().iterator();
         while (it.hasNext()) {
             Object current = it.next();
             int count = getCount(current);
@@ -589,5 +596,5 @@ public abstract class AbstractMapBag implements Bag {
         buf.append(']');
         return buf.toString();
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/bag/AbstractSortedBagDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/AbstractSortedBagDecorator.java b/src/java/org/apache/commons/collections/bag/AbstractSortedBagDecorator.java
index 0a3fc25..5446842 100644
--- a/src/java/org/apache/commons/collections/bag/AbstractSortedBagDecorator.java
+++ b/src/java/org/apache/commons/collections/bag/AbstractSortedBagDecorator.java
@@ -33,6 +33,9 @@ import org.apache.commons.collections.SortedBag;
 public abstract class AbstractSortedBagDecorator<E>
         extends AbstractBagDecorator<E> implements SortedBag<E> {
 
+    /** Serialization version */
+    private static final long serialVersionUID = -8223473624050467718L;
+
     /**
      * Constructor only used in deserialization, do not use otherwise.
      * @since Commons Collections 3.1

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/bag/HashBag.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/HashBag.java b/src/java/org/apache/commons/collections/bag/HashBag.java
index 4d47512..b92b0bd 100644
--- a/src/java/org/apache/commons/collections/bag/HashBag.java
+++ b/src/java/org/apache/commons/collections/bag/HashBag.java
@@ -41,8 +41,8 @@ import org.apache.commons.collections.Bag;
  * @author Chuck Burdick
  * @author Stephen Colebourne
  */
-public class HashBag
-        extends AbstractMapBag implements Bag, Serializable {
+public class HashBag<E>
+        extends AbstractMapBag<E> implements Bag<E>, Serializable {
 
     /** Serial version lock */
     private static final long serialVersionUID = -6561115435802554013L;
@@ -51,7 +51,7 @@ public class HashBag
      * Constructs an empty <code>HashBag</code>.
      */
     public HashBag() {
-        super(new HashMap());
+        super(new HashMap<E, MutableInteger>());
     }
 
     /**
@@ -59,7 +59,7 @@ public class HashBag
      * 
      * @param coll  a collection to copy into this bag
      */
-    public HashBag(Collection coll) {
+    public HashBag(Collection<? extends E> coll) {
         this();
         addAll(coll);
     }
@@ -78,7 +78,7 @@ public class HashBag
      */
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
-        super.doReadObject(new HashMap(), in);
+        super.doReadObject(new HashMap<E, MutableInteger>(), in);
     }
     
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/bag/SynchronizedBag.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/SynchronizedBag.java b/src/java/org/apache/commons/collections/bag/SynchronizedBag.java
index 2bc47c0..cd4958f 100644
--- a/src/java/org/apache/commons/collections/bag/SynchronizedBag.java
+++ b/src/java/org/apache/commons/collections/bag/SynchronizedBag.java
@@ -115,6 +115,9 @@ public class SynchronizedBag<E>
      * Synchronized Set for the Bag class.
      */
     class SynchronizedBagSet extends SynchronizedSet<E> {
+        /** Serialization version */
+        private static final long serialVersionUID = 2990565892366827855L;
+
         /**
          * Constructor.
          * @param set  the set to decorate

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java b/src/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java
index d4c84ad..86bfc09 100644
--- a/src/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java
+++ b/src/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java
@@ -48,8 +48,8 @@ public class SynchronizedSortedBag<E>
      * @return a new synchronized SortedBag
      * @throws IllegalArgumentException if bag is null
      */
-    public static <T> SortedBag<T> decorate(SortedBag<T> bag) {
-        return new SynchronizedSortedBag<T>(bag);
+    public static <E> SortedBag<E> decorate(SortedBag<E> bag) {
+        return new SynchronizedSortedBag<E>(bag);
     }
     
     //-----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/bag/TransformedBag.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/TransformedBag.java b/src/java/org/apache/commons/collections/bag/TransformedBag.java
index e0a7689..8663d8b 100644
--- a/src/java/org/apache/commons/collections/bag/TransformedBag.java
+++ b/src/java/org/apache/commons/collections/bag/TransformedBag.java
@@ -38,8 +38,8 @@ import org.apache.commons.collections.set.TransformedSet;
  * 
  * @author Stephen Colebourne
  */
-public class TransformedBag
-        extends TransformedCollection implements Bag {
+public class TransformedBag<E>
+        extends TransformedCollection<E> implements Bag<E> {
 
     /** Serialization version */
     private static final long serialVersionUID = 5421170911299074185L;
@@ -55,8 +55,8 @@ public class TransformedBag
      * @return a new transformed Bag
      * @throws IllegalArgumentException if bag or transformer is null
      */
-    public static Bag decorate(Bag bag, Transformer transformer) {
-        return new TransformedBag(bag, transformer);
+    public static <E> Bag<E> decorate(Bag<E> bag, Transformer<? super E, ? extends E> transformer) {
+        return new TransformedBag<E>(bag, transformer);
     }
     
     //-----------------------------------------------------------------------
@@ -70,7 +70,7 @@ public class TransformedBag
      * @param transformer  the transformer to use for conversion, must not be null
      * @throws IllegalArgumentException if bag or transformer is null
      */
-    protected TransformedBag(Bag bag, Transformer transformer) {
+    protected TransformedBag(Bag<E> bag, Transformer<? super E, ? extends E> transformer) {
         super(bag, transformer);
     }
 
@@ -79,8 +79,8 @@ public class TransformedBag
      * 
      * @return the decorated bag
      */
-    protected Bag getBag() {
-        return (Bag) collection;
+    protected Bag<E> getBag() {
+        return (Bag<E>) collection;
     }
 
     //-----------------------------------------------------------------------
@@ -93,14 +93,13 @@ public class TransformedBag
     }
 
     //-----------------------------------------------------------------------
-    public boolean add(Object object, int nCopies) {
-        object = transform(object);
-        return getBag().add(object, nCopies);
+    public boolean add(E object, int nCopies) {
+        return getBag().add(transform(object), nCopies);
     }
 
-    public Set uniqueSet() {
-        Set set = getBag().uniqueSet();
-        return TransformedSet.decorate(set, transformer);
+    public Set<E> uniqueSet() {
+        Set<E> set = getBag().uniqueSet();
+        return TransformedSet.<E>decorate(set, transformer);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/bag/TransformedSortedBag.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/TransformedSortedBag.java b/src/java/org/apache/commons/collections/bag/TransformedSortedBag.java
index a978129..9bdb922 100644
--- a/src/java/org/apache/commons/collections/bag/TransformedSortedBag.java
+++ b/src/java/org/apache/commons/collections/bag/TransformedSortedBag.java
@@ -36,8 +36,8 @@ import org.apache.commons.collections.Transformer;
  * 
  * @author Stephen Colebourne
  */
-public class TransformedSortedBag
-        extends TransformedBag implements SortedBag {
+public class TransformedSortedBag<E>
+        extends TransformedBag<E> implements SortedBag<E> {
 
     /** Serialization version */
     private static final long serialVersionUID = -251737742649401930L;
@@ -53,8 +53,8 @@ public class TransformedSortedBag
      * @return a new transformed SortedBag
      * @throws IllegalArgumentException if bag or transformer is null
      */
-    public static SortedBag decorate(SortedBag bag, Transformer transformer) {
-        return new TransformedSortedBag(bag, transformer);
+    public static <E> SortedBag<E> decorate(SortedBag<E> bag, Transformer<? super E, ? extends E> transformer) {
+        return new TransformedSortedBag<E>(bag, transformer);
     }
     
     //-----------------------------------------------------------------------
@@ -68,7 +68,7 @@ public class TransformedSortedBag
      * @param transformer  the transformer to use for conversion, must not be null
      * @throws IllegalArgumentException if bag or transformer is null
      */
-    protected TransformedSortedBag(SortedBag bag, Transformer transformer) {
+    protected TransformedSortedBag(SortedBag<E> bag, Transformer<? super E, ? extends E> transformer) {
         super(bag, transformer);
     }
 
@@ -77,20 +77,20 @@ public class TransformedSortedBag
      * 
      * @return the decorated bag
      */
-    protected SortedBag getSortedBag() {
-        return (SortedBag) collection;
+    protected SortedBag<E> getSortedBag() {
+        return (SortedBag<E>) collection;
     }
 
     //-----------------------------------------------------------------------
-    public Object first() {
+    public E first() {
         return getSortedBag().first();
     }
 
-    public Object last() {
+    public E last() {
         return getSortedBag().last();
     }
 
-    public Comparator comparator() {
+    public Comparator<? super E> comparator() {
         return getSortedBag().comparator();
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/bag/TreeBag.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/TreeBag.java b/src/java/org/apache/commons/collections/bag/TreeBag.java
index b73eac7..f2091a5 100644
--- a/src/java/org/apache/commons/collections/bag/TreeBag.java
+++ b/src/java/org/apache/commons/collections/bag/TreeBag.java
@@ -34,63 +34,72 @@ import org.apache.commons.collections.SortedBag;
  * Order will be maintained among the bag members and can be viewed through the
  * iterator.
  * <p>
- * A <code>Bag</code> stores each object in the collection together with a
- * count of occurrences. Extra methods on the interface allow multiple copies
- * of an object to be added or removed at once. It is important to read the
- * interface javadoc carefully as several methods violate the
- * <code>Collection</code> interface specification.
- *
+ * A <code>Bag</code> stores each object in the collection together with a count
+ * of occurrences. Extra methods on the interface allow multiple copies of an
+ * object to be added or removed at once. It is important to read the interface
+ * javadoc carefully as several methods violate the <code>Collection</code>
+ * interface specification.
+ * 
  * @since Commons Collections 3.0 (previously in main package v2.0)
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2006-10-27 19:52:37 -0500 (Fri, 27 Oct
+ * 2006) $
  * 
  * @author Chuck Burdick
  * @author Stephen Colebourne
  */
-public class TreeBag
-        extends AbstractMapBag implements SortedBag, Serializable {
+public class TreeBag<E> extends AbstractMapBag<E> implements SortedBag<E>, Serializable {
 
     /** Serial version lock */
     private static final long serialVersionUID = -7740146511091606676L;
-    
+
     /**
      * Constructs an empty <code>TreeBag</code>.
      */
     public TreeBag() {
-        super(new TreeMap());
+        super(new TreeMap<E, MutableInteger>());
     }
 
     /**
-     * Constructs an empty bag that maintains order on its unique
-     * representative members according to the given {@link Comparator}.
+     * Constructs an empty bag that maintains order on its unique representative
+     * members according to the given {@link Comparator}.
      * 
-     * @param comparator  the comparator to use
+     * @param comparator the comparator to use
      */
-    public TreeBag(Comparator comparator) {
-        super(new TreeMap(comparator));
+    public TreeBag(Comparator<? super E> comparator) {
+        super(new TreeMap<E, MutableInteger>(comparator));
     }
 
     /**
      * Constructs a <code>TreeBag</code> containing all the members of the
      * specified collection.
      * 
-     * @param coll  the collection to copy into the bag
+     * @param coll the collection to copy into the bag
      */
-    public TreeBag(Collection coll) {
+    public TreeBag(Collection<? extends E> coll) {
         this();
         addAll(coll);
     }
 
     //-----------------------------------------------------------------------
-    public Object first() {
-        return ((SortedMap) getMap()).firstKey();
+    public E first() {
+        return getMap().firstKey();
     }
 
-    public Object last() {
-        return ((SortedMap) getMap()).lastKey();
+    public E last() {
+        return getMap().lastKey();
     }
 
-    public Comparator comparator() {
-        return ((SortedMap) getMap()).comparator();
+    public Comparator<? super E> comparator() {
+        return getMap().comparator();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected SortedMap<E, org.apache.commons.collections.bag.AbstractMapBag.MutableInteger> getMap() {
+        return (SortedMap<E, org.apache.commons.collections.bag.AbstractMapBag.MutableInteger>) super
+                .getMap();
     }
 
     //-----------------------------------------------------------------------
@@ -106,10 +115,11 @@ public class TreeBag
     /**
      * Read the bag in using a custom routine.
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
         Comparator comp = (Comparator) in.readObject();
         super.doReadObject(new TreeMap(comp), in);
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/bag/UnmodifiableBag.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/UnmodifiableBag.java b/src/java/org/apache/commons/collections/bag/UnmodifiableBag.java
index ee85e82..b2c9609 100644
--- a/src/java/org/apache/commons/collections/bag/UnmodifiableBag.java
+++ b/src/java/org/apache/commons/collections/bag/UnmodifiableBag.java
@@ -39,8 +39,8 @@ import org.apache.commons.collections.set.UnmodifiableSet;
  * 
  * @author Stephen Colebourne
  */
-public final class UnmodifiableBag
-        extends AbstractBagDecorator implements Unmodifiable, Serializable {
+public final class UnmodifiableBag<E>
+        extends AbstractBagDecorator<E> implements Unmodifiable, Serializable {
 
     /** Serialization version */
     private static final long serialVersionUID = -1873799975157099624L;
@@ -54,11 +54,11 @@ public final class UnmodifiableBag
      * @return an unmodifiable Bag
      * @throws IllegalArgumentException if bag is null
      */
-    public static Bag decorate(Bag bag) {
+    public static <E> Bag<E> decorate(Bag<E> bag) {
         if (bag instanceof Unmodifiable) {
             return bag;
         }
-        return new UnmodifiableBag(bag);
+        return new UnmodifiableBag<E>(bag);
     }
 
     //-----------------------------------------------------------------------
@@ -68,7 +68,7 @@ public final class UnmodifiableBag
      * @param bag  the bag to decorate, must not be null
      * @throws IllegalArgumentException if bag is null
      */
-    private UnmodifiableBag(Bag bag) {
+    private UnmodifiableBag(Bag<E> bag) {
         super(bag);
     }
 
@@ -91,21 +91,22 @@ public final class UnmodifiableBag
      * @throws IOException
      * @throws ClassNotFoundException
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
-        collection = (Collection) in.readObject();
+        collection = (Collection<E>) in.readObject();
     }
 
     //-----------------------------------------------------------------------
-    public Iterator iterator() {
-        return UnmodifiableIterator.decorate(decorated().iterator());
+    public Iterator<E> iterator() {
+        return UnmodifiableIterator.<E>decorate(decorated().iterator());
     }
 
-    public boolean add(Object object) {
+    public boolean add(E object) {
         throw new UnsupportedOperationException();
     }
 
-    public boolean addAll(Collection coll) {
+    public boolean addAll(Collection<? extends E> coll) {
         throw new UnsupportedOperationException();
     }
 
@@ -117,16 +118,16 @@ public final class UnmodifiableBag
         throw new UnsupportedOperationException();
     }
 
-    public boolean removeAll(Collection coll) {
+    public boolean removeAll(Collection<?> coll) {
         throw new UnsupportedOperationException();
     }
 
-    public boolean retainAll(Collection coll) {
+    public boolean retainAll(Collection<?> coll) {
         throw new UnsupportedOperationException();
     }
 
     //-----------------------------------------------------------------------
-    public boolean add(Object object, int count) {
+    public boolean add(E object, int count) {
         throw new UnsupportedOperationException();
     }
 
@@ -134,9 +135,9 @@ public final class UnmodifiableBag
         throw new UnsupportedOperationException();
     }
 
-    public Set uniqueSet() {
-        Set set = decorated().uniqueSet();
-        return UnmodifiableSet.decorate(set);
+    public Set<E> uniqueSet() {
+        Set<E> set = decorated().uniqueSet();
+        return UnmodifiableSet.<E>decorate(set);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java b/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java
index 5018a58..023f470 100644
--- a/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java
+++ b/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java
@@ -54,11 +54,11 @@ public final class UnmodifiableSortedBag<E>
      * @return an unmodifiable SortedBag
      * @throws IllegalArgumentException if bag is null
      */
-    public static <T> SortedBag<T> decorate(SortedBag<T> bag) {
+    public static <E> SortedBag<E> decorate(SortedBag<E> bag) {
         if (bag instanceof Unmodifiable) {
             return bag;
         }
-        return new UnmodifiableSortedBag<T>(bag);
+        return new UnmodifiableSortedBag<E>(bag);
     }
 
     //-----------------------------------------------------------------------
@@ -91,13 +91,14 @@ public final class UnmodifiableSortedBag<E>
      * @throws IOException
      * @throws ClassNotFoundException
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
         collection = (Collection<E>) in.readObject();
     }
 
     //-----------------------------------------------------------------------
-    public Iterator iterator() {
+    public Iterator<E> iterator() {
         return UnmodifiableIterator.decorate(decorated().iterator());
     }
 


[51/77] [abbrv] commons-collections git commit: Add OrderedMap to our SortedMap implementations

Posted by ch...@apache.org.
Add OrderedMap to our SortedMap implementations

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@751871 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/b29b93af
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/b29b93af
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/b29b93af

Branch: refs/heads/collections_jdk5_branch
Commit: b29b93afa7393d411e2ca094fb82b32ed81abba1
Parents: 68e12b9
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Mon Mar 9 22:13:34 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Mon Mar 9 22:13:34 2009 +0000

----------------------------------------------------------------------
 .../commons/collections/IterableSortedMap.java  | 33 ++++++++++
 .../collections/bidimap/DualTreeBidiMap.java    |  8 +++
 .../map/AbstractSortedMapDecorator.java         | 69 +++++++++++++++++++-
 3 files changed, 109 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/b29b93af/src/java/org/apache/commons/collections/IterableSortedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/IterableSortedMap.java b/src/java/org/apache/commons/collections/IterableSortedMap.java
new file mode 100644
index 0000000..b987dba
--- /dev/null
+++ b/src/java/org/apache/commons/collections/IterableSortedMap.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections;
+
+import java.util.SortedMap;
+
+/**
+ * {@link SortedMap} + {@link OrderedMap}.
+ *
+ * @param <K> the type of the keys in the map
+ * @param <V> the type of the values in the map
+ * @since Commons Collections 5
+ * @TODO fix version
+ * @version $Revision$ $Date$
+ *
+ * @author Matt Benson
+ */
+public interface IterableSortedMap<K, V> extends SortedMap<K, V>, OrderedMap<K, V> {
+}

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/b29b93af/src/java/org/apache/commons/collections/bidimap/DualTreeBidiMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bidimap/DualTreeBidiMap.java b/src/java/org/apache/commons/collections/bidimap/DualTreeBidiMap.java
index 5ced759..b8fb0d7 100644
--- a/src/java/org/apache/commons/collections/bidimap/DualTreeBidiMap.java
+++ b/src/java/org/apache/commons/collections/bidimap/DualTreeBidiMap.java
@@ -269,6 +269,14 @@ public class DualTreeBidiMap<K, V> extends AbstractDualBidiMap<K, V> implements
         protected DualTreeBidiMap<K, V> decorated() {
             return (DualTreeBidiMap<K, V>) super.decorated();
         }
+
+        public K previousKey(K key) {
+            return decorated().previousKey(key);
+        };
+
+        public K nextKey(K key) {
+            return decorated().nextKey(key);
+        };
     }
 
     //-----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/b29b93af/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java b/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java
index 7c9a35b..d47411b 100644
--- a/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java
+++ b/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java
@@ -17,8 +17,16 @@
 package org.apache.commons.collections.map;
 
 import java.util.Comparator;
+import java.util.Iterator;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Set;
 import java.util.SortedMap;
 
+import org.apache.commons.collections.IterableSortedMap;
+import org.apache.commons.collections.OrderedMapIterator;
+import org.apache.commons.collections.iterators.ListIteratorWrapper;
+
 /** 
  * Provides a base decorator that enables additional functionality to be added
  * to a Map via decoration.
@@ -39,7 +47,7 @@ import java.util.SortedMap;
  * @author Stephen Colebourne
  */
 public abstract class AbstractSortedMapDecorator<K, V> extends AbstractMapDecorator<K, V> implements
-        SortedMap<K, V> {
+        IterableSortedMap<K, V> {
 
     /**
      * Constructor only used in deserialization, do not use otherwise.
@@ -93,4 +101,63 @@ public abstract class AbstractSortedMapDecorator<K, V> extends AbstractMapDecora
         return decorated().tailMap(fromKey);
     }
 
+    public K previousKey(K key) {
+        SortedMap<K, V> headMap = headMap(key);
+        return headMap.isEmpty() ? null : headMap.lastKey();
+    };
+
+    public K nextKey(K key) {
+        Iterator<K> it = tailMap(key).keySet().iterator();
+        it.next();
+        return it.hasNext() ? it.next() : null;
+    };
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public OrderedMapIterator<K, V> mapIterator() {
+        return new SortedMapIterator<K, V>(entrySet());
+    }
+
+    /**
+     * OrderedMapIterator implementation.
+     *
+     * @param <K>
+     * @param <V>
+     */
+    protected static class SortedMapIterator<K, V> extends EntrySetToMapIteratorAdapter<K, V>
+            implements OrderedMapIterator<K, V> {
+
+        /**
+         * Create a new AbstractSortedMapDecorator.SortedMapIterator.
+         */
+        protected SortedMapIterator(Set<Map.Entry<K, V>> entrySet) {
+            super(entrySet);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public synchronized void reset() {
+            super.reset();
+            iterator = new ListIteratorWrapper<Map.Entry<K, V>>(iterator);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public boolean hasPrevious() {
+            return ((ListIterator<Map.Entry<K, V>>) iterator).hasPrevious();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public K previous() {
+            entry = ((ListIterator<Map.Entry<K, V>>) iterator).previous();
+            return getKey();
+        }
+    }
 }


[58/77] [abbrv] commons-collections git commit: revert IteratorUtils stuff; toList() works fine for this--duh

Posted by ch...@apache.org.
revert IteratorUtils stuff; toList() works fine for this--duh

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@753392 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/91796da5
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/91796da5
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/91796da5

Branch: refs/heads/collections_jdk5_branch
Commit: 91796da5b22843acb2e2d72af53fef816ef982ad
Parents: e17ccdb
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Fri Mar 13 20:39:53 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Fri Mar 13 20:39:53 2009 +0000

----------------------------------------------------------------------
 .../apache/commons/collections/IteratorUtils.java   | 16 ----------------
 .../commons/collections/TestIteratorUtils.java      | 13 -------------
 2 files changed, 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/91796da5/src/java/org/apache/commons/collections/IteratorUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/IteratorUtils.java b/src/java/org/apache/commons/collections/IteratorUtils.java
index 3d066c2..cefc2d7 100644
--- a/src/java/org/apache/commons/collections/IteratorUtils.java
+++ b/src/java/org/apache/commons/collections/IteratorUtils.java
@@ -916,20 +916,4 @@ public class IteratorUtils {
         return singletonIterator(obj);
     }
 
-    /**
-     * Return an {@link Iterable} so that any {@link Iterator} can be used
-     * with the "foreach" statement.
-     * @param <T> element type
-     * @param iterator to wrap
-     * @return Iterable<T>
-     * @since Commons Collections 5
-     * @TODO fix version
-     */
-    public static <T> Iterable<T> iterable(final Iterator<T> iterator) {
-        return new Iterable<T>() {
-            public Iterator<T> iterator() {
-                return iterator;
-            }
-        };
-    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/91796da5/src/test/org/apache/commons/collections/TestIteratorUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestIteratorUtils.java b/src/test/org/apache/commons/collections/TestIteratorUtils.java
index 6bb142c..dc24155 100644
--- a/src/test/org/apache/commons/collections/TestIteratorUtils.java
+++ b/src/test/org/apache/commons/collections/TestIteratorUtils.java
@@ -725,17 +725,4 @@ public class TestIteratorUtils extends BulkTest {
         }
     }
 
-    public void testIterable() throws Exception {
-        Integer[] array = new Integer[10];
-        for (int i = 0; i < array.length; i++) {
-            array[i] = i;
-        }
-        Iterator<Integer> it = Arrays.asList(array).iterator();
-        int i = 0;
-        for (Integer o : IteratorUtils.iterable(it)) {
-            assertEquals(i, o.intValue());
-            i++;
-        }
-        assertEquals(i, array.length);
-    }
 }


[76/77] [abbrv] commons-collections git commit: Add missing license header.

Posted by ch...@apache.org.
Add missing license header.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@1713762 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/d74b0b0a
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/d74b0b0a
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/d74b0b0a

Branch: refs/heads/collections_jdk5_branch
Commit: d74b0b0aded099a1caa2b1380b6fa61c74f33601
Parents: 50053b6
Author: Gary D. Gregory <gg...@apache.org>
Authored: Wed Nov 11 05:02:24 2015 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Wed Nov 11 05:02:24 2015 +0000

----------------------------------------------------------------------
 xdocs/style/project.css | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/d74b0b0a/xdocs/style/project.css
----------------------------------------------------------------------
diff --git a/xdocs/style/project.css b/xdocs/style/project.css
index c1d541c..3f385c1 100644
--- a/xdocs/style/project.css
+++ b/xdocs/style/project.css
@@ -1 +1,18 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  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.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
 @import url("http://commons.apache.org/style/commons-maven.css");


[26/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/SwitchTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/SwitchTransformer.java b/src/java/org/apache/commons/collections/functors/SwitchTransformer.java
index 370a610..3e62247 100644
--- a/src/java/org/apache/commons/collections/functors/SwitchTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/SwitchTransformer.java
@@ -17,7 +17,6 @@
 package org.apache.commons.collections.functors;
 
 import java.io.Serializable;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.commons.collections.Predicate;
@@ -32,17 +31,17 @@ import org.apache.commons.collections.Transformer;
  *
  * @author Stephen Colebourne
  */
-public class SwitchTransformer implements Transformer, Serializable {
+public class SwitchTransformer<I, O> implements Transformer<I, O>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = -6404460890903469332L;
 
     /** The tests to consider */
-    private final Predicate[] iPredicates;
+    private final Predicate<? super I>[] iPredicates;
     /** The matching transformers to call */
-    private final Transformer[] iTransformers;
+    private final Transformer<? super I, ? extends O>[] iTransformers;
     /** The default transformer to call if no tests match */
-    private final Transformer iDefault;
+    private final Transformer<? super I, ? extends O> iDefault;
 
     /**
      * Factory method that performs validation and copies the parameter arrays.
@@ -54,18 +53,21 @@ public class SwitchTransformer implements Transformer, Serializable {
      * @throws IllegalArgumentException if array is null
      * @throws IllegalArgumentException if any element in the array is null
      */
-    public static Transformer getInstance(Predicate[] predicates, Transformer[] transformers, Transformer defaultTransformer) {
+    @SuppressWarnings("unchecked")
+    public static <I, O> Transformer<I, O> getInstance(Predicate<? super I>[] predicates,
+            Transformer<? super I, ? extends O>[] transformers,
+            Transformer<? super I, ? extends O> defaultTransformer) {
         FunctorUtils.validate(predicates);
         FunctorUtils.validate(transformers);
         if (predicates.length != transformers.length) {
             throw new IllegalArgumentException("The predicate and transformer arrays must be the same size");
         }
         if (predicates.length == 0) {
-            return (defaultTransformer == null ? ConstantTransformer.NULL_INSTANCE : defaultTransformer);
+            return (Transformer<I, O>) (defaultTransformer == null ? ConstantTransformer.<I, O>getNullInstance() : defaultTransformer);
         }
         predicates = FunctorUtils.copy(predicates);
         transformers = FunctorUtils.copy(transformers);
-        return new SwitchTransformer(predicates, transformers, defaultTransformer);
+        return new SwitchTransformer<I, O>(predicates, transformers, defaultTransformer);
     }
 
     /**
@@ -85,31 +87,30 @@ public class SwitchTransformer implements Transformer, Serializable {
      * @throws IllegalArgumentException if any transformer in the map is null
      * @throws ClassCastException  if the map elements are of the wrong type
      */
-    public static Transformer getInstance(Map predicatesAndTransformers) {
-        Transformer[] transformers = null;
-        Predicate[] preds = null;
+    @SuppressWarnings("unchecked")
+    public static <I, O> Transformer<I, O> getInstance(
+            Map<? extends Predicate<? super I>, ? extends Transformer<? super I, ? extends O>> predicatesAndTransformers) {
         if (predicatesAndTransformers == null) {
             throw new IllegalArgumentException("The predicate and transformer map must not be null");
         }
         if (predicatesAndTransformers.size() == 0) {
-            return ConstantTransformer.NULL_INSTANCE;
+            return ConstantTransformer.<I, O>getNullInstance();
         }
         // convert to array like this to guarantee iterator() ordering
-        Transformer defaultTransformer = (Transformer) predicatesAndTransformers.remove(null);
+        Transformer<? super I, ? extends O> defaultTransformer = predicatesAndTransformers.remove(null);
         int size = predicatesAndTransformers.size();
         if (size == 0) {
-            return (defaultTransformer == null ? ConstantTransformer.NULL_INSTANCE : defaultTransformer);
+            return (Transformer<I, O>) (defaultTransformer == null ? ConstantTransformer.<I, O>getNullInstance() : defaultTransformer);
         }
-        transformers = new Transformer[size];
-        preds = new Predicate[size];
+        Transformer<? super I, ? extends O>[] transformers = new Transformer[size];
+        Predicate<? super I>[] preds = new Predicate[size];
         int i = 0;
-        for (Iterator it = predicatesAndTransformers.entrySet().iterator(); it.hasNext();) {
-            Map.Entry entry = (Map.Entry) it.next();
-            preds[i] = (Predicate) entry.getKey();
-            transformers[i] = (Transformer) entry.getValue();
+        for (Map.Entry<? extends Predicate<? super I>, ? extends Transformer<? super I, ? extends O>> entry : predicatesAndTransformers.entrySet()) {
+            preds[i] = entry.getKey();
+            transformers[i] = entry.getValue();
             i++;
         }
-        return new SwitchTransformer(preds, transformers, defaultTransformer);
+        return new SwitchTransformer<I, O>(preds, transformers, defaultTransformer);
     }
     
     /**
@@ -120,11 +121,14 @@ public class SwitchTransformer implements Transformer, Serializable {
      * @param transformers  matching array of transformers, not cloned, no nulls
      * @param defaultTransformer  the transformer to use if no match, null means return null
      */
-    public SwitchTransformer(Predicate[] predicates, Transformer[] transformers, Transformer defaultTransformer) {
+    @SuppressWarnings("unchecked")
+    public SwitchTransformer(Predicate<? super I>[] predicates,
+            Transformer<? super I, ? extends O>[] transformers,
+            Transformer<? super I, ? extends O> defaultTransformer) {
         super();
         iPredicates = predicates;
         iTransformers = transformers;
-        iDefault = (defaultTransformer == null ? ConstantTransformer.NULL_INSTANCE : defaultTransformer);
+        iDefault = (Transformer<? super I, ? extends O>) (defaultTransformer == null ? ConstantTransformer.<I, O>getNullInstance() : defaultTransformer);
     }
 
     /**
@@ -134,7 +138,7 @@ public class SwitchTransformer implements Transformer, Serializable {
      * @param input  the input object to transform
      * @return the transformed result
      */
-    public Object transform(Object input) {
+    public O transform(I input) {
         for (int i = 0; i < iPredicates.length; i++) {
             if (iPredicates[i].evaluate(input) == true) {
                 return iTransformers[i].transform(input);
@@ -149,7 +153,7 @@ public class SwitchTransformer implements Transformer, Serializable {
      * @return the predicates
      * @since Commons Collections 3.1
      */
-    public Predicate[] getPredicates() {
+    public Predicate<? super I>[] getPredicates() {
         return iPredicates;
     }
 
@@ -159,7 +163,7 @@ public class SwitchTransformer implements Transformer, Serializable {
      * @return the transformers
      * @since Commons Collections 3.1
      */
-    public Transformer[] getTransformers() {
+    public Transformer<? super I, ? extends O>[] getTransformers() {
         return iTransformers;
     }
 
@@ -169,7 +173,7 @@ public class SwitchTransformer implements Transformer, Serializable {
      * @return the default transformer
      * @since Commons Collections 3.1
      */
-    public Transformer getDefaultTransformer() {
+    public Transformer<? super I, ? extends O> getDefaultTransformer() {
         return iDefault;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/TransformedPredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/TransformedPredicate.java b/src/java/org/apache/commons/collections/functors/TransformedPredicate.java
index 92c0447..5b5d3ed 100644
--- a/src/java/org/apache/commons/collections/functors/TransformedPredicate.java
+++ b/src/java/org/apache/commons/collections/functors/TransformedPredicate.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,80 +24,82 @@ import org.apache.commons.collections.Transformer;
 /**
  * Predicate implementation that transforms the given object before invoking
  * another <code>Predicate</code>.
- * 
+ *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
  * @author Alban Peignier
  * @author Stephen Colebourne
  */
-public final class TransformedPredicate implements Predicate, PredicateDecorator, Serializable {
+public final class TransformedPredicate<T> implements Predicate<T>, PredicateDecorator<T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = -5596090919668315834L;
-    
+
     /** The transformer to call */
-    private final Transformer iTransformer;
+    private final Transformer<? super T, ? extends T> iTransformer;
+
     /** The predicate to call */
-    private final Predicate iPredicate;
+    private final Predicate<? super T> iPredicate;
 
     /**
      * Factory to create the predicate.
-     * 
+     *
      * @param transformer  the transformer to call
      * @param predicate  the predicate to call with the result of the transform
      * @return the predicate
      * @throws IllegalArgumentException if the transformer or the predicate is null
      */
-    public static Predicate getInstance(Transformer transformer, Predicate predicate) {
+    public static <T> Predicate<T> getInstance(Transformer<? super T, ? extends T> transformer, Predicate<? super T> predicate) {
         if (transformer == null) {
             throw new IllegalArgumentException("The transformer to call must not be null");
         }
         if (predicate == null) {
             throw new IllegalArgumentException("The predicate to call must not be null");
         }
-        return new TransformedPredicate(transformer, predicate);
+        return new TransformedPredicate<T>(transformer, predicate);
     }
 
     /**
      * Constructor that performs no validation.
      * Use <code>getInstance</code> if you want that.
-     * 
+     *
      * @param transformer  the transformer to use
      * @param predicate  the predicate to decorate
      */
-    public TransformedPredicate(Transformer transformer, Predicate predicate) {
+    public TransformedPredicate(Transformer<? super T, ? extends T> transformer, Predicate<? super T> predicate) {
         iTransformer = transformer;
         iPredicate = predicate;
     }
-    
+
     /**
      * Evaluates the predicate returning the result of the decorated predicate
      * once the input has been transformed
-     * 
+     *
      * @param object  the input object which will be transformed
      * @return true if decorated predicate returns true
      */
-    public boolean evaluate(Object object) {
-        Object result = iTransformer.transform(object);
+    public boolean evaluate(T object) {
+        T result = iTransformer.transform(object);
         return iPredicate.evaluate(result);
     }
 
     /**
      * Gets the predicate being decorated.
-     * 
+     *
      * @return the predicate as the only element in an array
      * @since Commons Collections 3.1
      */
-    public Predicate[] getPredicates() {
+    @SuppressWarnings("unchecked")
+    public Predicate<? super T>[] getPredicates() {
         return new Predicate[] {iPredicate};
     }
 
     /**
      * Gets the transformer in use.
-     * 
+     *
      * @return the transformer
      */
-    public Transformer getTransformer() {
+    public Transformer<? super T, ? extends T> getTransformer() {
         return iTransformer;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/TransformerClosure.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/TransformerClosure.java b/src/java/org/apache/commons/collections/functors/TransformerClosure.java
index dc7110a..614b194 100644
--- a/src/java/org/apache/commons/collections/functors/TransformerClosure.java
+++ b/src/java/org/apache/commons/collections/functors/TransformerClosure.java
@@ -30,13 +30,13 @@ import org.apache.commons.collections.Transformer;
  *
  * @author Stephen Colebourne
  */
-public class TransformerClosure implements Closure, Serializable {
+public class TransformerClosure<E> implements Closure<E>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = -5194992589193388969L;
 
     /** The transformer to wrap */
-    private final Transformer iTransformer;
+    private final Transformer<? super E, ?> iTransformer;
 
     /**
      * Factory method that performs validation.
@@ -46,11 +46,11 @@ public class TransformerClosure implements Closure, Serializable {
      * @param transformer  the transformer to call, null means nop
      * @return the <code>transformer</code> closure
      */
-    public static Closure getInstance(Transformer transformer) {
+    public static <E> Closure<E> getInstance(Transformer<? super E, ?> transformer) {
         if (transformer == null) {
-            return NOPClosure.INSTANCE;
+            return NOPClosure.<E>getInstance();
         }
-        return new TransformerClosure(transformer);
+        return new TransformerClosure<E>(transformer);
     }
 
     /**
@@ -59,7 +59,7 @@ public class TransformerClosure implements Closure, Serializable {
      * 
      * @param transformer  the transformer to call, not null
      */
-    public TransformerClosure(Transformer transformer) {
+    public TransformerClosure(Transformer<? super E, ?> transformer) {
         super();
         iTransformer = transformer;
     }
@@ -69,7 +69,7 @@ public class TransformerClosure implements Closure, Serializable {
      * 
      * @param input  the input object
      */
-    public void execute(Object input) {
+    public void execute(E input) {
         iTransformer.transform(input);
     }
 
@@ -79,7 +79,7 @@ public class TransformerClosure implements Closure, Serializable {
      * @return the transformer
      * @since Commons Collections 3.1
      */
-    public Transformer getTransformer() {
+    public Transformer<? super E, ?> getTransformer() {
         return iTransformer;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/TransformerPredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/TransformerPredicate.java b/src/java/org/apache/commons/collections/functors/TransformerPredicate.java
index 97483c8..396ed42 100644
--- a/src/java/org/apache/commons/collections/functors/TransformerPredicate.java
+++ b/src/java/org/apache/commons/collections/functors/TransformerPredicate.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,69 +24,68 @@ import org.apache.commons.collections.Transformer;
 
 /**
  * Predicate implementation that returns the result of a transformer.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
  * @author Stephen Colebourne
  */
-public final class TransformerPredicate implements Predicate, Serializable {
+public final class TransformerPredicate<T> implements Predicate<T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = -2407966402920578741L;
-    
+
     /** The transformer to call */
-    private final Transformer iTransformer;
-    
+    private final Transformer<? super T, Boolean> iTransformer;
+
     /**
      * Factory to create the predicate.
-     * 
+     *
      * @param transformer  the transformer to decorate
      * @return the predicate
      * @throws IllegalArgumentException if the transformer is null
      */
-    public static Predicate getInstance(Transformer transformer) {
+    public static <T> Predicate<T> getInstance(Transformer<? super T, Boolean> transformer) {
         if (transformer == null) {
             throw new IllegalArgumentException("The transformer to call must not be null");
         }
-        return new TransformerPredicate(transformer);
+        return new TransformerPredicate<T>(transformer);
     }
 
     /**
      * Constructor that performs no validation.
      * Use <code>getInstance</code> if you want that.
-     * 
+     *
      * @param transformer  the transformer to decorate
      */
-    public TransformerPredicate(Transformer transformer) {
+    public TransformerPredicate(Transformer<? super T, Boolean> transformer) {
         super();
         iTransformer = transformer;
     }
 
     /**
      * Evaluates the predicate returning the result of the decorated transformer.
-     * 
+     *
      * @param object  the input object
      * @return true if decorated transformer returns Boolean.TRUE
      * @throws FunctorException if the transformer returns an invalid type
      */
-    public boolean evaluate(Object object) {
-        Object result = iTransformer.transform(object);
-        if (result instanceof Boolean == false) {
+    public boolean evaluate(T object) {
+        Boolean result = iTransformer.transform(object);
+        if (result == null) {
             throw new FunctorException(
-                "Transformer must return an instanceof Boolean, it was a "
-                    + (result == null ? "null object" : result.getClass().getName()));
+                    "Transformer must return an instanceof Boolean, it was a null object");
         }
-        return ((Boolean) result).booleanValue();
+        return result;
     }
 
     /**
      * Gets the transformer.
-     * 
+     *
      * @return the transformer
      * @since Commons Collections 3.1
      */
-    public Transformer getTransformer() {
+    public Transformer<? super T, Boolean> getTransformer() {
         return iTransformer;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/UniquePredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/UniquePredicate.java b/src/java/org/apache/commons/collections/functors/UniquePredicate.java
index ada31e6..22f189f 100644
--- a/src/java/org/apache/commons/collections/functors/UniquePredicate.java
+++ b/src/java/org/apache/commons/collections/functors/UniquePredicate.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.
@@ -25,28 +25,28 @@ import org.apache.commons.collections.Predicate;
 /**
  * Predicate implementation that returns true the first time an object is
  * passed into the predicate.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
  * @author Stephen Colebourne
  */
-public final class UniquePredicate implements Predicate, Serializable {
+public final class UniquePredicate<T> implements Predicate<T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = -3319417438027438040L;
-    
+
     /** The set of previously seen objects */
-    private final Set iSet = new HashSet();
-    
+    private final Set<T> iSet = new HashSet<T>();
+
     /**
      * Factory to create the predicate.
-     * 
+     *
      * @return the predicate
      * @throws IllegalArgumentException if the predicate is null
      */
-    public static Predicate getInstance() {
-        return new UniquePredicate();
+    public static <E> Predicate<E> getInstance() {
+        return new UniquePredicate<E>();
     }
 
     /**
@@ -60,11 +60,11 @@ public final class UniquePredicate implements Predicate, Serializable {
     /**
      * Evaluates the predicate returning true if the input object hasn't been
      * received yet.
-     * 
+     *
      * @param object  the input object
      * @return true if this is the first time the object is seen
      */
-    public boolean evaluate(Object object) {
+    public boolean evaluate(T object) {
         return iSet.add(object);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/functors/WhileClosure.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/WhileClosure.java b/src/java/org/apache/commons/collections/functors/WhileClosure.java
index 90957c6..9970809 100644
--- a/src/java/org/apache/commons/collections/functors/WhileClosure.java
+++ b/src/java/org/apache/commons/collections/functors/WhileClosure.java
@@ -30,15 +30,15 @@ import org.apache.commons.collections.Predicate;
  *
  * @author Stephen Colebourne
  */
-public class WhileClosure implements Closure, Serializable {
+public class WhileClosure<E> implements Closure<E>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = -3110538116913760108L;
 
     /** The test condition */
-    private final Predicate iPredicate;
+    private final Predicate<? super E> iPredicate;
     /** The closure to call */
-    private final Closure iClosure;
+    private final Closure<? super E> iClosure;
     /** The flag, true is a do loop, false is a while */
     private final boolean iDoLoop;
 
@@ -51,14 +51,14 @@ public class WhileClosure implements Closure, Serializable {
      * @return the <code>while</code> closure
      * @throws IllegalArgumentException if the predicate or closure is null
      */
-    public static Closure getInstance(Predicate predicate, Closure closure, boolean doLoop) {
+    public static <E> Closure<E> getInstance(Predicate<? super E> predicate, Closure<? super E> closure, boolean doLoop) {
         if (predicate == null) {
             throw new IllegalArgumentException("Predicate must not be null");
         }
         if (closure == null) {
             throw new IllegalArgumentException("Closure must not be null");
         }
-        return new WhileClosure(predicate, closure, doLoop);
+        return new WhileClosure<E>(predicate, closure, doLoop);
     }
 
     /**
@@ -69,7 +69,7 @@ public class WhileClosure implements Closure, Serializable {
      * @param closure  the closure the execute, not null
      * @param doLoop  true to act as a do-while loop, always executing the closure once
      */
-    public WhileClosure(Predicate predicate, Closure closure, boolean doLoop) {
+    public WhileClosure(Predicate<? super E> predicate, Closure<? super E> closure, boolean doLoop) {
         super();
         iPredicate = predicate;
         iClosure = closure;
@@ -81,7 +81,7 @@ public class WhileClosure implements Closure, Serializable {
      * 
      * @param input  the input object
      */
-    public void execute(Object input) {
+    public void execute(E input) {
         if (iDoLoop) {
             iClosure.execute(input);
         }
@@ -96,7 +96,7 @@ public class WhileClosure implements Closure, Serializable {
      * @return the predicate
      * @since Commons Collections 3.1
      */
-    public Predicate getPredicate() {
+    public Predicate<? super E> getPredicate() {
         return iPredicate;
     }
 
@@ -106,7 +106,7 @@ public class WhileClosure implements Closure, Serializable {
      * @return the closure
      * @since Commons Collections 3.1
      */
-    public Closure getClosure() {
+    public Closure<? super E> getClosure() {
         return iClosure;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/AbstractEmptyIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/AbstractEmptyIterator.java b/src/java/org/apache/commons/collections/iterators/AbstractEmptyIterator.java
index 93e4cfd..4546ddf 100644
--- a/src/java/org/apache/commons/collections/iterators/AbstractEmptyIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/AbstractEmptyIterator.java
@@ -26,7 +26,7 @@ import java.util.NoSuchElementException;
  * 
  * @author Stephen Colebourne
  */
-abstract class AbstractEmptyIterator {
+abstract class AbstractEmptyIterator<E> {
  
     /**
      * Constructor.
@@ -39,7 +39,7 @@ abstract class AbstractEmptyIterator {
         return false;
     }
 
-    public Object next() {
+    public E next() {
         throw new NoSuchElementException("Iterator contains no elements");
     }
 
@@ -47,7 +47,7 @@ abstract class AbstractEmptyIterator {
         return false;
     }
 
-    public Object previous() {
+    public E previous() {
         throw new NoSuchElementException("Iterator contains no elements");
     }
 
@@ -59,11 +59,11 @@ abstract class AbstractEmptyIterator {
         return -1;
     }
 
-    public void add(Object obj) {
+    public void add(E obj) {
         throw new UnsupportedOperationException("add() not supported for empty Iterator");
     }
 
-    public void set(Object obj) {
+    public void set(E obj) {
         throw new IllegalStateException("Iterator contains no elements");
     }
 
@@ -71,18 +71,6 @@ abstract class AbstractEmptyIterator {
         throw new IllegalStateException("Iterator contains no elements");
     }
 
-    public Object getKey() {
-        throw new IllegalStateException("Iterator contains no elements");
-    }
-
-    public Object getValue() {
-        throw new IllegalStateException("Iterator contains no elements");
-    }
-
-    public Object setValue(Object value) {
-        throw new IllegalStateException("Iterator contains no elements");
-    }
-
     public void reset() {
         // do nothing
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/AbstractEmptyMapIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/AbstractEmptyMapIterator.java b/src/java/org/apache/commons/collections/iterators/AbstractEmptyMapIterator.java
new file mode 100644
index 0000000..d59684b
--- /dev/null
+++ b/src/java/org/apache/commons/collections/iterators/AbstractEmptyMapIterator.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections.iterators;
+
+/** 
+ * Provides an implementation of an empty map iterator.
+ *
+ * @since Commons Collections 5
+ * @version $Revision$ $Date$
+ * 
+ * @author Stephen Colebourne
+ * @author Matt Benson
+ */
+public abstract class AbstractEmptyMapIterator<K, V> extends AbstractEmptyIterator<K> {
+
+    /**
+     * Create a new AbstractEmptyMapIterator.
+     */
+    public AbstractEmptyMapIterator() {
+        super();
+    }
+
+    public K getKey() {
+        throw new IllegalStateException("Iterator contains no elements");
+    }
+
+    public V getValue() {
+        throw new IllegalStateException("Iterator contains no elements");
+    }
+
+    public V setValue(V value) {
+        throw new IllegalStateException("Iterator contains no elements");
+    }
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/AbstractIteratorDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/AbstractIteratorDecorator.java b/src/java/org/apache/commons/collections/iterators/AbstractIteratorDecorator.java
index 0dce364..2151ebc 100644
--- a/src/java/org/apache/commons/collections/iterators/AbstractIteratorDecorator.java
+++ b/src/java/org/apache/commons/collections/iterators/AbstractIteratorDecorator.java
@@ -18,7 +18,7 @@ package org.apache.commons.collections.iterators;
 
 import java.util.Iterator;
 
-/** 
+/**
  * Provides basic behaviour for decorating an iterator with extra functionality.
  * <p>
  * All methods are forwarded to the decorated iterator.
@@ -29,10 +29,7 @@ import java.util.Iterator;
  * @author James Strachan
  * @author Stephen Colebourne
  */
-public class AbstractIteratorDecorator implements Iterator {
-
-    /** The iterator being decorated */
-    protected final Iterator iterator;
+public abstract class AbstractIteratorDecorator<E> extends AbstractUntypedIteratorDecorator<E, E> {
 
     //-----------------------------------------------------------------------
     /**
@@ -41,34 +38,12 @@ public class AbstractIteratorDecorator implements Iterator {
      * @param iterator  the iterator to decorate, must not be null
      * @throws IllegalArgumentException if the collection is null
      */
-    public AbstractIteratorDecorator(Iterator iterator) {
-        super();
-        if (iterator == null) {
-            throw new IllegalArgumentException("Iterator must not be null");
-        }
-        this.iterator = iterator;
-    }
-
-    /**
-     * Gets the iterator being decorated.
-     * 
-     * @return the decorated iterator
-     */
-    protected Iterator getIterator() {
-        return iterator;
-    }
-
-    //-----------------------------------------------------------------------
-    public boolean hasNext() {
-        return iterator.hasNext();
-    }
-
-    public Object next() {
-        return iterator.next();
+    protected AbstractIteratorDecorator(Iterator<E> iterator) {
+        super(iterator);
     }
 
-    public void remove() {
-        iterator.remove();
+    public E next() {
+        return getIterator().next();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/AbstractMapIteratorDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/AbstractMapIteratorDecorator.java b/src/java/org/apache/commons/collections/iterators/AbstractMapIteratorDecorator.java
index 0db387f..f728680 100644
--- a/src/java/org/apache/commons/collections/iterators/AbstractMapIteratorDecorator.java
+++ b/src/java/org/apache/commons/collections/iterators/AbstractMapIteratorDecorator.java
@@ -28,10 +28,10 @@ import org.apache.commons.collections.MapIterator;
  * 
  * @author Stephen Colebourne
  */
-public class AbstractMapIteratorDecorator implements MapIterator {
+public class AbstractMapIteratorDecorator<K, V> implements MapIterator<K, V> {
 
     /** The iterator being decorated */
-    protected final MapIterator iterator;
+    protected final MapIterator<K, V> iterator;
 
     //-----------------------------------------------------------------------
     /**
@@ -40,7 +40,7 @@ public class AbstractMapIteratorDecorator implements MapIterator {
      * @param iterator  the iterator to decorate, must not be null
      * @throws IllegalArgumentException if the collection is null
      */
-    public AbstractMapIteratorDecorator(MapIterator iterator) {
+    public AbstractMapIteratorDecorator(MapIterator<K, V> iterator) {
         super();
         if (iterator == null) {
             throw new IllegalArgumentException("MapIterator must not be null");
@@ -53,7 +53,7 @@ public class AbstractMapIteratorDecorator implements MapIterator {
      * 
      * @return the decorated iterator
      */
-    protected MapIterator getMapIterator() {
+    protected MapIterator<K, V> getMapIterator() {
         return iterator;
     }
 
@@ -62,7 +62,7 @@ public class AbstractMapIteratorDecorator implements MapIterator {
         return iterator.hasNext();
     }
 
-    public Object next() {
+    public K next() {
         return iterator.next();
     }
 
@@ -70,15 +70,15 @@ public class AbstractMapIteratorDecorator implements MapIterator {
         iterator.remove();
     }
     
-    public Object getKey() {
+    public K getKey() {
         return iterator.getKey();
     }
 
-    public Object getValue() {
+    public V getValue() {
         return iterator.getValue();
     }
 
-    public Object setValue(Object obj) {
+    public V setValue(V obj) {
         return iterator.setValue(obj);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/AbstractOrderedMapIteratorDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/AbstractOrderedMapIteratorDecorator.java b/src/java/org/apache/commons/collections/iterators/AbstractOrderedMapIteratorDecorator.java
index 9dd866e..8f1d687 100644
--- a/src/java/org/apache/commons/collections/iterators/AbstractOrderedMapIteratorDecorator.java
+++ b/src/java/org/apache/commons/collections/iterators/AbstractOrderedMapIteratorDecorator.java
@@ -28,10 +28,10 @@ import org.apache.commons.collections.OrderedMapIterator;
  * 
  * @author Stephen Colebourne
  */
-public class AbstractOrderedMapIteratorDecorator implements OrderedMapIterator {
+public class AbstractOrderedMapIteratorDecorator<K, V> implements OrderedMapIterator<K, V> {
 
     /** The iterator being decorated */
-    protected final OrderedMapIterator iterator;
+    protected final OrderedMapIterator<K, V> iterator;
 
     //-----------------------------------------------------------------------
     /**
@@ -40,7 +40,7 @@ public class AbstractOrderedMapIteratorDecorator implements OrderedMapIterator {
      * @param iterator  the iterator to decorate, must not be null
      * @throws IllegalArgumentException if the collection is null
      */
-    public AbstractOrderedMapIteratorDecorator(OrderedMapIterator iterator) {
+    public AbstractOrderedMapIteratorDecorator(OrderedMapIterator<K, V> iterator) {
         super();
         if (iterator == null) {
             throw new IllegalArgumentException("OrderedMapIterator must not be null");
@@ -53,7 +53,7 @@ public class AbstractOrderedMapIteratorDecorator implements OrderedMapIterator {
      * 
      * @return the decorated iterator
      */
-    protected OrderedMapIterator getOrderedMapIterator() {
+    protected OrderedMapIterator<K, V> getOrderedMapIterator() {
         return iterator;
     }
 
@@ -62,7 +62,7 @@ public class AbstractOrderedMapIteratorDecorator implements OrderedMapIterator {
         return iterator.hasNext();
     }
 
-    public Object next() {
+    public K next() {
         return iterator.next();
     }
 
@@ -70,7 +70,7 @@ public class AbstractOrderedMapIteratorDecorator implements OrderedMapIterator {
         return iterator.hasPrevious();
     }
 
-    public Object previous() {
+    public K previous() {
         return iterator.previous();
     }
 
@@ -78,15 +78,15 @@ public class AbstractOrderedMapIteratorDecorator implements OrderedMapIterator {
         iterator.remove();
     }
     
-    public Object getKey() {
+    public K getKey() {
         return iterator.getKey();
     }
 
-    public Object getValue() {
+    public V getValue() {
         return iterator.getValue();
     }
 
-    public Object setValue(Object obj) {
+    public V setValue(V obj) {
         return iterator.setValue(obj);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/AbstractUntypedIteratorDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/AbstractUntypedIteratorDecorator.java b/src/java/org/apache/commons/collections/iterators/AbstractUntypedIteratorDecorator.java
new file mode 100644
index 0000000..57ba89f
--- /dev/null
+++ b/src/java/org/apache/commons/collections/iterators/AbstractUntypedIteratorDecorator.java
@@ -0,0 +1,54 @@
+/**
+ * 
+ */
+package org.apache.commons.collections.iterators;
+
+import java.util.Iterator;
+
+/**
+ * Provides basic behaviour for decorating an iterator with extra functionality
+ * without committing the generic type of the Iterator implementation.
+ * <p>
+ * All methods are forwarded to the decorated iterator.
+ * 
+ * @since Commons Collections 5
+ * @version $Revision$ $Date$
+ * 
+ * @author James Strachan
+ * @author Stephen Colebourne
+ * @author Matt Benson
+ */
+public abstract class AbstractUntypedIteratorDecorator<I, O> implements Iterator<O> {
+
+    /** The iterator being decorated */
+    protected final Iterator<I> iterator;
+
+    /**
+     * Create a new AbstractUntypedIteratorDecorator.
+     */
+    protected AbstractUntypedIteratorDecorator(Iterator<I> iterator) {
+        super();
+        if (iterator == null) {
+            throw new IllegalArgumentException("Iterator must not be null");
+        }
+        this.iterator = iterator;
+    }
+
+    /**
+     * Gets the iterator being decorated.
+     * 
+     * @return the decorated iterator
+     */
+    protected Iterator<I> getIterator() {
+        return iterator;
+    }
+
+    public boolean hasNext() {
+        return iterator.hasNext();
+    }
+
+    public void remove() {
+        iterator.remove();
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/ArrayIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/ArrayIterator.java b/src/java/org/apache/commons/collections/iterators/ArrayIterator.java
index bd96825..809101c 100644
--- a/src/java/org/apache/commons/collections/iterators/ArrayIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/ArrayIterator.java
@@ -41,7 +41,7 @@ import org.apache.commons.collections.ResettableIterator;
  * @author Neil O'Toole
  * @author Stephen Colebourne
  */
-public class ArrayIterator implements ResettableIterator {
+public class ArrayIterator<E> implements ResettableIterator<E> {
 
     /** The array to iterate over */    
     protected Object array;
@@ -159,11 +159,12 @@ public class ArrayIterator implements ResettableIterator {
      * @throws NoSuchElementException if all the elements in the array
      *  have already been returned
      */
-    public Object next() {
+    @SuppressWarnings("unchecked")
+    public E next() {
         if (hasNext() == false) {
             throw new NoSuchElementException();
         }
-        return Array.get(array, index++);
+        return (E) Array.get(array, index++);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java b/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java
index bd0ef55..159bcc2 100644
--- a/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java
@@ -44,8 +44,8 @@ import org.apache.commons.collections.ResettableListIterator;
  * @author Stephen Colebourne
  * @author Phil Steitz
  */
-public class ArrayListIterator extends ArrayIterator
-		implements ListIterator, ResettableListIterator {
+public class ArrayListIterator<E> extends ArrayIterator<E>
+		implements ListIterator<E>, ResettableListIterator<E> {
 
     /**
      * Holds the index of the last item returned by a call to <code>next()</code>
@@ -129,12 +129,13 @@ public class ArrayListIterator extends ArrayIterator
      * @return the previous element
      * @throws NoSuchElementException if there is no previous element
      */
-    public Object previous() {
+    @SuppressWarnings("unchecked")
+    public E previous() {
         if (hasPrevious() == false) {
             throw new NoSuchElementException();
         }
         this.lastItemIndex = --this.index;
-        return Array.get(this.array, this.index);
+        return (E) Array.get(this.array, this.index);
     }
 
     /**
@@ -143,12 +144,13 @@ public class ArrayListIterator extends ArrayIterator
      * @return the next element
      * @throws NoSuchElementException if there is no next element
      */
-    public Object next() {
+    @SuppressWarnings("unchecked")
+    public E next() {
         if (hasNext() == false) {
             throw new NoSuchElementException();
         }
         this.lastItemIndex = this.index;
-        return Array.get(this.array, this.index++);
+        return (E) Array.get(this.array, this.index++);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/CollatingIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/CollatingIterator.java b/src/java/org/apache/commons/collections/iterators/CollatingIterator.java
index e50907c..9105e9e 100644
--- a/src/java/org/apache/commons/collections/iterators/CollatingIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/CollatingIterator.java
@@ -27,99 +27,107 @@ import java.util.NoSuchElementException;
 import org.apache.commons.collections.list.UnmodifiableList;
 
 /**
- * Provides an ordered iteration over the elements contained in
- * a collection of ordered Iterators.
+ * Provides an ordered iteration over the elements contained in a collection of
+ * ordered Iterators.
  * <p>
- * Given two ordered {@link Iterator} instances <code>A</code> and <code>B</code>,
- * the {@link #next} method on this iterator will return the lesser of 
- * <code>A.next()</code> and <code>B.next()</code>.
- *
+ * Given two ordered {@link Iterator} instances <code>A</code> and
+ * <code>B</code>, the {@link #next} method on this iterator will return the
+ * lesser of <code>A.next()</code> and <code>B.next()</code>.
+ * 
  * @since Commons Collections 2.1
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2006-10-27 19:52:37 -0500 (Fri, 27 Oct
+ * 2006) $
  * 
  * @author Rodney Waldhoff
  * @author Stephen Colebourne
  */
-public class CollatingIterator implements Iterator {
+public class CollatingIterator<E> implements Iterator<E> {
 
     /** The {@link Comparator} used to evaluate order. */
-    private Comparator comparator = null;
+    private Comparator<? super E> comparator = null;
 
     /** The list of {@link Iterator}s to evaluate. */
-    private ArrayList iterators = null;
-   
+    private ArrayList<Iterator<? extends E>> iterators = null;
+
     /** {@link Iterator#next Next} objects peeked from each iterator. */
-    private ArrayList values = null;
-    
+    private ArrayList<E> values = null;
+
     /** Whether or not each {@link #values} element has been set. */
     private BitSet valueSet = null;
 
-    /** Index of the {@link #iterators iterator} from whom the last returned value was obtained. */
+    /**
+     * Index of the {@link #iterators iterator} from whom the last returned
+     * value was obtained.
+     */
     private int lastReturned = -1;
 
     // Constructors
     // ----------------------------------------------------------------------
     /**
-     * Constructs a new <code>CollatingIterator</code>.  Natural sort order
-     * will be used, and child iterators will have to be manually added 
-     * using the {@link #addIterator(Iterator)} method.
+     * Constructs a new <code>CollatingIterator</code>. Natural sort order will
+     * be used, and child iterators will have to be manually added using the
+     * {@link #addIterator(Iterator)} method.
      */
     public CollatingIterator() {
-        this(null,2);
+        this(null, 2);
     }
-    
+
     /**
      * Constructs a new <code>CollatingIterator</code> that will used the
-     * specified comparator for ordering.  Child iterators will have to be 
+     * specified comparator for ordering. Child iterators will have to be
      * manually added using the {@link #addIterator(Iterator)} method.
-     *
-     * @param comp  the comparator to use to sort, or null to use natural sort order
+     * 
+     * @param comp the comparator to use to sort, or null to use natural sort
+     * order
      */
-    public CollatingIterator(final Comparator comp) {
-        this(comp,2);
+    public CollatingIterator(final Comparator<? super E> comp) {
+        this(comp, 2);
     }
-    
+
     /**
      * Constructs a new <code>CollatingIterator</code> that will used the
      * specified comparator for ordering and have the specified initial
-     * capacity.  Child iterators will have to be 
-     * manually added using the {@link #addIterator(Iterator)} method.
-     *
-     * @param comp  the comparator to use to sort, or null to use natural sort order
-     * @param initIterCapacity  the initial capacity for the internal list
-     *    of child iterators
+     * capacity. Child iterators will have to be manually added using the
+     * {@link #addIterator(Iterator)} method.
+     * 
+     * @param comp the comparator to use to sort, or null to use natural sort
+     * order
+     * @param initIterCapacity the initial capacity for the internal list of
+     * child iterators
      */
-    public CollatingIterator(final Comparator comp, final int initIterCapacity) {
-        iterators = new ArrayList(initIterCapacity);
+    public CollatingIterator(final Comparator<? super E> comp, final int initIterCapacity) {
+        iterators = new ArrayList<Iterator<? extends E>>(initIterCapacity);
         setComparator(comp);
     }
 
     /**
      * Constructs a new <code>CollatingIterator</code> that will use the
-     * specified comparator to provide ordered iteration over the two
-     * given iterators.
-     *
-     * @param comp  the comparator to use to sort, or null to use natural sort order
-     * @param a  the first child ordered iterator
-     * @param b  the second child ordered iterator
+     * specified comparator to provide ordered iteration over the two given
+     * iterators.
+     * 
+     * @param comp the comparator to use to sort, or null to use natural sort
+     * order
+     * @param a the first child ordered iterator
+     * @param b the second child ordered iterator
      * @throws NullPointerException if either iterator is null
      */
-    public CollatingIterator(final Comparator comp, final Iterator a, final Iterator b) {
-        this(comp,2);
+    public CollatingIterator(final Comparator<? super E> comp, final Iterator<? extends E> a, final Iterator<? extends E> b) {
+        this(comp, 2);
         addIterator(a);
         addIterator(b);
     }
 
     /**
      * Constructs a new <code>CollatingIterator</code> that will use the
-     * specified comparator to provide ordered iteration over the array
-     * of iterators.
-     *
-     * @param comp  the comparator to use to sort, or null to use natural sort order
-     * @param iterators  the array of iterators
+     * specified comparator to provide ordered iteration over the array of
+     * iterators.
+     * 
+     * @param comp the comparator to use to sort, or null to use natural sort
+     * order
+     * @param iterators the array of iterators
      * @throws NullPointerException if iterators array is or contains null
      */
-    public CollatingIterator(final Comparator comp, final Iterator[] iterators) {
+    public CollatingIterator(final Comparator<? super E> comp, final Iterator<? extends E>[] iterators) {
         this(comp, iterators.length);
         for (int i = 0; i < iterators.length; i++) {
             addIterator(iterators[i]);
@@ -128,20 +136,21 @@ public class CollatingIterator implements Iterator {
 
     /**
      * Constructs a new <code>CollatingIterator</code> that will use the
-     * specified comparator to provide ordered iteration over the collection
-     * of iterators.
-     *
-     * @param comp  the comparator to use to sort, or null to use natural sort order
-     * @param iterators  the collection of iterators
-     * @throws NullPointerException if the iterators collection is or contains null
+     * specified comparator to provide ordered iteration over the collection of
+     * iterators.
+     * 
+     * @param comp the comparator to use to sort, or null to use natural sort
+     * order
+     * @param iterators the collection of iterators
+     * @throws NullPointerException if the iterators collection is or contains
+     * null
      * @throws ClassCastException if the iterators collection contains an
-     *         element that's not an {@link Iterator}
+     * element that's not an {@link Iterator}
      */
-    public CollatingIterator(final Comparator comp, final Collection iterators) {
+    public CollatingIterator(final Comparator<? super E> comp, final Collection<Iterator<? extends E>> iterators) {
         this(comp, iterators.size());
-        for (Iterator it = iterators.iterator(); it.hasNext();) {
-            Iterator item = (Iterator) it.next();
-            addIterator(item);
+        for (Iterator<? extends E> iterator : iterators) {
+            addIterator(iterator);
         }
     }
 
@@ -150,11 +159,11 @@ public class CollatingIterator implements Iterator {
     /**
      * Adds the given {@link Iterator} to the iterators being collated.
      * 
-     * @param iterator  the iterator to add to the collation, must not be null
+     * @param iterator the iterator to add to the collation, must not be null
      * @throws IllegalStateException if iteration has started
      * @throws NullPointerException if the iterator is null
      */
-    public void addIterator(final Iterator iterator) {
+    public void addIterator(final Iterator<? extends E> iterator) {
         checkNotStarted();
         if (iterator == null) {
             throw new NullPointerException("Iterator must not be null");
@@ -165,13 +174,13 @@ public class CollatingIterator implements Iterator {
     /**
      * Sets the iterator at the given index.
      * 
-     * @param index  index of the Iterator to replace
-     * @param iterator  Iterator to place at the given index
+     * @param index index of the Iterator to replace
+     * @param iterator Iterator to place at the given index
      * @throws IndexOutOfBoundsException if index &lt; 0 or index &gt; size()
      * @throws IllegalStateException if iteration has started
      * @throws NullPointerException if the iterator is null
      */
-    public void setIterator(final int index, final Iterator iterator) {
+    public void setIterator(final int index, final Iterator<? extends E> iterator) {
         checkNotStarted();
         if (iterator == null) {
             throw new NullPointerException("Iterator must not be null");
@@ -184,14 +193,14 @@ public class CollatingIterator implements Iterator {
      * 
      * @return the unmodifiable list of iterators added
      */
-    public List getIterators() {
+    public List<Iterator<? extends E>> getIterators() {
         return UnmodifiableList.decorate(iterators);
     }
 
     /**
      * Gets the {@link Comparator} by which collatation occurs.
      */
-    public Comparator getComparator() {
+    public Comparator<? super E> getComparator() {
         return comparator;
     }
 
@@ -200,7 +209,7 @@ public class CollatingIterator implements Iterator {
      * 
      * @throws IllegalStateException if iteration has started
      */
-    public void setComparator(final Comparator comp) {
+    public void setComparator(final Comparator<? super E> comp) {
         checkNotStarted();
         comparator = comp;
     }
@@ -209,7 +218,7 @@ public class CollatingIterator implements Iterator {
     // -------------------------------------------------------------------
     /**
      * Returns <code>true</code> if any child iterator has remaining elements.
-     *
+     * 
      * @return true if this iterator has remaining elements
      */
     public boolean hasNext() {
@@ -219,48 +228,46 @@ public class CollatingIterator implements Iterator {
 
     /**
      * Returns the next ordered element from a child iterator.
-     *
+     * 
      * @return the next ordered element
      * @throws NoSuchElementException if no child iterator has any more elements
      */
-    public Object next() throws NoSuchElementException {
+    public E next() throws NoSuchElementException {
         if (hasNext() == false) {
             throw new NoSuchElementException();
         }
         int leastIndex = least();
         if (leastIndex == -1) {
             throw new NoSuchElementException();
-        } else {
-            Object val = values.get(leastIndex);
-            clear(leastIndex);
-            lastReturned = leastIndex;
-            return val;
         }
+        E val = values.get(leastIndex);
+        clear(leastIndex);
+        lastReturned = leastIndex;
+        return val;
     }
 
     /**
-     * Removes the last returned element from the child iterator that 
-     * produced it.
-     *
-     * @throws IllegalStateException if there is no last returned element,
-     *  or if the last returned element has already been removed
+     * Removes the last returned element from the child iterator that produced
+     * it.
+     * 
+     * @throws IllegalStateException if there is no last returned element, or if
+     * the last returned element has already been removed
      */
     public void remove() {
         if (lastReturned == -1) {
             throw new IllegalStateException("No value can be removed at present");
         }
-        Iterator it = (Iterator) (iterators.get(lastReturned));
-        it.remove();
+        iterators.get(lastReturned).remove();
     }
 
     // Private Methods
     // -------------------------------------------------------------------
-    /** 
+    /**
      * Initializes the collating state if it hasn't been already.
      */
     private void start() {
         if (values == null) {
-            values = new ArrayList(iterators.size());
+            values = new ArrayList<E>(iterators.size());
             valueSet = new BitSet(iterators.size());
             for (int i = 0; i < iterators.size(); i++) {
                 values.add(null);
@@ -269,40 +276,38 @@ public class CollatingIterator implements Iterator {
         }
     }
 
-    /** 
-     * Sets the {@link #values} and {@link #valueSet} attributes 
-     * at position <i>i</i> to the next value of the 
-     * {@link #iterators iterator} at position <i>i</i>, or 
-     * clear them if the <i>i</i><sup>th</sup> iterator
-     * has no next value.
-     *
+    /**
+     * Sets the {@link #values} and {@link #valueSet} attributes at position
+     * <i>i</i> to the next value of the {@link #iterators iterator} at position
+     * <i>i</i>, or clear them if the <i>i</i><sup>th</sup> iterator has no next
+     * value.
+     * 
      * @return <tt>false</tt> iff there was no value to set
      */
     private boolean set(int i) {
-        Iterator it = (Iterator)(iterators.get(i));
+        Iterator<? extends E> it = iterators.get(i);
         if (it.hasNext()) {
             values.set(i, it.next());
             valueSet.set(i);
             return true;
-        } else {
-            values.set(i,null);
-            valueSet.clear(i);
-            return false;
         }
+        values.set(i, null);
+        valueSet.clear(i);
+        return false;
     }
 
-    /** 
-     * Clears the {@link #values} and {@link #valueSet} attributes 
-     * at position <i>i</i>.
+    /**
+     * Clears the {@link #values} and {@link #valueSet} attributes at position
+     * <i>i</i>.
      */
     private void clear(int i) {
-        values.set(i,null);
+        values.set(i, null);
         valueSet.clear(i);
     }
 
-    /** 
-     * Throws {@link IllegalStateException} if iteration has started 
-     * via {@link #start}.
+    /**
+     * Throws {@link IllegalStateException} if iteration has started via
+     * {@link #start}.
      * 
      * @throws IllegalStateException if iteration started
      */
@@ -312,7 +317,7 @@ public class CollatingIterator implements Iterator {
         }
     }
 
-    /** 
+    /**
      * Returns the index of the least element in {@link #values},
      * {@link #set(int) setting} any uninitialized values.
      * 
@@ -320,7 +325,7 @@ public class CollatingIterator implements Iterator {
      */
     private int least() {
         int leastIndex = -1;
-        Object leastObject = null;                
+        E leastObject = null;
         for (int i = 0; i < values.size(); i++) {
             if (valueSet.get(i) == false) {
                 set(i);
@@ -330,8 +335,8 @@ public class CollatingIterator implements Iterator {
                     leastIndex = i;
                     leastObject = values.get(i);
                 } else {
-                    Object curObject = values.get(i);
-                    if (comparator.compare(curObject,leastObject) < 0) {
+                    E curObject = values.get(i);
+                    if (comparator.compare(curObject, leastObject) < 0) {
                         leastObject = curObject;
                         leastIndex = i;
                     }
@@ -342,7 +347,7 @@ public class CollatingIterator implements Iterator {
     }
 
     /**
-     * Returns <code>true</code> iff any bit in the given set is 
+     * Returns <code>true</code> iff any bit in the given set is
      * <code>true</code>.
      */
     private boolean anyValueSet(BitSet set) {
@@ -355,13 +360,12 @@ public class CollatingIterator implements Iterator {
     }
 
     /**
-     * Returns <code>true</code> iff any {@link Iterator} 
-     * in the given list has a next value.
+     * Returns <code>true</code> iff any {@link Iterator} in the given list has
+     * a next value.
      */
-    private boolean anyHasNext(ArrayList iters) {
-        for (int i = 0; i < iters.size(); i++) {
-            Iterator it = (Iterator) iters.get(i);
-            if (it.hasNext()) {
+    private boolean anyHasNext(ArrayList<Iterator<? extends E>> iters) {
+        for (Iterator<? extends E> iterator : iters) {
+            if (iterator.hasNext()) {
                 return true;
             }
         }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/EmptyIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/EmptyIterator.java b/src/java/org/apache/commons/collections/iterators/EmptyIterator.java
index e82bc17..09614bd 100644
--- a/src/java/org/apache/commons/collections/iterators/EmptyIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/EmptyIterator.java
@@ -32,18 +32,39 @@ import org.apache.commons.collections.ResettableIterator;
  * 
  * @author Stephen Colebourne
  */
-public class EmptyIterator extends AbstractEmptyIterator implements ResettableIterator {
+public class EmptyIterator<E> extends AbstractEmptyIterator<E> implements ResettableIterator<E> {
 
     /**
      * Singleton instance of the iterator.
      * @since Commons Collections 3.1
      */
-    public static final ResettableIterator RESETTABLE_INSTANCE = new EmptyIterator();
+    public static final ResettableIterator<Object> RESETTABLE_INSTANCE = new EmptyIterator<Object>();
+
     /**
      * Singleton instance of the iterator.
      * @since Commons Collections 2.1.1 and 3.1
      */
-    public static final Iterator INSTANCE = RESETTABLE_INSTANCE;
+    public static final Iterator<Object> INSTANCE = RESETTABLE_INSTANCE;
+
+    /**
+     * Get a typed resettable empty iterator instance.
+     * @param <E>
+     * @return ResettableIterator<E>
+     */
+    @SuppressWarnings("unchecked")
+    public static <E> ResettableIterator<E> getResettableInstance() {
+        return (ResettableIterator<E>) RESETTABLE_INSTANCE;
+    }
+
+    /**
+     * Get a typed empty iterator instance.
+     * @param <E>
+     * @return Iterator<E>
+     */
+    @SuppressWarnings("unchecked")
+    public static <E> Iterator<E> getInstance() {
+        return (Iterator<E>) INSTANCE;
+    }
 
     /**
      * Constructor.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/EmptyListIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/EmptyListIterator.java b/src/java/org/apache/commons/collections/iterators/EmptyListIterator.java
index bb2e23a..4d702cb 100644
--- a/src/java/org/apache/commons/collections/iterators/EmptyListIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/EmptyListIterator.java
@@ -20,30 +20,53 @@ import java.util.ListIterator;
 
 import org.apache.commons.collections.ResettableListIterator;
 
-/** 
+/**
  * Provides an implementation of an empty list iterator.
  * <p>
- * This class provides an implementation of an empty list iterator.
- * This class provides for binary compatability between Commons Collections
- * 2.1.1 and 3.1 due to issues with <code>IteratorUtils</code>.
- *
+ * This class provides an implementation of an empty list iterator. This class
+ * provides for binary compatability between Commons Collections 2.1.1 and 3.1
+ * due to issues with <code>IteratorUtils</code>.
+ * 
  * @since Commons Collections 2.1.1 and 3.1
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2006-10-27 19:52:37 -0500 (Fri, 27 Oct
+ * 2006) $
  * 
  * @author Stephen Colebourne
  */
-public class EmptyListIterator extends AbstractEmptyIterator implements ResettableListIterator {
+public class EmptyListIterator<E> extends AbstractEmptyIterator<E> implements
+        ResettableListIterator<E> {
 
     /**
      * Singleton instance of the iterator.
      * @since Commons Collections 3.1
      */
-    public static final ResettableListIterator RESETTABLE_INSTANCE = new EmptyListIterator();
+    public static final ResettableListIterator<Object> RESETTABLE_INSTANCE = new EmptyListIterator<Object>();
+
     /**
      * Singleton instance of the iterator.
      * @since Commons Collections 2.1.1 and 3.1
      */
-    public static final ListIterator INSTANCE = RESETTABLE_INSTANCE;
+    public static final ListIterator<Object> INSTANCE = RESETTABLE_INSTANCE;
+
+    /**
+     * Get a typed instance of the iterator.
+     * @param <E>
+     * @return {@link ResettableListIterator}<E>
+     */
+    @SuppressWarnings("unchecked")
+    public static <E> ResettableListIterator<E> getResettableInstance() {
+        return (ResettableListIterator<E>) RESETTABLE_INSTANCE;
+    }
+
+    /**
+     * Get a typed instance of the iterator.
+     * @param <E>
+     * @return {@link ListIterator}<E>
+     */
+    @SuppressWarnings("unchecked")
+    public static <E> ListIterator<E> getInstance() {
+        return (ListIterator<E>) INSTANCE;
+    }
 
     /**
      * Constructor.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/EmptyMapIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/EmptyMapIterator.java b/src/java/org/apache/commons/collections/iterators/EmptyMapIterator.java
index c0d0a46..e8d5c39 100644
--- a/src/java/org/apache/commons/collections/iterators/EmptyMapIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/EmptyMapIterator.java
@@ -27,13 +27,25 @@ import org.apache.commons.collections.ResettableIterator;
  * 
  * @author Stephen Colebourne
  */
-public class EmptyMapIterator extends AbstractEmptyIterator implements MapIterator, ResettableIterator {
+public class EmptyMapIterator<K, V> extends AbstractEmptyMapIterator<K, V> implements
+        MapIterator<K, V>, ResettableIterator<K> {
 
     /**
      * Singleton instance of the iterator.
      * @since Commons Collections 3.1
      */
-    public static final MapIterator INSTANCE = new EmptyMapIterator();
+    public static final MapIterator<Object, Object> INSTANCE = new EmptyMapIterator<Object, Object>();
+
+    /**
+     * Get a typed instance of the iterator.
+     * @param <K>
+     * @param <V>
+     * @return {@link MapIterator}<K, V>
+     */
+    @SuppressWarnings("unchecked")
+    public static <K, V> MapIterator<K, V> getInstance() {
+        return (MapIterator<K, V>) INSTANCE;
+    }
 
     /**
      * Constructor.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/EmptyOrderedIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/EmptyOrderedIterator.java b/src/java/org/apache/commons/collections/iterators/EmptyOrderedIterator.java
index 2b7ca88..c90d816 100644
--- a/src/java/org/apache/commons/collections/iterators/EmptyOrderedIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/EmptyOrderedIterator.java
@@ -27,13 +27,23 @@ import org.apache.commons.collections.ResettableIterator;
  * 
  * @author Stephen Colebourne
  */
-public class EmptyOrderedIterator extends AbstractEmptyIterator implements OrderedIterator, ResettableIterator {
+public class EmptyOrderedIterator<E> extends AbstractEmptyIterator<E> implements OrderedIterator<E>, ResettableIterator<E> {
 
     /**
      * Singleton instance of the iterator.
      * @since Commons Collections 3.1
      */
-    public static final OrderedIterator INSTANCE = new EmptyOrderedIterator();
+    public static final OrderedIterator<Object> INSTANCE = new EmptyOrderedIterator<Object>();
+
+    /**
+     * Typed instance of the iterator.
+     * @param <E>
+     * @return OrderedIterator<E>
+     */
+    @SuppressWarnings("unchecked")
+    public static <E> OrderedIterator<E> getInstance() {
+        return (OrderedIterator<E>) INSTANCE;
+    }
 
     /**
      * Constructor.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/EmptyOrderedMapIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/EmptyOrderedMapIterator.java b/src/java/org/apache/commons/collections/iterators/EmptyOrderedMapIterator.java
index af7523b..219982b 100644
--- a/src/java/org/apache/commons/collections/iterators/EmptyOrderedMapIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/EmptyOrderedMapIterator.java
@@ -27,13 +27,25 @@ import org.apache.commons.collections.ResettableIterator;
  * 
  * @author Stephen Colebourne
  */
-public class EmptyOrderedMapIterator extends AbstractEmptyIterator implements OrderedMapIterator, ResettableIterator {
+public class EmptyOrderedMapIterator<K, V> extends AbstractEmptyMapIterator<K, V> implements
+        OrderedMapIterator<K, V>, ResettableIterator<K> {
 
     /**
      * Singleton instance of the iterator.
      * @since Commons Collections 3.1
      */
-    public static final OrderedMapIterator INSTANCE = new EmptyOrderedMapIterator();
+    public static final OrderedMapIterator<Object, Object> INSTANCE = new EmptyOrderedMapIterator<Object, Object>();
+
+    /**
+     * Get a typed instance of the iterator.
+     * @param <K>
+     * @param <V>
+     * @return {@link OrderedMapIterator}<K, V>
+     */
+    @SuppressWarnings("unchecked")
+    public static <K, V> OrderedMapIterator<K, V> getInstance() {
+        return (OrderedMapIterator<K, V>) INSTANCE;
+    }
 
     /**
      * Constructor.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java b/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java
index 56c9fa0..1d73050 100644
--- a/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java
@@ -39,11 +39,11 @@ import org.apache.commons.collections.ResettableIterator;
  *
  * @author Stephen Colebourne
  */
-public class EntrySetMapIterator implements MapIterator, ResettableIterator {
+public class EntrySetMapIterator<K, V> implements MapIterator<K, V>, ResettableIterator<K> {
     
-    private final Map map;
-    private Iterator iterator;
-    private Map.Entry last;
+    private final Map<K, V> map;
+    private Iterator<Map.Entry<K, V>> iterator;
+    private Map.Entry<K, V> last;
     private boolean canRemove = false;
     
     /**
@@ -51,7 +51,7 @@ public class EntrySetMapIterator implements MapIterator, ResettableIterator {
      * 
      * @param map  the map to iterate over
      */
-    public EntrySetMapIterator(Map map) {
+    public EntrySetMapIterator(Map<K, V> map) {
         super();
         this.map = map;
         this.iterator = map.entrySet().iterator();
@@ -73,8 +73,8 @@ public class EntrySetMapIterator implements MapIterator, ResettableIterator {
      * @return the next key in the iteration
      * @throws java.util.NoSuchElementException if the iteration is finished
      */
-    public Object next() {
-        last = (Map.Entry) iterator.next();
+    public K next() {
+        last = (Map.Entry<K, V>) iterator.next();
         canRemove = true;
         return last.getKey();
     }
@@ -107,7 +107,7 @@ public class EntrySetMapIterator implements MapIterator, ResettableIterator {
      * @return the current key
      * @throws IllegalStateException if <code>next()</code> has not yet been called
      */
-    public Object getKey() {
+    public K getKey() {
         if (last == null) {
             throw new IllegalStateException("Iterator getKey() can only be called after next() and before remove()");
         }
@@ -121,7 +121,7 @@ public class EntrySetMapIterator implements MapIterator, ResettableIterator {
      * @return the current value
      * @throws IllegalStateException if <code>next()</code> has not yet been called
      */
-    public Object getValue() {
+    public V getValue() {
         if (last == null) {
             throw new IllegalStateException("Iterator getValue() can only be called after next() and before remove()");
         }
@@ -138,7 +138,7 @@ public class EntrySetMapIterator implements MapIterator, ResettableIterator {
      * @throws IllegalStateException if <code>remove()</code> has been called since the
      *  last call to <code>next()</code>
      */
-    public Object setValue(Object value) {
+    public V setValue(V value) {
         if (last == null) {
             throw new IllegalStateException("Iterator setValue() can only be called after next() and before remove()");
         }
@@ -163,9 +163,8 @@ public class EntrySetMapIterator implements MapIterator, ResettableIterator {
     public String toString() {
         if (last != null) {
             return "MapIterator[" + getKey() + "=" + getValue() + "]";
-        } else {
-            return "MapIterator[]";
         }
+        return "MapIterator[]";
     }
     
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/EnumerationIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/EnumerationIterator.java b/src/java/org/apache/commons/collections/iterators/EnumerationIterator.java
index a3e6631..4fef2ae 100644
--- a/src/java/org/apache/commons/collections/iterators/EnumerationIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/EnumerationIterator.java
@@ -30,14 +30,14 @@ import java.util.Iterator;
  * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
  * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
  */
-public class EnumerationIterator implements Iterator {
+public class EnumerationIterator<E> implements Iterator<E> {
     
     /** The collection to remove elements from */
-    private Collection collection;
+    private Collection<? super E> collection;
     /** The enumeration being converted */
-    private Enumeration enumeration;
+    private Enumeration<? extends E> enumeration;
     /** The last object retrieved */
-    private Object last;
+    private E last;
     
     // Constructors
     //-----------------------------------------------------------------------
@@ -55,7 +55,7 @@ public class EnumerationIterator implements Iterator {
      *
      * @param enumeration  the enumeration to use
      */
-    public EnumerationIterator(final Enumeration enumeration) {
+    public EnumerationIterator(final Enumeration<? extends E> enumeration) {
         this(enumeration, null);
     }
 
@@ -64,9 +64,9 @@ public class EnumerationIterator implements Iterator {
      * elements from the specified collection.
      *
      * @param enumeration  the enumeration to use
-     * @param collection  the collection to remove elements form
+     * @param collection  the collection to remove elements from
      */
-    public EnumerationIterator(final Enumeration enumeration, final Collection collection) {
+    public EnumerationIterator(final Enumeration<? extends E> enumeration, final Collection<? super E> collection) {
         super();
         this.enumeration = enumeration;
         this.collection = collection;
@@ -91,7 +91,7 @@ public class EnumerationIterator implements Iterator {
      * @return the next object from the enumeration
      * @throws NullPointerException if the enumeration is null
      */
-    public Object next() {
+    public E next() {
         last = enumeration.nextElement();
         return last;
     }
@@ -125,7 +125,7 @@ public class EnumerationIterator implements Iterator {
      *
      * @return the underlying enumeration
      */
-    public Enumeration getEnumeration() {
+    public Enumeration<? extends E> getEnumeration() {
         return enumeration;
     }
 
@@ -134,7 +134,7 @@ public class EnumerationIterator implements Iterator {
      *
      * @param enumeration  the new underlying enumeration
      */
-    public void setEnumeration(final Enumeration enumeration) {
+    public void setEnumeration(final Enumeration<? extends E> enumeration) {
         this.enumeration = enumeration;
     }
     

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/FilterIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/FilterIterator.java b/src/java/org/apache/commons/collections/iterators/FilterIterator.java
index e14959d..6d8c8ca 100644
--- a/src/java/org/apache/commons/collections/iterators/FilterIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/FilterIterator.java
@@ -35,14 +35,14 @@ import org.apache.commons.collections.Predicate;
  * @author Ralph Wagner
  * @author Stephen Colebourne
  */
-public class FilterIterator implements Iterator {
+public class FilterIterator<E> implements Iterator<E> {
 
     /** The iterator being used */
-    private Iterator iterator;
+    private Iterator<? extends E> iterator;
     /** The predicate being used */
-    private Predicate predicate;
+    private Predicate<? super E> predicate;
     /** The next object in the iteration */
-    private Object nextObject;
+    private E nextObject;
     /** Whether the next object has been calculated yet */
     private boolean nextObjectSet = false;
 
@@ -61,7 +61,7 @@ public class FilterIterator implements Iterator {
      *
      * @param iterator  the iterator to use
      */
-    public FilterIterator(Iterator iterator) {
+    public FilterIterator(Iterator<? extends E> iterator) {
         super();
         this.iterator = iterator;
     }
@@ -73,7 +73,7 @@ public class FilterIterator implements Iterator {
      * @param iterator  the iterator to use
      * @param predicate  the predicate to use
      */
-    public FilterIterator(Iterator iterator, Predicate predicate) {
+    public FilterIterator(Iterator<? extends E> iterator, Predicate<? super E> predicate) {
         super();
         this.iterator = iterator;
         this.predicate = predicate;
@@ -88,11 +88,7 @@ public class FilterIterator implements Iterator {
      * @throws NullPointerException if either the iterator or predicate are null
      */
     public boolean hasNext() {
-        if (nextObjectSet) {
-            return true;
-        } else {
-            return setNextObject();
-        }
+        return nextObjectSet || setNextObject();
     }
 
     /** 
@@ -103,7 +99,7 @@ public class FilterIterator implements Iterator {
      * @throws NoSuchElementException if there are no more elements that
      *  match the predicate 
      */
-    public Object next() {
+    public E next() {
         if (!nextObjectSet) {
             if (!setNextObject()) {
                 throw new NoSuchElementException();
@@ -137,7 +133,7 @@ public class FilterIterator implements Iterator {
      *
      * @return the iterator
      */
-    public Iterator getIterator() {
+    public Iterator<? extends E> getIterator() {
         return iterator;
     }
 
@@ -147,7 +143,7 @@ public class FilterIterator implements Iterator {
      *
      * @param iterator  the iterator to use
      */
-    public void setIterator(Iterator iterator) {
+    public void setIterator(Iterator<? extends E> iterator) {
         this.iterator = iterator;
         nextObject = null;
         nextObjectSet = false;
@@ -159,7 +155,7 @@ public class FilterIterator implements Iterator {
      *
      * @return the predicate
      */
-    public Predicate getPredicate() {
+    public Predicate<? super E> getPredicate() {
         return predicate;
     }
 
@@ -168,7 +164,7 @@ public class FilterIterator implements Iterator {
      *
      * @param predicate  the predicate to use
      */
-    public void setPredicate(Predicate predicate) {
+    public void setPredicate(Predicate<? super E> predicate) {
         this.predicate = predicate;
         nextObject = null;
         nextObjectSet = false;
@@ -181,7 +177,7 @@ public class FilterIterator implements Iterator {
      */
     private boolean setNextObject() {
         while (iterator.hasNext()) {
-            Object object = iterator.next();
+            E object = iterator.next();
             if (predicate.evaluate(object)) {
                 nextObject = object;
                 nextObjectSet = true;

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/FilterListIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/FilterListIterator.java b/src/java/org/apache/commons/collections/iterators/FilterListIterator.java
index 8a64ef5..36321fa 100644
--- a/src/java/org/apache/commons/collections/iterators/FilterListIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/FilterListIterator.java
@@ -32,19 +32,19 @@ import org.apache.commons.collections.Predicate;
  * 
  * @author Rodney Waldhoff
  */
-public class FilterListIterator implements ListIterator {
+public class FilterListIterator<E> implements ListIterator<E> {
 
     /** The iterator being used */
-    private ListIterator iterator;
+    private ListIterator<? extends E> iterator;
     
     /** The predicate being used */
-    private Predicate predicate;
+    private Predicate<? super E> predicate;
 
     /** 
      * The value of the next (matching) object, when 
      * {@link #nextObjectSet} is true. 
      */
-    private Object nextObject;
+    private E nextObject;
 
     /** 
      * Whether or not the {@link #nextObject} has been set
@@ -56,7 +56,7 @@ public class FilterListIterator implements ListIterator {
      * The value of the previous (matching) object, when 
      * {@link #previousObjectSet} is true. 
      */
-    private Object previousObject;
+    private E previousObject;
 
     /** 
      * Whether or not the {@link #previousObject} has been set
@@ -85,7 +85,7 @@ public class FilterListIterator implements ListIterator {
      *
      * @param iterator  the iterator to use
      */
-    public FilterListIterator(ListIterator iterator ) {
+    public FilterListIterator(ListIterator<? extends E> iterator ) {
         super();
         this.iterator = iterator;
     }
@@ -96,7 +96,7 @@ public class FilterListIterator implements ListIterator {
      * @param iterator  the iterator to use
      * @param predicate  the predicate to use
      */
-    public FilterListIterator(ListIterator iterator, Predicate predicate) {
+    public FilterListIterator(ListIterator<? extends E> iterator, Predicate<? super E> predicate) {
         super();
         this.iterator = iterator;
         this.predicate = predicate;
@@ -108,41 +108,33 @@ public class FilterListIterator implements ListIterator {
      *
      * @param predicate  the predicate to use.
      */
-    public FilterListIterator(Predicate predicate) {
+    public FilterListIterator(Predicate<? super E> predicate) {
         super();
         this.predicate = predicate;
     }
 
     //-----------------------------------------------------------------------
     /** Not supported. */
-    public void add(Object o) {
+    public void add(E o) {
         throw new UnsupportedOperationException("FilterListIterator.add(Object) is not supported.");
     }
 
     public boolean hasNext() {
-        if(nextObjectSet) {
-            return true;
-        } else {
-            return setNextObject();
-        }
+        return nextObjectSet || setNextObject();
     }
 
     public boolean hasPrevious() {
-        if(previousObjectSet) {
-            return true;
-        } else {
-            return setPreviousObject();
-        }
+        return previousObjectSet || setPreviousObject();
     }
 
-    public Object next() {
-        if(!nextObjectSet) {
-            if(!setNextObject()) {
+    public E next() {
+        if (!nextObjectSet) {
+            if (!setNextObject()) {
                 throw new NoSuchElementException();
             }
         }
         nextIndex++;
-        Object temp = nextObject;
+        E temp = nextObject;
         clearNextObject();
         return temp;
     }
@@ -151,14 +143,14 @@ public class FilterListIterator implements ListIterator {
         return nextIndex;
     }
 
-    public Object previous() {
-        if(!previousObjectSet) {
-            if(!setPreviousObject()) {
+    public E previous() {
+        if (!previousObjectSet) {
+            if (!setPreviousObject()) {
                 throw new NoSuchElementException();
             }
         }
         nextIndex--;
-        Object temp = previousObject;
+        E temp = previousObject;
         clearPreviousObject();
         return temp;
     }
@@ -173,7 +165,7 @@ public class FilterListIterator implements ListIterator {
     }
 
     /** Not supported. */
-    public void set(Object o) {
+    public void set(E o) {
         throw new UnsupportedOperationException("FilterListIterator.set(Object) is not supported.");
     }
 
@@ -183,7 +175,7 @@ public class FilterListIterator implements ListIterator {
      * 
      * @return the iterator.
      */
-    public ListIterator getListIterator() {
+    public ListIterator<? extends E> getListIterator() {
         return iterator;
     }
 
@@ -193,7 +185,7 @@ public class FilterListIterator implements ListIterator {
      * 
      * @param iterator  the iterator to use
      */
-    public void setListIterator(ListIterator iterator) {
+    public void setListIterator(ListIterator<? extends E> iterator) {
         this.iterator = iterator;
     }
 
@@ -203,7 +195,7 @@ public class FilterListIterator implements ListIterator {
      * 
      * @return the predicate.
      */
-    public Predicate getPredicate() {
+    public Predicate<? super E> getPredicate() {
         return predicate;
     }
 
@@ -212,7 +204,7 @@ public class FilterListIterator implements ListIterator {
      * 
      * @param predicate  the transformer to use
      */
-    public void setPredicate(Predicate predicate) {
+    public void setPredicate(Predicate<? super E> predicate) {
         this.predicate = predicate;
     }
 
@@ -227,18 +219,17 @@ public class FilterListIterator implements ListIterator {
         // then we've walked back one step in the 
         // underlying list (due to a hasPrevious() call)
         // so skip ahead one matching object
-        if(previousObjectSet) {
+        if (previousObjectSet) {
             clearPreviousObject();
-            if(!setNextObject()) {
+            if (!setNextObject()) {
                 return false;
-            } else {
-                clearNextObject();
             }
+            clearNextObject();
         }
 
-        while(iterator.hasNext()) {
-            Object object = iterator.next();
-            if(predicate.evaluate(object)) {
+        while (iterator.hasNext()) {
+            E object = iterator.next();
+            if (predicate.evaluate(object)) {
                 nextObject = object;
                 nextObjectSet = true;
                 return true;
@@ -257,18 +248,17 @@ public class FilterListIterator implements ListIterator {
         // then we've walked back one step in the 
         // underlying list (due to a hasNext() call)
         // so skip ahead one matching object
-        if(nextObjectSet) {
+        if (nextObjectSet) {
             clearNextObject();
-            if(!setPreviousObject()) {
+            if (!setPreviousObject()) {
                 return false;
-            } else {
-                clearPreviousObject();
             }
+            clearPreviousObject();
         }
 
-        while(iterator.hasPrevious()) {
-            Object object = iterator.previous();
-            if(predicate.evaluate(object)) {
+        while (iterator.hasPrevious()) {
+            E object = iterator.previous();
+            if (predicate.evaluate(object)) {
                 previousObject = object;
                 previousObjectSet = true;
                 return true;


[52/77] [abbrv] commons-collections git commit: add methods to wrap Maps and SortedMaps not based on Commons Collections classes to their Iterable*Map counterparts

Posted by ch...@apache.org.
add methods to wrap Maps and SortedMaps not based on Commons Collections classes to their Iterable*Map counterparts

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@751887 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/3338e259
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/3338e259
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/3338e259

Branch: refs/heads/collections_jdk5_branch
Commit: 3338e25927741c0a8b02225723539c5d1007e84b
Parents: b29b93a
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Mon Mar 9 22:40:01 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Mon Mar 9 22:40:01 2009 +0000

----------------------------------------------------------------------
 .../apache/commons/collections/MapUtils.java    | 40 +++++++++++++++++++-
 .../commons/collections/TestMapUtils.java       | 34 +++++++++++++++++
 2 files changed, 73 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/3338e259/src/java/org/apache/commons/collections/MapUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/MapUtils.java b/src/java/org/apache/commons/collections/MapUtils.java
index d8ed529..88a422e 100644
--- a/src/java/org/apache/commons/collections/MapUtils.java
+++ b/src/java/org/apache/commons/collections/MapUtils.java
@@ -30,6 +30,8 @@ import java.util.ResourceBundle;
 import java.util.SortedMap;
 import java.util.TreeMap;
 
+import org.apache.commons.collections.map.AbstractMapDecorator;
+import org.apache.commons.collections.map.AbstractSortedMapDecorator;
 import org.apache.commons.collections.map.FixedSizeMap;
 import org.apache.commons.collections.map.FixedSizeSortedMap;
 import org.apache.commons.collections.map.LazyMap;
@@ -1397,7 +1399,7 @@ public class MapUtils {
      * @return an ordered map backed by the given map
      * @throws IllegalArgumentException  if the Map is null
      */
-    public static <K, V> IterableMap<K, V> orderedMap(Map<K, V> map) {
+    public static <K, V> OrderedMap<K, V> orderedMap(Map<K, V> map) {
         return ListOrderedMap.decorate(map);
     }
 
@@ -1621,4 +1623,40 @@ public class MapUtils {
         return LazySortedMap.getLazySortedMap(map, transformerFactory);
     }
 
+    /**
+     * Get the specified {@link Map} as an {@link IterableMap}.
+     * @param <K>
+     * @param <V>
+     * @param map to wrap if necessary.
+     * @return IterableMap<K, V>
+     * @since Commons Collections 5
+     * @TODO fix version
+     */
+    public static <K, V> IterableMap<K, V> iterableMap(Map<K, V> map) {
+        if (map == null) {
+            throw new IllegalArgumentException("Map must not be null");
+        }
+        return map instanceof IterableMap ? (IterableMap<K, V>) map
+                : new AbstractMapDecorator<K, V>(map) {
+                };
+    }
+
+    /**
+     * Get the specified {@link SortedMap} as an {@link IterableSortedMap}.
+     * @param <K>
+     * @param <V>
+     * @param sortedMap to wrap if necessary
+     * @return {@link IterableSortedMap}<K, V>
+     * @since Commons Collections 5
+     * @TODO fix version
+     */
+    public static <K, V> IterableSortedMap<K, V> iterableSortedMap(SortedMap<K, V> sortedMap) {
+        if (sortedMap == null) {
+            throw new IllegalArgumentException("Map must not be null");
+        }
+        return sortedMap instanceof IterableSortedMap ? (IterableSortedMap<K, V>) sortedMap
+                : new AbstractSortedMapDecorator<K, V>(sortedMap) {
+                };
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/3338e259/src/test/org/apache/commons/collections/TestMapUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestMapUtils.java b/src/test/org/apache/commons/collections/TestMapUtils.java
index 2f7006c..6db8920 100644
--- a/src/test/org/apache/commons/collections/TestMapUtils.java
+++ b/src/test/org/apache/commons/collections/TestMapUtils.java
@@ -31,6 +31,7 @@ import junit.framework.Test;
 
 import org.apache.commons.collections.keyvalue.DefaultKeyValue;
 import org.apache.commons.collections.keyvalue.DefaultMapEntry;
+import org.apache.commons.collections.map.HashedMap;
 import org.apache.commons.collections.map.LazyMap;
 import org.apache.commons.collections.map.PredicatedMap;
 
@@ -737,4 +738,37 @@ public class TestMapUtils extends BulkTest {
         assertEquals(false, MapUtils.isNotEmpty(map));
     }
 
+    public void testIterableMap() {
+        try {
+            MapUtils.iterableMap(null);
+            fail("Should throw IllegalArgumentException");
+        } catch (IllegalArgumentException e) {
+        }
+        HashMap<String, String> map = new HashMap<String, String>();
+        map.put("foo", "foov");
+        map.put("bar", "barv");
+        map.put("baz", "bazv");
+        IterableMap<String, String> iMap = MapUtils.iterableMap(map);
+        assertEquals(map, iMap);
+        assertNotSame(map, iMap);
+        HashedMap<String, String> hMap = new HashedMap<String, String>(map);
+        assertSame(hMap, MapUtils.iterableMap(hMap));
+    }
+
+    public void testIterableSortedMap() {
+        try {
+            MapUtils.iterableSortedMap(null);
+            fail("Should throw IllegalArgumentException");
+        } catch (IllegalArgumentException e) {
+        }
+        TreeMap<String, String> map = new TreeMap<String, String>();
+        map.put("foo", "foov");
+        map.put("bar", "barv");
+        map.put("baz", "bazv");
+        IterableSortedMap<String, String> iMap = MapUtils.iterableSortedMap(map);
+        assertEquals(map, iMap);
+        assertNotSame(map, iMap);
+        assertSame(iMap, MapUtils.iterableMap(iMap));
+    }
+
 }


[34/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
finish generics (minus one class)

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@738956 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/884baf0d
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/884baf0d
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/884baf0d

Branch: refs/heads/collections_jdk5_branch
Commit: 884baf0ddc6b869d9d4340b6fc9b1ff4d018e7c2
Parents: b1311a2
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Thu Jan 29 18:48:37 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Thu Jan 29 18:48:37 2009 +0000

----------------------------------------------------------------------
 .../apache/commons/collections/ArrayStack.java  |   14 +-
 .../apache/commons/collections/BagUtils.java    |  190 ++-
 .../org/apache/commons/collections/BidiMap.java |    4 +-
 .../commons/collections/BoundedCollection.java  |    2 +-
 .../apache/commons/collections/BoundedMap.java  |    2 +-
 .../collections/BufferOverflowException.java    |    3 +
 .../collections/BufferUnderflowException.java   |    3 +
 .../apache/commons/collections/BufferUtils.java |   27 +-
 .../commons/collections/ClosureUtils.java       |   73 +-
 .../commons/collections/CollectionUtils.java    |   96 +-
 .../commons/collections/ComparatorUtils.java    |   48 +-
 .../commons/collections/EnumerationUtils.java   |   19 +-
 .../commons/collections/FactoryUtils.java       |   14 +-
 .../commons/collections/FunctorException.java   |    7 +-
 .../commons/collections/IteratorUtils.java      |  239 +--
 .../apache/commons/collections/ListUtils.java   |   49 +-
 .../apache/commons/collections/MapUtils.java    |  290 ++--
 .../apache/commons/collections/MultiMap.java    |   12 +-
 .../commons/collections/OrderedBidiMap.java     |   16 +-
 .../apache/commons/collections/OrderedMap.java  |    2 +-
 .../commons/collections/PredicateUtils.java     |  221 ++-
 .../apache/commons/collections/SetUtils.java    |   35 +-
 .../commons/collections/SortedBidiMap.java      |   21 +-
 .../commons/collections/TransformerUtils.java   |  102 +-
 .../collections/bag/AbstractBagDecorator.java   |    3 +
 .../commons/collections/bag/AbstractMapBag.java |  275 ++--
 .../bag/AbstractSortedBagDecorator.java         |    3 +
 .../apache/commons/collections/bag/HashBag.java |   10 +-
 .../collections/bag/SynchronizedBag.java        |    3 +
 .../collections/bag/SynchronizedSortedBag.java  |    4 +-
 .../commons/collections/bag/TransformedBag.java |   25 +-
 .../collections/bag/TransformedSortedBag.java   |   20 +-
 .../apache/commons/collections/bag/TreeBag.java |   60 +-
 .../collections/bag/UnmodifiableBag.java        |   33 +-
 .../collections/bag/UnmodifiableSortedBag.java  |    7 +-
 .../bidimap/AbstractBidiMapDecorator.java       |   29 +-
 .../bidimap/AbstractDualBidiMap.java            |  434 ++---
 .../AbstractOrderedBidiMapDecorator.java        |   39 +-
 .../bidimap/AbstractSortedBidiMapDecorator.java |   38 +-
 .../collections/bidimap/DualHashBidiMap.java    |   22 +-
 .../collections/bidimap/DualTreeBidiMap.java    |  248 +--
 .../collections/bidimap/TreeBidiMap.java        | 1485 +++++++++---------
 .../bidimap/UnmodifiableBidiMap.java            |   54 +-
 .../bidimap/UnmodifiableOrderedBidiMap.java     |   62 +-
 .../bidimap/UnmodifiableSortedBidiMap.java      |   79 +-
 .../buffer/AbstractBufferDecorator.java         |    8 +-
 .../collections/buffer/BoundedBuffer.java       |   26 +-
 .../collections/buffer/BoundedFifoBuffer.java   |   72 +-
 .../collections/buffer/CircularFifoBuffer.java  |   24 +-
 .../collections/buffer/PriorityBuffer.java      |   71 +-
 .../collections/buffer/TransformedBuffer.java   |   16 +-
 .../collections/buffer/UnboundedFifoBuffer.java |   49 +-
 .../collections/buffer/UnmodifiableBuffer.java  |   23 +-
 .../AbstractUntypedCollectionDecorator.java     |  125 ++
 .../collection/CompositeCollection.java         |   55 +-
 .../collection/TransformedCollection.java       |   22 +-
 .../UnmodifiableBoundedCollection.java          |   76 +-
 .../comparators/BooleanComparator.java          |   18 +-
 .../comparators/ComparableComparator.java       |   14 +-
 .../comparators/ComparatorChain.java            |  124 +-
 .../comparators/FixedOrderComparator.java       |  149 +-
 .../collections/comparators/NullComparator.java |   22 +-
 .../comparators/ReverseComparator.java          |   30 +-
 .../comparators/TransformingComparator.java     |   20 +-
 .../collections/functors/AllPredicate.java      |    8 +-
 .../collections/functors/AndPredicate.java      |   35 +-
 .../collections/functors/AnyPredicate.java      |   44 +-
 .../collections/functors/ChainedClosure.java    |   39 +-
 .../functors/ChainedTransformer.java            |   37 +-
 .../collections/functors/CloneTransformer.java  |   11 +-
 .../functors/ClosureTransformer.java            |   14 +-
 .../collections/functors/ConstantFactory.java   |   19 +-
 .../functors/ConstantTransformer.java           |   55 +-
 .../collections/functors/EqualPredicate.java    |    2 +-
 .../collections/functors/ExceptionClosure.java  |   12 +-
 .../collections/functors/ExceptionFactory.java  |   12 +-
 .../functors/ExceptionPredicate.java            |   25 +-
 .../functors/ExceptionTransformer.java          |   22 +-
 .../functors/FactoryTransformer.java            |   14 +-
 .../collections/functors/FalsePredicate.java    |   36 +-
 .../collections/functors/ForClosure.java        |   19 +-
 .../collections/functors/FunctorUtils.java      |   96 +-
 .../collections/functors/IdentityPredicate.java |   33 +-
 .../commons/collections/functors/IfClosure.java |   30 +-
 .../functors/InstanceofPredicate.java           |   26 +-
 .../functors/InstantiateFactory.java            |    7 +-
 .../functors/InstantiateTransformer.java        |   47 +-
 .../functors/InvokerTransformer.java            |   24 +-
 .../collections/functors/MapTransformer.java    |   32 +-
 .../collections/functors/NOPClosure.java        |   26 +-
 .../collections/functors/NOPTransformer.java    |   11 +-
 .../collections/functors/NonePredicate.java     |   38 +-
 .../collections/functors/NotNullPredicate.java  |   11 +-
 .../collections/functors/NotPredicate.java      |   15 +-
 .../functors/NullIsExceptionPredicate.java      |   17 +-
 .../functors/NullIsFalsePredicate.java          |   35 +-
 .../functors/NullIsTruePredicate.java           |   17 +-
 .../collections/functors/OnePredicate.java      |   25 +-
 .../collections/functors/OrPredicate.java       |   35 +-
 .../functors/PredicateTransformer.java          |   18 +-
 .../collections/functors/PrototypeFactory.java  |   40 +-
 .../functors/StringValueTransformer.java        |   11 +-
 .../collections/functors/SwitchClosure.java     |   88 +-
 .../collections/functors/SwitchTransformer.java |   58 +-
 .../functors/TransformedPredicate.java          |   42 +-
 .../functors/TransformerClosure.java            |   16 +-
 .../functors/TransformerPredicate.java          |   41 +-
 .../collections/functors/UniquePredicate.java   |   24 +-
 .../collections/functors/WhileClosure.java      |   18 +-
 .../iterators/AbstractEmptyIterator.java        |   22 +-
 .../iterators/AbstractEmptyMapIterator.java     |   50 +
 .../iterators/AbstractIteratorDecorator.java    |   37 +-
 .../iterators/AbstractMapIteratorDecorator.java |   16 +-
 .../AbstractOrderedMapIteratorDecorator.java    |   18 +-
 .../AbstractUntypedIteratorDecorator.java       |   54 +
 .../collections/iterators/ArrayIterator.java    |    7 +-
 .../iterators/ArrayListIterator.java            |   14 +-
 .../iterators/CollatingIterator.java            |  230 +--
 .../collections/iterators/EmptyIterator.java    |   27 +-
 .../iterators/EmptyListIterator.java            |   41 +-
 .../collections/iterators/EmptyMapIterator.java |   16 +-
 .../iterators/EmptyOrderedIterator.java         |   14 +-
 .../iterators/EmptyOrderedMapIterator.java      |   16 +-
 .../iterators/EntrySetMapIterator.java          |   23 +-
 .../iterators/EnumerationIterator.java          |   20 +-
 .../collections/iterators/FilterIterator.java   |   30 +-
 .../iterators/FilterListIterator.java           |   82 +-
 .../collections/iterators/IteratorChain.java    |  196 +--
 .../iterators/IteratorEnumeration.java          |   66 +-
 .../iterators/ListIteratorWrapper.java          |   18 +-
 .../collections/iterators/LoopingIterator.java  |   10 +-
 .../iterators/LoopingListIterator.java          |   27 +-
 .../iterators/ObjectArrayIterator.java          |   18 +-
 .../iterators/ObjectArrayListIterator.java      |   18 +-
 .../iterators/ObjectGraphIterator.java          |   38 +-
 .../iterators/ReverseListIterator.java          |   20 +-
 .../iterators/SingletonIterator.java            |   12 +-
 .../iterators/SingletonListIterator.java        |   14 +-
 .../iterators/TransformIterator.java            |   31 +-
 .../iterators/UniqueFilterIterator.java         |   16 +-
 .../iterators/UnmodifiableIterator.java         |   14 +-
 .../iterators/UnmodifiableListIterator.java     |   18 +-
 .../iterators/UnmodifiableMapIterator.java      |   20 +-
 .../UnmodifiableOrderedMapIterator.java         |   31 +-
 .../collections/keyvalue/AbstractKeyValue.java  |   12 +-
 .../collections/keyvalue/AbstractMapEntry.java  |    9 +-
 .../keyvalue/AbstractMapEntryDecorator.java     |   14 +-
 .../collections/keyvalue/DefaultKeyValue.java   |   21 +-
 .../collections/keyvalue/DefaultMapEntry.java   |    8 +-
 .../commons/collections/keyvalue/MultiKey.java  |   60 +-
 .../collections/keyvalue/TiedMapEntry.java      |   16 +-
 .../keyvalue/UnmodifiableMapEntry.java          |   10 +-
 .../collections/list/AbstractLinkedList.java    |  331 ++--
 .../collections/list/AbstractListDecorator.java |    8 +-
 .../list/AbstractSerializableListDecorator.java |    9 +-
 .../collections/list/CursorableLinkedList.java  |   99 +-
 .../commons/collections/list/FixedSizeList.java |   46 +-
 .../commons/collections/list/GrowthList.java    |   24 +-
 .../commons/collections/list/LazyList.java      |   41 +-
 .../collections/list/NodeCachingLinkedList.java |   29 +-
 .../commons/collections/list/SetUniqueList.java |  169 +-
 .../collections/list/SynchronizedList.java      |    4 +-
 .../collections/list/TransformedList.java       |   46 +-
 .../commons/collections/list/TreeList.java      |  203 ++-
 .../collections/list/UnmodifiableList.java      |   37 +-
 .../collections/map/AbstractHashedMap.java      |  492 +++---
 .../map/AbstractInputCheckedMapDecorator.java   |   56 +-
 .../collections/map/AbstractLinkedMap.java      |  227 ++-
 .../map/AbstractOrderedMapDecorator.java        |   26 +-
 .../collections/map/AbstractReferenceMap.java   |  427 ++---
 .../map/AbstractSortedMapDecorator.java         |    5 +-
 .../collections/map/CaseInsensitiveMap.java     |   11 +-
 .../commons/collections/map/CompositeMap.java   |  145 +-
 .../commons/collections/map/DefaultedMap.java   |   52 +-
 .../commons/collections/map/FixedSizeMap.java   |   38 +-
 .../collections/map/FixedSizeSortedMap.java     |   61 +-
 .../commons/collections/map/Flat3Map.java       |  314 ++--
 .../commons/collections/map/HashedMap.java      |   28 +-
 .../commons/collections/map/IdentityMap.java    |   58 +-
 .../apache/commons/collections/map/LRUMap.java  |   80 +-
 .../apache/commons/collections/map/LazyMap.java |    4 +-
 .../commons/collections/map/LinkedMap.java      |   83 +-
 .../commons/collections/map/ListOrderedMap.java |  237 ++-
 .../commons/collections/map/MultiKeyMap.java    |  292 ++--
 .../commons/collections/map/MultiValueMap.java  |  134 +-
 .../commons/collections/map/PredicatedMap.java  |   42 +-
 .../collections/map/PredicatedSortedMap.java    |   40 +-
 .../collections/map/ReferenceIdentityMap.java   |   23 +-
 .../commons/collections/map/ReferenceMap.java   |   16 +-
 .../commons/collections/map/SingletonMap.java   |  126 +-
 .../collections/map/StaticBucketMap.java        |  127 +-
 .../commons/collections/map/TransformedMap.java |   50 +-
 .../collections/map/TransformedSortedMap.java   |   52 +-
 .../collections/map/UnmodifiableEntrySet.java   |   56 +-
 .../collections/map/UnmodifiableMap.java        |   42 +-
 .../collections/map/UnmodifiableOrderedMap.java |   41 +-
 .../collections/map/UnmodifiableSortedMap.java  |   57 +-
 .../set/AbstractSerializableSetDecorator.java   |    9 +-
 .../collections/set/AbstractSetDecorator.java   |    8 +-
 .../set/AbstractSortedSetDecorator.java         |    3 +
 .../commons/collections/set/CompositeSet.java   |   93 +-
 .../commons/collections/set/ListOrderedSet.java |  135 +-
 .../commons/collections/set/MapBackedSet.java   |   34 +-
 .../collections/set/SynchronizedSet.java        |    4 +-
 .../collections/set/SynchronizedSortedSet.java  |   30 +-
 .../commons/collections/set/TransformedSet.java |    8 +-
 .../collections/set/TransformedSortedSet.java   |   36 +-
 .../collections/set/UnmodifiableSet.java        |   22 +-
 .../collections/set/UnmodifiableSortedSet.java  |   11 +-
 .../commons/collections/AbstractTestObject.java |    2 +-
 .../apache/commons/collections/BulkTest.java    |   24 +-
 .../commons/collections/LocalTestNode.java      |   30 +-
 .../commons/collections/MapPerformance.java     |   34 +-
 .../commons/collections/MockTestCase.java       |    7 +-
 .../commons/collections/TestArrayList.java      |   29 +-
 .../commons/collections/TestArrayStack.java     |   28 +-
 .../commons/collections/TestBagUtils.java       |   85 +-
 .../commons/collections/TestBufferUtils.java    |    6 +-
 .../commons/collections/TestClosureUtils.java   |  247 +--
 .../collections/TestCollectionUtils.java        |   91 +-
 .../collections/TestEnumerationUtils.java       |   18 +-
 .../commons/collections/TestFactoryUtils.java   |   35 +-
 .../commons/collections/TestIteratorUtils.java  |  179 +--
 .../commons/collections/TestLinkedList.java     |   75 +-
 .../commons/collections/TestListUtils.java      |   79 +-
 .../commons/collections/TestMapUtils.java       |  249 ++-
 .../commons/collections/TestPredicateUtils.java |  435 ++---
 .../commons/collections/TestSetUtils.java       |   43 +-
 .../collections/TestTransformerUtils.java       |  176 ++-
 .../apache/commons/collections/TestTreeMap.java |   30 +-
 .../collections/TestTypedCollection.java        |   23 +-
 .../collections/bag/AbstractTestBag.java        |  307 ++--
 .../collections/bag/AbstractTestSortedBag.java  |   12 +-
 .../commons/collections/bag/TestHashBag.java    |    6 +-
 .../collections/bag/TestPredicatedBag.java      |   75 +-
 .../bag/TestPredicatedSortedBag.java            |   80 +-
 .../collections/bag/TestTransformedBag.java     |   25 +-
 .../bag/TestTransformedSortedBag.java           |   27 +-
 .../commons/collections/bag/TestTreeBag.java    |  109 +-
 .../bidimap/AbstractTestBidiMap.java            |  333 ++--
 .../bidimap/AbstractTestOrderedBidiMap.java     |  104 +-
 .../bidimap/AbstractTestSortedBidiMap.java      |  411 ++---
 .../TestAbstractOrderedBidiMapDecorator.java    |   43 +-
 .../bidimap/TestDualHashBidiMap.java            |   13 +-
 .../bidimap/TestDualTreeBidiMap.java            |   11 +-
 .../bidimap/TestDualTreeBidiMap2.java           |   31 +-
 .../collections/bidimap/TestTreeBidiMap.java    |   11 +-
 .../bidimap/TestUnmodifiableBidiMap.java        |   38 +-
 .../bidimap/TestUnmodifiableOrderedBidiMap.java |   42 +-
 .../bidimap/TestUnmodifiableSortedBidiMap.java  |   44 +-
 .../collections/buffer/TestBlockingBuffer.java  |  406 ++---
 .../collections/buffer/TestBoundedBuffer.java   |  122 +-
 .../buffer/TestBoundedFifoBuffer.java           |   86 +-
 .../buffer/TestBoundedFifoBuffer2.java          |   36 +-
 .../buffer/TestCircularFifoBuffer.java          |  306 ++--
 .../buffer/TestPredicatedBuffer.java            |   70 +-
 .../collections/buffer/TestPriorityBuffer.java  |  214 +--
 .../buffer/TestSynchronizedBuffer.java          |   41 +-
 .../buffer/TestTransformedBuffer.java           |    4 +-
 .../buffer/TestUnboundedFifoBuffer.java         |  200 ++-
 .../buffer/TestUnmodifiableBuffer.java          |   55 +-
 .../collection/AbstractTestCollection.java      |  756 ++++-----
 .../collection/TestCompositeCollection.java     |  279 ++--
 .../collection/TestPredicatedCollection.java    |   85 +-
 .../collection/TestSynchronizedCollection.java  |   33 +-
 .../collection/TestTransformedCollection.java   |    2 +-
 .../collection/TestUnmodifiableCollection.java  |   41 +-
 .../comparators/AbstractTestComparator.java     |   76 +-
 .../comparators/TestBooleanComparator.java      |  112 +-
 .../comparators/TestComparableComparator.java   |   20 +-
 .../comparators/TestComparatorChain.java        |  122 +-
 .../comparators/TestFixedOrderComparator.java   |   86 +-
 .../comparators/TestNullComparator.java         |   66 +-
 .../comparators/TestReverseComparator.java      |   27 +-
 .../collections/functors/TestAllPredicate.java  |   24 +-
 .../functors/TestAnyAllOnePredicate.java        |   29 +-
 .../functors/TestCompositePredicate.java        |   23 +-
 .../iterators/AbstractTestIterator.java         |   21 +-
 .../iterators/AbstractTestListIterator.java     |  111 +-
 .../iterators/AbstractTestMapIterator.java      |  166 +-
 .../AbstractTestOrderedMapIterator.java         |   71 +-
 .../iterators/TestArrayIterator.java            |   24 +-
 .../iterators/TestArrayIterator2.java           |   55 +-
 .../iterators/TestArrayListIterator.java        |   26 +-
 .../iterators/TestArrayListIterator2.java       |   28 +-
 .../iterators/TestCollatingIterator.java        |  120 +-
 .../iterators/TestFilterIterator.java           |   82 +-
 .../iterators/TestFilterListIterator.java       |  362 +++--
 .../iterators/TestIteratorChain.java            |   76 +-
 .../iterators/TestListIteratorWrapper.java      |   72 +-
 .../iterators/TestLoopingIterator.java          |   30 +-
 .../iterators/TestLoopingListIterator.java      |   50 +-
 .../iterators/TestObjectArrayIterator.java      |   48 +-
 .../iterators/TestObjectArrayListIterator.java  |   30 +-
 .../iterators/TestObjectArrayListIterator2.java |   30 +-
 .../iterators/TestObjectGraphIterator.java      |  106 +-
 .../iterators/TestReverseListIterator.java      |   44 +-
 .../iterators/TestSingletonIterator.java        |   50 +-
 .../iterators/TestSingletonIterator2.java       |   18 +-
 .../iterators/TestSingletonListIterator.java    |   15 +-
 .../iterators/TestUniqueFilterIterator.java     |   48 +-
 .../iterators/TestUnmodifiableIterator.java     |   36 +-
 .../iterators/TestUnmodifiableListIterator.java |   38 +-
 .../iterators/TestUnmodifiableMapIterator.java  |   54 +-
 .../TestUnmodifiableOrderedMapIterator.java     |   58 +-
 .../keyvalue/AbstractTestMapEntry.java          |   32 +-
 .../keyvalue/TestDefaultKeyValue.java           |   54 +-
 .../keyvalue/TestDefaultMapEntry.java           |   23 +-
 .../collections/keyvalue/TestMultiKey.java      |  150 +-
 .../collections/keyvalue/TestTiedMapEntry.java  |   42 +-
 .../keyvalue/TestUnmodifiableMapEntry.java      |   34 +-
 .../collections/list/AbstractTestList.java      |  551 +++----
 .../list/TestAbstractLinkedList.java            |  126 +-
 .../list/TestCursorableLinkedList.java          | 1338 ++++++++--------
 .../collections/list/TestFixedSizeList.java     |   18 +-
 .../collections/list/TestGrowthList.java        |   40 +-
 .../list/TestNodeCachingLinkedList.java         |   78 +-
 .../collections/list/TestPredicatedList.java    |  143 +-
 .../collections/list/TestSetUniqueList.java     |  307 ++--
 .../collections/list/TestSynchronizedList.java  |   19 +-
 .../collections/list/TestTransformedList.java   |   69 +-
 .../commons/collections/list/TestTreeList.java  |  112 +-
 .../collections/list/TestUnmodifiableList.java  |   80 +-
 .../map/AbstractTestIterableMap.java            |  110 +-
 .../collections/map/AbstractTestMap.java        |  935 +++++------
 .../collections/map/AbstractTestOrderedMap.java |  142 +-
 .../collections/map/AbstractTestSortedMap.java  |  200 ++-
 .../collections/map/TestCaseInsensitiveMap.java |   79 +-
 .../collections/map/TestCompositeMap.java       |  127 +-
 .../collections/map/TestDefaultedMap.java       |   68 +-
 .../collections/map/TestFixedSizeMap.java       |   18 +-
 .../collections/map/TestFixedSizeSortedMap.java |   21 +-
 .../commons/collections/map/TestFlat3Map.java   |  243 +--
 .../commons/collections/map/TestHashedMap.java  |   29 +-
 .../collections/map/TestIdentityMap.java        |   76 +-
 .../commons/collections/map/TestLRUMap.java     |  335 ++--
 .../commons/collections/map/TestLazyMap.java    |   30 +-
 .../collections/map/TestLazySortedMap.java      |    8 +-
 .../commons/collections/map/TestLinkedMap.java  |  181 ++-
 .../collections/map/TestListOrderedMap.java     |  232 +--
 .../collections/map/TestListOrderedMap2.java    |   96 +-
 .../collections/map/TestMultiKeyMap.java        |  189 +--
 .../collections/map/TestMultiValueMap.java      |  240 +--
 .../collections/map/TestPredicatedMap.java      |   88 +-
 .../map/TestPredicatedSortedMap.java            |  122 +-
 .../map/TestReferenceIdentityMap.java           |  126 +-
 .../collections/map/TestReferenceMap.java       |   62 +-
 .../collections/map/TestSingletonMap.java       |   66 +-
 .../collections/map/TestStaticBucketMap.java    |   31 +-
 .../collections/map/TestTransformedMap.java     |   75 +-
 .../map/TestTransformedSortedMap.java           |   95 +-
 .../collections/map/TestUnmodifiableMap.java    |   49 +-
 .../map/TestUnmodifiableOrderedMap.java         |   49 +-
 .../map/TestUnmodifiableSortedMap.java          |   49 +-
 .../collections/set/AbstractTestSet.java        |   73 +-
 .../collections/set/AbstractTestSortedSet.java  |  106 +-
 .../collections/set/TestCompositeSet.java       |  156 +-
 .../collections/set/TestListOrderedSet.java     |  103 +-
 .../collections/set/TestListOrderedSet2.java    |   92 +-
 .../collections/set/TestMapBackedSet.java       |    6 +-
 .../collections/set/TestMapBackedSet2.java      |   26 +-
 .../collections/set/TestPredicatedSet.java      |  110 +-
 .../set/TestPredicatedSortedSet.java            |  107 +-
 .../collections/set/TestSynchronizedSet.java    |   24 +-
 .../set/TestSynchronizedSortedSet.java          |   26 +-
 .../collections/set/TestTransformedSet.java     |   48 +-
 .../set/TestTransformedSortedSet.java           |   40 +-
 .../collections/set/TestUnmodifiableSet.java    |   34 +-
 .../set/TestUnmodifiableSortedSet.java          |   77 +-
 369 files changed, 15616 insertions(+), 14602 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/ArrayStack.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/ArrayStack.java b/src/java/org/apache/commons/collections/ArrayStack.java
index 530d764..891fc70 100644
--- a/src/java/org/apache/commons/collections/ArrayStack.java
+++ b/src/java/org/apache/commons/collections/ArrayStack.java
@@ -42,7 +42,7 @@ import java.util.EmptyStackException;
  * @author Paul Jack
  * @author Stephen Colebourne
  */
-public class ArrayStack extends ArrayList implements Buffer {
+public class ArrayStack<E> extends ArrayList<E> implements Buffer<E> {
 
     /** Ensure serialization compatibility */    
     private static final long serialVersionUID = 2130079159931574599L;
@@ -84,7 +84,7 @@ public class ArrayStack extends ArrayList implements Buffer {
      * @return the top item on the stack
      * @throws EmptyStackException  if the stack is empty
      */
-    public Object peek() throws EmptyStackException {
+    public E peek() throws EmptyStackException {
         int n = size();
         if (n <= 0) {
             throw new EmptyStackException();
@@ -102,7 +102,7 @@ public class ArrayStack extends ArrayList implements Buffer {
      * @throws EmptyStackException  if there are not enough items on the
      *  stack to satisfy this request
      */
-    public Object peek(int n) throws EmptyStackException {
+    public E peek(int n) throws EmptyStackException {
         int m = (size() - n) - 1;
         if (m < 0) {
             throw new EmptyStackException();
@@ -117,7 +117,7 @@ public class ArrayStack extends ArrayList implements Buffer {
      * @return the top item on the stack
      * @throws EmptyStackException  if the stack is empty
      */
-    public Object pop() throws EmptyStackException {
+    public E pop() throws EmptyStackException {
         int n = size();
         if (n <= 0) {
             throw new EmptyStackException();
@@ -133,7 +133,7 @@ public class ArrayStack extends ArrayList implements Buffer {
      * @param item  the item to be added
      * @return the item just pushed
      */
-    public Object push(Object item) {
+    public E push(E item) {
         add(item);
         return item;
     }
@@ -170,7 +170,7 @@ public class ArrayStack extends ArrayList implements Buffer {
      * @return the element on the top of the stack
      * @throws BufferUnderflowException  if the stack is empty
      */
-    public Object get() {
+    public E get() {
         int size = size();
         if (size == 0) {
             throw new BufferUnderflowException();
@@ -184,7 +184,7 @@ public class ArrayStack extends ArrayList implements Buffer {
      * @return the removed element 
      * @throws BufferUnderflowException  if the stack is empty
      */
-    public Object remove() {
+    public E remove() {
         int size = size();
         if (size == 0) {
             throw new BufferUnderflowException();

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/BagUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/BagUtils.java b/src/java/org/apache/commons/collections/BagUtils.java
index 86e471d..af3b02e 100644
--- a/src/java/org/apache/commons/collections/BagUtils.java
+++ b/src/java/org/apache/commons/collections/BagUtils.java
@@ -28,11 +28,12 @@ import org.apache.commons.collections.bag.UnmodifiableBag;
 import org.apache.commons.collections.bag.UnmodifiableSortedBag;
 
 /**
- * Provides utility methods and decorators for
- * {@link Bag} and {@link SortedBag} instances.
- *
+ * Provides utility methods and decorators for {@link Bag} and {@link SortedBag}
+ * instances.
+ * 
  * @since Commons Collections 2.1
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2007-07-13 05:39:24 -0500 (Fri, 13 Jul
+ * 2007) $
  * 
  * @author Paul Jack
  * @author Stephen Colebourne
@@ -44,29 +45,29 @@ public class BagUtils {
     /**
      * An empty unmodifiable bag.
      */
-    public static final Bag EMPTY_BAG = UnmodifiableBag.decorate(new HashBag());
+    public static final Bag<Object> EMPTY_BAG = UnmodifiableBag.decorate(new HashBag<Object>());
 
     /**
      * An empty unmodifiable sorted bag.
      */
-    public static final Bag EMPTY_SORTED_BAG = UnmodifiableSortedBag.decorate(new TreeBag());
+    public static final Bag<Object> EMPTY_SORTED_BAG = UnmodifiableSortedBag.decorate(new TreeBag<Object>());
 
     /**
-     * Instantiation of BagUtils is not intended or required.
-     * However, some tools require an instance to operate.
+     * Instantiation of BagUtils is not intended or required. However, some
+     * tools require an instance to operate.
      */
     public BagUtils() {
     }
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a synchronized (thread-safe) bag backed by the given bag.
-     * In order to guarantee serial access, it is critical that all 
-     * access to the backing bag is accomplished through the returned bag.
+     * Returns a synchronized (thread-safe) bag backed by the given bag. In
+     * order to guarantee serial access, it is critical that all access to the
+     * backing bag is accomplished through the returned bag.
      * <p>
-     * It is imperative that the user manually synchronize on the returned
-     * bag when iterating over it:
-     *
+     * It is imperative that the user manually synchronize on the returned bag
+     * when iterating over it:
+     * 
      * <pre>
      * Bag bag = BagUtils.synchronizedBag(new HashBag());
      * ...
@@ -77,74 +78,73 @@ public class BagUtils {
      *     }
      * }
      * </pre>
-     *
-     * Failure to follow this advice may result in non-deterministic 
-     * behavior.
-     *
-     * @param bag  the bag to synchronize, must not be null
+     * 
+     * Failure to follow this advice may result in non-deterministic behavior.
+     * 
+     * @param bag the bag to synchronize, must not be null
      * @return a synchronized bag backed by that bag
-     * @throws IllegalArgumentException  if the Bag is null
+     * @throws IllegalArgumentException if the Bag is null
      */
     public static <E> Bag<E> synchronizedBag(Bag<E> bag) {
         return SynchronizedBag.decorate(bag);
     }
 
     /**
-     * Returns an unmodifiable view of the given bag.  Any modification
-     * attempts to the returned bag will raise an 
-     * {@link UnsupportedOperationException}.
-     *
-     * @param bag  the bag whose unmodifiable view is to be returned, must not be null
+     * Returns an unmodifiable view of the given bag. Any modification attempts
+     * to the returned bag will raise an {@link UnsupportedOperationException}.
+     * 
+     * @param bag the bag whose unmodifiable view is to be returned, must not be
+     * null
      * @return an unmodifiable view of that bag
-     * @throws IllegalArgumentException  if the Bag is null
+     * @throws IllegalArgumentException if the Bag is null
      */
     public static <E> Bag<E> unmodifiableBag(Bag<E> bag) {
         return UnmodifiableBag.decorate(bag);
     }
-    
+
     /**
      * Returns a predicated (validating) bag backed by the given bag.
      * <p>
-     * Only objects that pass the test in the given predicate can be added to the bag.
-     * Trying to add an invalid object results in an IllegalArgumentException.
-     * It is important not to use the original bag after invoking this method,
-     * as it is a backdoor for adding invalid objects.
-     *
-     * @param bag  the bag to predicate, must not be null
-     * @param predicate  the predicate for the bag, must not be null
+     * Only objects that pass the test in the given predicate can be added to
+     * the bag. Trying to add an invalid object results in an
+     * IllegalArgumentException. It is important not to use the original bag
+     * after invoking this method, as it is a backdoor for adding invalid
+     * objects.
+     * 
+     * @param bag the bag to predicate, must not be null
+     * @param predicate the predicate for the bag, must not be null
      * @return a predicated bag backed by the given bag
-     * @throws IllegalArgumentException  if the Bag or Predicate is null
+     * @throws IllegalArgumentException if the Bag or Predicate is null
      */
     public static <E> Bag<E> predicatedBag(Bag<E> bag, Predicate<? super E> predicate) {
         return PredicatedBag.decorate(bag, predicate);
     }
-    
+
     /**
      * Returns a transformed bag backed by the given bag.
      * <p>
-     * Each object is passed through the transformer as it is added to the
-     * Bag. It is important not to use the original bag after invoking this 
-     * method, as it is a backdoor for adding untransformed objects.
-     *
-     * @param bag  the bag to predicate, must not be null
-     * @param transformer  the transformer for the bag, must not be null
+     * Each object is passed through the transformer as it is added to the Bag.
+     * It is important not to use the original bag after invoking this method,
+     * as it is a backdoor for adding untransformed objects.
+     * 
+     * @param bag the bag to predicate, must not be null
+     * @param transformer the transformer for the bag, must not be null
      * @return a transformed bag backed by the given bag
-     * @throws IllegalArgumentException  if the Bag or Transformer is null
+     * @throws IllegalArgumentException if the Bag or Transformer is null
      */
-    public static Bag transformedBag(Bag bag, Transformer transformer) {
+    public static <E> Bag<E> transformedBag(Bag<E> bag, Transformer<? super E, ? extends E> transformer) {
         return TransformedBag.decorate(bag, transformer);
     }
-    
+
     //-----------------------------------------------------------------------
     /**
-     * Returns a synchronized (thread-safe) sorted bag backed by the given 
-     * sorted bag.
-     * In order to guarantee serial access, it is critical that all 
+     * Returns a synchronized (thread-safe) sorted bag backed by the given
+     * sorted bag. In order to guarantee serial access, it is critical that all
      * access to the backing bag is accomplished through the returned bag.
      * <p>
-     * It is imperative that the user manually synchronize on the returned
-     * bag when iterating over it:
-     *
+     * It is imperative that the user manually synchronize on the returned bag
+     * when iterating over it:
+     * 
      * <pre>
      * SortedBag bag = BagUtils.synchronizedSortedBag(new TreeBag());
      * ...
@@ -155,62 +155,84 @@ public class BagUtils {
      *     }
      * }
      * </pre>
-     *
-     * Failure to follow this advice may result in non-deterministic 
-     * behavior.
-     *
-     * @param bag  the bag to synchronize, must not be null
+     * 
+     * Failure to follow this advice may result in non-deterministic behavior.
+     * 
+     * @param bag the bag to synchronize, must not be null
      * @return a synchronized bag backed by that bag
-     * @throws IllegalArgumentException  if the SortedBag is null
+     * @throws IllegalArgumentException if the SortedBag is null
      */
     public static <E> SortedBag<E> synchronizedSortedBag(SortedBag<E> bag) {
         return SynchronizedSortedBag.decorate(bag);
     }
-    
+
     /**
-     * Returns an unmodifiable view of the given sorted bag.  Any modification
-     * attempts to the returned bag will raise an 
+     * Returns an unmodifiable view of the given sorted bag. Any modification
+     * attempts to the returned bag will raise an
      * {@link UnsupportedOperationException}.
-     *
-     * @param bag  the bag whose unmodifiable view is to be returned, must not be null
+     * 
+     * @param bag the bag whose unmodifiable view is to be returned, must not be
+     * null
      * @return an unmodifiable view of that bag
-     * @throws IllegalArgumentException  if the SortedBag is null
+     * @throws IllegalArgumentException if the SortedBag is null
      */
     public static <E> SortedBag<E> unmodifiableSortedBag(SortedBag<E> bag) {
         return UnmodifiableSortedBag.decorate(bag);
     }
-    
+
     /**
-     * Returns a predicated (validating) sorted bag backed by the given sorted bag.
+     * Returns a predicated (validating) sorted bag backed by the given sorted
+     * bag.
      * <p>
-     * Only objects that pass the test in the given predicate can be added to the bag.
-     * Trying to add an invalid object results in an IllegalArgumentException.
-     * It is important not to use the original bag after invoking this method,
-     * as it is a backdoor for adding invalid objects.
-     *
-     * @param bag  the sorted bag to predicate, must not be null
-     * @param predicate  the predicate for the bag, must not be null
+     * Only objects that pass the test in the given predicate can be added to
+     * the bag. Trying to add an invalid object results in an
+     * IllegalArgumentException. It is important not to use the original bag
+     * after invoking this method, as it is a backdoor for adding invalid
+     * objects.
+     * 
+     * @param bag the sorted bag to predicate, must not be null
+     * @param predicate the predicate for the bag, must not be null
      * @return a predicated bag backed by the given bag
-     * @throws IllegalArgumentException  if the SortedBag or Predicate is null
+     * @throws IllegalArgumentException if the SortedBag or Predicate is null
      */
-    public static <E> SortedBag<E> predicatedSortedBag(SortedBag<E> bag, Predicate<? super E> predicate) {
+    public static <E> SortedBag<E> predicatedSortedBag(SortedBag<E> bag,
+            Predicate<? super E> predicate) {
         return PredicatedSortedBag.decorate(bag, predicate);
     }
-    
+
     /**
      * Returns a transformed sorted bag backed by the given bag.
      * <p>
-     * Each object is passed through the transformer as it is added to the
-     * Bag. It is important not to use the original bag after invoking this 
-     * method, as it is a backdoor for adding untransformed objects.
-     *
-     * @param bag  the bag to predicate, must not be null
-     * @param transformer  the transformer for the bag, must not be null
+     * Each object is passed through the transformer as it is added to the Bag.
+     * It is important not to use the original bag after invoking this method,
+     * as it is a backdoor for adding untransformed objects.
+     * 
+     * @param bag the bag to predicate, must not be null
+     * @param transformer the transformer for the bag, must not be null
      * @return a transformed bag backed by the given bag
-     * @throws IllegalArgumentException  if the Bag or Transformer is null
+     * @throws IllegalArgumentException if the Bag or Transformer is null
      */
-    public static SortedBag transformedSortedBag(SortedBag bag, Transformer transformer) {
+    public static <E> SortedBag<E> transformedSortedBag(SortedBag<E> bag, Transformer<? super E, ? extends E> transformer) {
         return TransformedSortedBag.decorate(bag, transformer);
     }
-    
+
+    /**
+     * Get an empty <code>Bag</code>.
+     * @param <E>
+     * @return Bag<E>
+     */
+    @SuppressWarnings("unchecked")
+    public static <E> Bag<E> emptyBag() {
+        return (Bag<E>) EMPTY_BAG;        
+    }
+
+    /**
+     * Get an empty <code>SortedBag</code>.
+     * @param <E>
+     * @return SortedBag<E>
+     */
+    @SuppressWarnings("unchecked")
+    public static <E> SortedBag<E> emptySortedBag() {
+        return (SortedBag<E>) EMPTY_SORTED_BAG;        
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/BidiMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/BidiMap.java b/src/java/org/apache/commons/collections/BidiMap.java
index 125f6d7..860b81c 100644
--- a/src/java/org/apache/commons/collections/BidiMap.java
+++ b/src/java/org/apache/commons/collections/BidiMap.java
@@ -88,7 +88,7 @@ public interface BidiMap<K, V> extends IterableMap<K, V> {
      * @throws NullPointerException (optional) if the map limits the values to
      *  non-null and null was specified
      */
-    K getKey(V value);
+    K getKey(Object value);
 
     /**
      * Removes the key-value pair that is currently mapped to the specified
@@ -109,7 +109,7 @@ public interface BidiMap<K, V> extends IterableMap<K, V> {
      * @throws UnsupportedOperationException if this method is not supported
      *  by the implementation
      */
-    K removeValue(V value);
+    K removeValue(Object value);
 
     /**
      * Gets a view of this map where the keys and values are reversed.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/BoundedCollection.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/BoundedCollection.java b/src/java/org/apache/commons/collections/BoundedCollection.java
index d5a54b5..1eb78a3 100644
--- a/src/java/org/apache/commons/collections/BoundedCollection.java
+++ b/src/java/org/apache/commons/collections/BoundedCollection.java
@@ -34,7 +34,7 @@ import java.util.Collection;
  * @author Herve Quiroz
  * @author Stephen Colebourne
  */
-public interface BoundedCollection extends Collection {
+public interface BoundedCollection<E> extends Collection<E> {
 
     /**
      * Returns true if this collection is full and no new elements can be added.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/BoundedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/BoundedMap.java b/src/java/org/apache/commons/collections/BoundedMap.java
index 525fe2f..0a8123f 100644
--- a/src/java/org/apache/commons/collections/BoundedMap.java
+++ b/src/java/org/apache/commons/collections/BoundedMap.java
@@ -30,7 +30,7 @@ import java.util.Map;
  * 
  * @author Stephen Colebourne
  */
-public interface BoundedMap extends Map {
+public interface BoundedMap<K, V> extends Map<K, V> {
 
     /**
      * Returns true if this map is full and no new elements can be added.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/BufferOverflowException.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/BufferOverflowException.java b/src/java/org/apache/commons/collections/BufferOverflowException.java
index b4cc029..024f1b5 100644
--- a/src/java/org/apache/commons/collections/BufferOverflowException.java
+++ b/src/java/org/apache/commons/collections/BufferOverflowException.java
@@ -31,6 +31,9 @@ package org.apache.commons.collections;
  */
 public class BufferOverflowException extends RuntimeException {
     
+    /** Serialization version */
+    private static final long serialVersionUID = -3992254982265755876L;
+
     /** The root cause throwable */
     private final Throwable throwable;
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/BufferUnderflowException.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/BufferUnderflowException.java b/src/java/org/apache/commons/collections/BufferUnderflowException.java
index fbb52b7..79cb94e 100644
--- a/src/java/org/apache/commons/collections/BufferUnderflowException.java
+++ b/src/java/org/apache/commons/collections/BufferUnderflowException.java
@@ -34,6 +34,9 @@ import java.util.NoSuchElementException;
  */
 public class BufferUnderflowException extends NoSuchElementException {
     
+    /** Serialization version */
+    private static final long serialVersionUID = 4054570024234606028L;
+
     /** The root cause throwable */
     private final Throwable throwable;
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/BufferUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/BufferUtils.java b/src/java/org/apache/commons/collections/BufferUtils.java
index 6257434..0e09fe8 100644
--- a/src/java/org/apache/commons/collections/BufferUtils.java
+++ b/src/java/org/apache/commons/collections/BufferUtils.java
@@ -37,7 +37,7 @@ public class BufferUtils {
     /**
      * An empty unmodifiable buffer.
      */
-    public static final Buffer EMPTY_BUFFER = UnmodifiableBuffer.decorate(new ArrayStack(1));
+    public static final Buffer<Object> EMPTY_BUFFER = UnmodifiableBuffer.decorate(new ArrayStack<Object>(1));
 
     /**
      * <code>BufferUtils</code> should not normally be instantiated.
@@ -66,7 +66,7 @@ public class BufferUtils {
      * @return a synchronized buffer backed by that buffer
      * @throws IllegalArgumentException  if the Buffer is null
      */
-    public static Buffer synchronizedBuffer(Buffer buffer) {
+    public static <E> Buffer<E> synchronizedBuffer(Buffer<E> buffer) {
         return SynchronizedBuffer.decorate(buffer);
     }
 
@@ -82,7 +82,7 @@ public class BufferUtils {
      * @return a blocking buffer backed by that buffer
      * @throws IllegalArgumentException  if the Buffer is null
      */
-    public static Buffer blockingBuffer(Buffer buffer) {
+    public static <E> Buffer<E> blockingBuffer(Buffer<E> buffer) {
         return BlockingBuffer.decorate(buffer);
     }
 
@@ -100,7 +100,7 @@ public class BufferUtils {
      * @throws IllegalArgumentException  if the Buffer is null
      * @since Commons Collections 3.2
      */
-    public static Buffer blockingBuffer(Buffer buffer, long timeoutMillis) {
+    public static <E> Buffer<E> blockingBuffer(Buffer<E> buffer, long timeoutMillis) {
         return BlockingBuffer.decorate(buffer, timeoutMillis);
     }
 
@@ -117,7 +117,7 @@ public class BufferUtils {
      * @throws IllegalArgumentException if the given buffer is null
      * @since Commons Collections 3.2
      */
-    public static Buffer boundedBuffer(Buffer buffer, int maximumSize) {
+    public static <E> Buffer<E> boundedBuffer(Buffer<E> buffer, int maximumSize) {
         return BoundedBuffer.decorate(buffer, maximumSize);
     }
 
@@ -135,7 +135,7 @@ public class BufferUtils {
      * @throws IllegalArgumentException if the given buffer is null
      * @since Commons Collections 3.2
      */
-    public static Buffer boundedBuffer(Buffer buffer, int maximumSize, long timeoutMillis) {
+    public static <E> Buffer<E> boundedBuffer(Buffer<E> buffer, int maximumSize, long timeoutMillis) {
         return BoundedBuffer.decorate(buffer, maximumSize, timeoutMillis);
     }
 
@@ -146,7 +146,7 @@ public class BufferUtils {
      * @return an unmodifiable buffer backed by that buffer
      * @throws IllegalArgumentException  if the Buffer is null
      */
-    public static Buffer unmodifiableBuffer(Buffer buffer) {
+    public static <E> Buffer<E> unmodifiableBuffer(Buffer<E> buffer) {
         return UnmodifiableBuffer.decorate(buffer);
     }
 
@@ -163,7 +163,7 @@ public class BufferUtils {
      * @return a predicated buffer
      * @throws IllegalArgumentException  if the Buffer or Predicate is null
      */
-    public static Buffer predicatedBuffer(Buffer buffer, Predicate predicate) {
+    public static <E> Buffer<E> predicatedBuffer(Buffer<E> buffer, Predicate<? super E> predicate) {
         return PredicatedBuffer.decorate(buffer, predicate);
     }
 
@@ -179,8 +179,17 @@ public class BufferUtils {
      * @return a transformed buffer backed by the given buffer
      * @throws IllegalArgumentException  if the Buffer or Transformer is null
      */
-    public static Buffer transformedBuffer(Buffer buffer, Transformer transformer) {
+    public static <E> Buffer<E> transformedBuffer(Buffer<E> buffer, Transformer<? super E, ? extends E> transformer) {
         return TransformedBuffer.decorate(buffer, transformer);
     }
 
+    /**
+     * Get an empty <code>Buffer</code>.
+     * @param <E>
+     * @return Buffer<E>
+     */
+    @SuppressWarnings("unchecked")
+    public static <E> Buffer<E> emptyBuffer() {
+        return (Buffer<E>) EMPTY_BUFFER;
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/ClosureUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/ClosureUtils.java b/src/java/org/apache/commons/collections/ClosureUtils.java
index ff0270d..750c284 100644
--- a/src/java/org/apache/commons/collections/ClosureUtils.java
+++ b/src/java/org/apache/commons/collections/ClosureUtils.java
@@ -17,7 +17,6 @@
 package org.apache.commons.collections;
 
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.commons.collections.functors.ChainedClosure;
@@ -71,8 +70,8 @@ public class ClosureUtils {
      * 
      * @return the closure
      */
-    public static Closure exceptionClosure() {
-        return ExceptionClosure.INSTANCE;
+    public static <E> Closure<E> exceptionClosure() {
+        return ExceptionClosure.<E>getInstance();
     }
 
     /**
@@ -83,8 +82,8 @@ public class ClosureUtils {
      * 
      * @return the closure
      */
-    public static Closure nopClosure() {
-        return NOPClosure.INSTANCE;
+    public static <E> Closure<E> nopClosure() {
+        return NOPClosure.<E>getInstance();
     }
 
     /**
@@ -97,7 +96,7 @@ public class ClosureUtils {
      * @param transformer  the transformer to run each time in the closure, null means nop
      * @return the closure
      */
-    public static Closure asClosure(Transformer transformer) {
+    public static <E> Closure<E> asClosure(Transformer<? super E, ?> transformer) {
         return TransformerClosure.getInstance(transformer);
     }
 
@@ -112,7 +111,7 @@ public class ClosureUtils {
      * @param closure  the closure to call repeatedly
      * @return the <code>for</code> closure
      */
-    public static Closure forClosure(int count, Closure closure) {
+    public static <E> Closure<E> forClosure(int count, Closure<? super E> closure) {
         return ForClosure.getInstance(count, closure);
     }
 
@@ -127,8 +126,8 @@ public class ClosureUtils {
      * @return the <code>while</code> closure
      * @throws IllegalArgumentException if either argument is null
      */
-    public static Closure whileClosure(Predicate predicate, Closure closure) {
-        return WhileClosure.getInstance(predicate, closure, false);
+    public static <E> Closure<E> whileClosure(Predicate<? super E> predicate, Closure<? super E> closure) {
+        return WhileClosure.<E>getInstance(predicate, closure, false);
     }
 
     /**
@@ -142,8 +141,8 @@ public class ClosureUtils {
      * @return the <code>do-while</code> closure
      * @throws IllegalArgumentException if either argument is null
      */
-    public static Closure doWhileClosure(Closure closure, Predicate predicate) {
-        return WhileClosure.getInstance(predicate, closure, true);
+    public static <E> Closure<E> doWhileClosure(Closure<? super E> closure, Predicate<? super E> predicate) {
+        return WhileClosure.<E>getInstance(predicate, closure, true);
     }
 
     /**
@@ -157,9 +156,9 @@ public class ClosureUtils {
      * @return the <code>invoker</code> closure
      * @throws IllegalArgumentException if the method name is null
      */
-    public static Closure invokerClosure(String methodName) {
+    public static <E> Closure<E> invokerClosure(String methodName) {
         // reuse transformer as it has caching - this is lazy really, should have inner class here
-        return asClosure(InvokerTransformer.getInstance(methodName));
+        return asClosure(InvokerTransformer.<E, Object>getInstance(methodName));
     }
 
     /**
@@ -176,9 +175,9 @@ public class ClosureUtils {
      * @throws IllegalArgumentException if the method name is null
      * @throws IllegalArgumentException if the paramTypes and args don't match
      */
-    public static Closure invokerClosure(String methodName, Class[] paramTypes, Object[] args) {
+    public static <E> Closure<E> invokerClosure(String methodName, Class<?>[] paramTypes, Object[] args) {
         // reuse transformer as it has caching - this is lazy really, should have inner class here
-        return asClosure(InvokerTransformer.getInstance(methodName, paramTypes, args));
+        return asClosure(InvokerTransformer.<E, Object>getInstance(methodName, paramTypes, args));
     }
 
     /**
@@ -192,8 +191,8 @@ public class ClosureUtils {
      * @return the <code>chained</code> closure
      * @throws IllegalArgumentException if either closure is null
      */
-    public static Closure chainedClosure(Closure closure1, Closure closure2) {
-        return ChainedClosure.getInstance(closure1, closure2);
+    public static <E> Closure<E> chainedClosure(Closure<? super E> closure1, Closure<? super E> closure2) {
+        return ChainedClosure.<E>getInstance(closure1, closure2);
     }
 
     /**
@@ -207,7 +206,7 @@ public class ClosureUtils {
      * @throws IllegalArgumentException if the closures array is null
      * @throws IllegalArgumentException if any closure in the array is null
      */
-    public static Closure chainedClosure(Closure[] closures) {
+    public static <E> Closure<E> chainedClosure(Closure<? super E>[] closures) {
         return ChainedClosure.getInstance(closures);
     }
 
@@ -224,7 +223,7 @@ public class ClosureUtils {
      * @throws IllegalArgumentException if the closures collection is empty
      * @throws IllegalArgumentException if any closure in the collection is null
      */
-    public static Closure chainedClosure(Collection closures) {
+    public static <E> Closure<E> chainedClosure(Collection<Closure<E>> closures) {
         return ChainedClosure.getInstance(closures);
     }
 
@@ -241,8 +240,8 @@ public class ClosureUtils {
      * @throws IllegalArgumentException if the closure is null
      * @since Commons Collections 3.2
      */
-    public static Closure ifClosure(Predicate predicate, Closure trueClosure) {
-        return IfClosure.getInstance(predicate, trueClosure);
+    public static <E> Closure<E> ifClosure(Predicate<? super E> predicate, Closure<? super E> trueClosure) {
+        return IfClosure.<E>getInstance(predicate, trueClosure);
     }
 
     /**
@@ -258,8 +257,8 @@ public class ClosureUtils {
      * @throws IllegalArgumentException if the predicate is null
      * @throws IllegalArgumentException if either closure is null
      */
-    public static Closure ifClosure(Predicate predicate, Closure trueClosure, Closure falseClosure) {
-        return IfClosure.getInstance(predicate, trueClosure, falseClosure);
+    public static <E> Closure<E> ifClosure(Predicate<? super E> predicate, Closure<? super E> trueClosure, Closure<? super E> falseClosure) {
+        return IfClosure.<E>getInstance(predicate, trueClosure, falseClosure);
     }
 
     /**
@@ -279,8 +278,8 @@ public class ClosureUtils {
      * @throws IllegalArgumentException if any element in the arrays is null
      * @throws IllegalArgumentException if the arrays are different sizes
      */
-    public static Closure switchClosure(Predicate[] predicates, Closure[] closures) {
-        return SwitchClosure.getInstance(predicates, closures, null);
+    public static <E> Closure<E> switchClosure(Predicate<? super E>[] predicates, Closure<? super E>[] closures) {
+        return SwitchClosure.<E>getInstance(predicates, closures, null);
     }
 
     /**
@@ -302,8 +301,8 @@ public class ClosureUtils {
      * @throws IllegalArgumentException if any element in the arrays is null
      * @throws IllegalArgumentException if the arrays are different sizes
      */
-    public static Closure switchClosure(Predicate[] predicates, Closure[] closures, Closure defaultClosure) {
-        return SwitchClosure.getInstance(predicates, closures, defaultClosure);
+    public static <E> Closure<E> switchClosure(Predicate<? super E>[] predicates, Closure<? super E>[] closures, Closure<? super E> defaultClosure) {
+        return SwitchClosure.<E>getInstance(predicates, closures, defaultClosure);
     }
     
     /**
@@ -326,7 +325,7 @@ public class ClosureUtils {
      * @throws IllegalArgumentException if any closure in the map is null
      * @throws ClassCastException  if the map elements are of the wrong type
      */
-    public static Closure switchClosure(Map predicatesAndClosures) {
+    public static <E> Closure<E> switchClosure(Map<Predicate<E>, Closure<E>> predicatesAndClosures) {
         return SwitchClosure.getInstance(predicatesAndClosures);
     }
 
@@ -347,24 +346,24 @@ public class ClosureUtils {
      * @throws IllegalArgumentException if the map is empty
      * @throws IllegalArgumentException if any closure in the map is null
      */
-    public static Closure switchMapClosure(Map objectsAndClosures) {
-        Closure[] trs = null;
-        Predicate[] preds = null;
+    @SuppressWarnings("unchecked")
+    public static <E> Closure<E> switchMapClosure(Map<? extends E, Closure<E>> objectsAndClosures) {
+        Closure<? super E>[] trs = null;
+        Predicate<E>[] preds = null;
         if (objectsAndClosures == null) {
             throw new IllegalArgumentException("The object and closure map must not be null");
         }
-        Closure def = (Closure) objectsAndClosures.remove(null);
+        Closure<? super E> def = objectsAndClosures.remove(null);
         int size = objectsAndClosures.size();
         trs = new Closure[size];
         preds = new Predicate[size];
         int i = 0;
-        for (Iterator it = objectsAndClosures.entrySet().iterator(); it.hasNext();) {
-            Map.Entry entry = (Map.Entry) it.next();
-            preds[i] = EqualPredicate.equalPredicate(entry.getKey());
-            trs[i] = (Closure) entry.getValue();
+        for (Map.Entry<? extends E, Closure<E>> entry : objectsAndClosures.entrySet()) {
+            preds[i] = EqualPredicate.<E>equalPredicate(entry.getKey());
+            trs[i] = entry.getValue();
             i++;
         }
-        return switchClosure(preds, trs, def);
+        return ClosureUtils.<E>switchClosure(preds, trs, def);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/CollectionUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/CollectionUtils.java b/src/java/org/apache/commons/collections/CollectionUtils.java
index 3e96132..1208eb4 100644
--- a/src/java/org/apache/commons/collections/CollectionUtils.java
+++ b/src/java/org/apache/commons/collections/CollectionUtils.java
@@ -63,9 +63,9 @@ public class CollectionUtils {
     private static class CardinalityHelper<O> {
         final Map<O, Integer> cardinalityA, cardinalityB;
         
-        public <I1 extends O, I2 extends O> CardinalityHelper(Iterable<I1> a, Iterable<I2> b) {
-            cardinalityA = CollectionUtils.<O, I1>getCardinalityMap(a);
-            cardinalityB = CollectionUtils.<O, I2>getCardinalityMap(b);
+        public CardinalityHelper(Iterable<? extends O> a, Iterable<? extends O> b) {
+            cardinalityA = CollectionUtils.<O>getCardinalityMap(a);
+            cardinalityB = CollectionUtils.<O>getCardinalityMap(b);
         }
         
         public final int max(Object obj) {
@@ -119,7 +119,6 @@ public class CollectionUtils {
             return newList;
         }
 
-
     }
 
     /**
@@ -292,9 +291,9 @@ public class CollectionUtils {
      *            super type of <I>.
      * @return the populated cardinality map
      */
-    public static <O, I extends O> Map<O, Integer> getCardinalityMap(final Iterable<I> coll) {
+    public static <O> Map<O, Integer> getCardinalityMap(final Iterable<? extends O> coll) {
         Map<O, Integer> count = new HashMap<O, Integer>();
-        for (I obj : coll) {
+        for (O obj : coll) {
             Integer c = count.get(obj);
             if (c == null) {
                 count.put(obj, 1);
@@ -490,7 +489,8 @@ public class CollectionUtils {
      * @param transformer
      *            the transformer to perform, may be null
      */
-    public static <C> void transform(Collection<C> collection, Transformer<? super C, ? extends C> transformer) {
+    public static <C> void transform(Collection<C> collection,
+            Transformer<? super C, ? extends C> transformer) {
         if (collection != null && transformer != null) {
             if (collection instanceof List) {
                 List<C> list = (List<C>) collection;
@@ -567,7 +567,8 @@ public class CollectionUtils {
      * @throws NullPointerException
      *             if the input collection is null
      */
-    public static <O, I extends O> Collection<O> select(Collection<I> inputCollection, Predicate<? super I> predicate) {
+    public static <O> Collection<O> select(Collection<? extends O> inputCollection,
+            Predicate<? super O> predicate) {
         return select(inputCollection, predicate, new ArrayList<O>(inputCollection.size()));
     }
 
@@ -586,9 +587,10 @@ public class CollectionUtils {
      *            the collection to output into, may not be null
      * @return outputCollection
      */
-    public static <O, I extends O, R extends Collection<O>> R select(Collection<I> inputCollection, Predicate<? super I> predicate, R outputCollection) {
+    public static <O, R extends Collection<? super O>> R select(Collection<? extends O> inputCollection,
+            Predicate<? super O> predicate, R outputCollection) {
         if (inputCollection != null && predicate != null) {
-            for (I item : inputCollection) {
+            for (O item : inputCollection) {
                 if (predicate.evaluate(item)) {
                     outputCollection.add(item);
                 }
@@ -612,7 +614,8 @@ public class CollectionUtils {
      * @throws NullPointerException
      *             if the input collection is null
      */
-    public static <O, I extends O> Collection<O> selectRejected(Collection<I> inputCollection, Predicate<? super I> predicate) {
+    public static <O> Collection<O> selectRejected(Collection<? extends O> inputCollection,
+            Predicate<? super O> predicate) {
         return selectRejected(inputCollection, predicate, new ArrayList<O>(inputCollection.size()));
     }
 
@@ -631,9 +634,10 @@ public class CollectionUtils {
      *            the collection to output into, may not be null
      * @return outputCollection
      */
-    public static <O, I extends O, R extends Collection<O>> R selectRejected(Collection<I> inputCollection, Predicate<? super I> predicate, R outputCollection) {
+    public static <O, R extends Collection<? super O>> R selectRejected(
+            Collection<? extends O> inputCollection, Predicate<? super O> predicate, R outputCollection) {
         if (inputCollection != null && predicate != null) {
-            for (I item : inputCollection) {
+            for (O item : inputCollection) {
                 if (!predicate.evaluate(item)) {
                     outputCollection.add(item);
                 }
@@ -658,7 +662,8 @@ public class CollectionUtils {
      * @throws NullPointerException
      *             if the input collection is null
      */
-    public static <I,O> Collection<O> collect(Iterable<I> inputCollection, Transformer<? super I, ? extends O> transformer) {
+    public static <I, O> Collection<O> collect(Iterable<I> inputCollection,
+            Transformer<? super I, ? extends O> transformer) {
         ArrayList<O> answer = new ArrayList<O>();
         collect(inputCollection, transformer, answer);
         return answer;
@@ -679,7 +684,8 @@ public class CollectionUtils {
      * @param <O> the type of object in the output collection
      * @return the transformed result (new list)
      */
-    public static <I,O> Collection<O> collect(Iterator<I> inputIterator, Transformer<? super I, ? extends O> transformer) {
+    public static <I, O> Collection<O> collect(Iterator<I> inputIterator,
+            Transformer<? super I, ? extends O> transformer) {
         ArrayList<O> answer = new ArrayList<O>();
         collect(inputIterator, transformer, answer);
         return answer;
@@ -701,7 +707,8 @@ public class CollectionUtils {
      * @return the outputCollection with the transformed input added
      * @throws NullPointerException if the output collection is null
      */
-    public static <I,O,T extends O, R extends Collection<O>> R collect(Iterable<I> inputCollection, final Transformer<? super I,T> transformer, final R outputCollection) {
+    public static <I, O, R extends Collection<? super O>> R collect(Iterable<? extends I> inputCollection,
+            final Transformer<? super I, ? extends O> transformer, final R outputCollection) {
         if (inputCollection != null) {
             return collect(inputCollection.iterator(), transformer, outputCollection);
         }
@@ -725,11 +732,12 @@ public class CollectionUtils {
      * @throws NullPointerException if the output collection is null
      */
     //TODO - deprecate and replace with IteratorIterable
-    public static <I,O,T extends O, R extends Collection<O>> R collect(Iterator<I> inputIterator, final Transformer<? super I,T> transformer, final R outputCollection) {
+    public static <I, O, R extends Collection<? super O>> R collect(Iterator<? extends I> inputIterator,
+            final Transformer<? super I, ? extends O> transformer, final R outputCollection) {
         if (inputIterator != null && transformer != null) {
             while (inputIterator.hasNext()) {
                 I item = inputIterator.next();
-                T value = transformer.transform(item);
+                O value = transformer.transform(item);
                 outputCollection.add(value);
             }
         }
@@ -813,7 +821,7 @@ public class CollectionUtils {
      * @throws NullPointerException
      *             if the collection or array is null
      */
-    public static <C, T extends C> void addAll(Collection<C> collection, T[] elements) {
+    public static <C> void addAll(Collection<C> collection, C[] elements) {
         for (int i = 0, size = elements.length; i < size; i++) {
             collection.add(elements[i]);
         }
@@ -913,13 +921,13 @@ public class CollectionUtils {
             throw new IndexOutOfBoundsException("Index cannot be negative: " + i);
         }
         if (object instanceof Map) {
-            Map map = (Map) object;
-            Iterator iterator = map.entrySet().iterator();
+            Map<?, ?> map = (Map<?, ?>) object;
+            Iterator<?> iterator = map.entrySet().iterator();
             return get(iterator, i);
         } else if (object instanceof Object[]) {
             return ((Object[]) object)[i];
         } else if (object instanceof Iterator) {
-            Iterator it = (Iterator) object;
+            Iterator<?> it = (Iterator<?>) object;
             while (it.hasNext()) {
                 i--;
                 if (i == -1) {
@@ -929,10 +937,10 @@ public class CollectionUtils {
             }
             throw new IndexOutOfBoundsException("Entry does not exist: " + i);
         } else if (object instanceof Collection) {
-            Iterator iterator = ((Collection) object).iterator();
+            Iterator<?> iterator = ((Collection<?>) object).iterator();
             return get(iterator, i);
         } else if (object instanceof Enumeration) {
-            Enumeration it = (Enumeration) object;
+            Enumeration<?> it = (Enumeration<?>) object;
             while (it.hasMoreElements()) {
                 i--;
                 if (i == -1) {
@@ -987,19 +995,19 @@ public class CollectionUtils {
     public static int size(Object object) {
         int total = 0;
         if (object instanceof Map) {
-            total = ((Map) object).size();
+            total = ((Map<?, ?>) object).size();
         } else if (object instanceof Collection) {
-            total = ((Collection) object).size();
+            total = ((Collection<?>) object).size();
         } else if (object instanceof Object[]) {
             total = ((Object[]) object).length;
         } else if (object instanceof Iterator) {
-            Iterator it = (Iterator) object;
+            Iterator<?> it = (Iterator<?>) object;
             while (it.hasNext()) {
                 total++;
                 it.next();
             }
         } else if (object instanceof Enumeration) {
-            Enumeration it = (Enumeration) object;
+            Enumeration<?> it = (Enumeration<?>) object;
             while (it.hasMoreElements()) {
                 total++;
                 it.nextElement();
@@ -1038,15 +1046,15 @@ public class CollectionUtils {
      */
     public static boolean sizeIsEmpty(Object object) {
         if (object instanceof Collection) {
-            return ((Collection) object).isEmpty();
+            return ((Collection<?>) object).isEmpty();
         } else if (object instanceof Map) {
-            return ((Map) object).isEmpty();
+            return ((Map<?, ?>) object).isEmpty();
         } else if (object instanceof Object[]) {
             return ((Object[]) object).length == 0;
         } else if (object instanceof Iterator) {
-            return ((Iterator) object).hasNext() == false;
+            return ((Iterator<?>) object).hasNext() == false;
         } else if (object instanceof Enumeration) {
-            return ((Enumeration) object).hasMoreElements() == false;
+            return ((Enumeration<?>) object).hasMoreElements() == false;
         } else if (object == null) {
             throw new IllegalArgumentException("Unsupported object type: null");
         } else {
@@ -1068,7 +1076,7 @@ public class CollectionUtils {
      * @return true if empty or null
      * @since Commons Collections 3.2
      */
-    public static boolean isEmpty(Collection coll) {
+    public static boolean isEmpty(Collection<?> coll) {
         return (coll == null || coll.isEmpty());
     }
 
@@ -1081,7 +1089,7 @@ public class CollectionUtils {
      * @return true if non-null and non-empty
      * @since Commons Collections 3.2
      */
-    public static boolean isNotEmpty(Collection coll) {
+    public static boolean isNotEmpty(Collection<?> coll) {
         return !isEmpty(coll);
     }
 
@@ -1120,17 +1128,17 @@ public class CollectionUtils {
      * @return true if the BoundedCollection is full
      * @throws NullPointerException if the collection is null
      */
-    public static boolean isFull(Collection coll) {
+    @SuppressWarnings("unchecked")
+    public static boolean isFull(Collection<?> coll) {
         if (coll == null) {
             throw new NullPointerException("The collection must not be null");
         }
         if (coll instanceof BoundedCollection) {
-            return ((BoundedCollection) coll).isFull();
+            return ((BoundedCollection<?>) coll).isFull();
         }
         try {
-            BoundedCollection bcoll = UnmodifiableBoundedCollection.decorateUsing(coll);
+            BoundedCollection<?> bcoll = UnmodifiableBoundedCollection.decorateUsing((Collection<Object>) coll);
             return bcoll.isFull();
-
         } catch (IllegalArgumentException ex) {
             return false;
         }
@@ -1151,17 +1159,17 @@ public class CollectionUtils {
      * @return the maximum size of the BoundedCollection, -1 if no maximum size
      * @throws NullPointerException if the collection is null
      */
-    public static int maxSize(Collection coll) {
+    @SuppressWarnings("unchecked")
+    public static int maxSize(Collection<?> coll) {
         if (coll == null) {
             throw new NullPointerException("The collection must not be null");
         }
         if (coll instanceof BoundedCollection) {
-            return ((BoundedCollection) coll).maxSize();
+            return ((BoundedCollection<?>) coll).maxSize();
         }
         try {
-            BoundedCollection bcoll = UnmodifiableBoundedCollection.decorateUsing(coll);
+            BoundedCollection<?> bcoll = UnmodifiableBoundedCollection.decorateUsing((Collection<Object>) coll);
             return bcoll.maxSize();
-
         } catch (IllegalArgumentException ex) {
             return -1;
         }
@@ -1203,7 +1211,7 @@ public class CollectionUtils {
      * @throws NullPointerException if either parameter is null
      * @since Commons Collections 3.3 (method existed in 3.2 but was completely broken)
      */
-    public static Collection removeAll(Collection collection, Collection remove) {
+    public static <E> Collection<E> removeAll(Collection<E> collection, Collection<?> remove) {
         return ListUtils.removeAll(collection, remove);
     }
 
@@ -1277,7 +1285,7 @@ public class CollectionUtils {
      * @return a transformed collection backed by the given collection
      * @throws IllegalArgumentException  if the Collection or Transformer is null
      */
-    public static Collection transformedCollection(Collection collection, Transformer transformer) {
+    public static <E> Collection<E> transformedCollection(Collection<E> collection, Transformer<? super E, ? extends E> transformer) {
         return TransformedCollection.decorate(collection, transformer);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/ComparatorUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/ComparatorUtils.java b/src/java/org/apache/commons/collections/ComparatorUtils.java
index 2fed50f..c625745 100644
--- a/src/java/org/apache/commons/collections/ComparatorUtils.java
+++ b/src/java/org/apache/commons/collections/ComparatorUtils.java
@@ -54,14 +54,16 @@ public class ComparatorUtils {
      *
      * @see ComparableComparator#getInstance
      */
-    public static final Comparator NATURAL_COMPARATOR = ComparableComparator.getInstance();
+    @SuppressWarnings("unchecked")
+    public static final Comparator NATURAL_COMPARATOR = ComparableComparator.<Comparable>getInstance();
 
     /**
      * Gets a comparator that uses the natural order of the objects.
      *
      * @return  a comparator which uses natural order
      */
-    public static Comparator naturalComparator() {
+    @SuppressWarnings("unchecked")
+    public static <E extends Comparable<? super E>> Comparator<E> naturalComparator() {
         return NATURAL_COMPARATOR;
     }
 
@@ -76,7 +78,8 @@ public class ComparatorUtils {
      * @throws NullPointerException if either comparator is null
      * @see ComparatorChain
      */
-    public static Comparator chainedComparator(Comparator comparator1, Comparator comparator2) {
+    @SuppressWarnings("unchecked")
+    public static <E extends Comparable<? super E>> Comparator<E> chainedComparator(Comparator<E> comparator1, Comparator<E> comparator2) {
         return chainedComparator(new Comparator[] {comparator1, comparator2});
     }
 
@@ -89,8 +92,8 @@ public class ComparatorUtils {
      * @throws NullPointerException if comparators array is null or contains a null
      * @see ComparatorChain
      */
-    public static Comparator chainedComparator(Comparator[] comparators) {
-        ComparatorChain chain = new ComparatorChain();
+    public static <E extends Comparable<? super E>> Comparator<E> chainedComparator(Comparator<E>[] comparators) {
+        ComparatorChain<E> chain = new ComparatorChain<E>();
         for (int i = 0; i < comparators.length; i++) {
             if (comparators[i] == null) {
                 throw new NullPointerException("Comparator cannot be null");
@@ -111,9 +114,10 @@ public class ComparatorUtils {
      * @throws ClassCastException if the comparators collection contains the wrong object type
      * @see ComparatorChain
      */
-    public static Comparator chainedComparator(Collection comparators) {
+    @SuppressWarnings("unchecked")
+    public static <E extends Comparable<? super E>> Comparator<E> chainedComparator(Collection<Comparator<E>> comparators) {
         return chainedComparator(
-            (Comparator[]) comparators.toArray(new Comparator[comparators.size()])
+            (Comparator<E>[]) comparators.toArray(new Comparator[comparators.size()])
         );
     }
 
@@ -124,11 +128,8 @@ public class ComparatorUtils {
      * @return  a comparator that reverses the order of the input comparator
      * @see ReverseComparator
      */
-    public static Comparator reversedComparator(Comparator comparator) {
-        if (comparator == null) {
-            comparator = NATURAL_COMPARATOR;
-        }
-        return new ReverseComparator(comparator);
+    public static <E> Comparator<E> reversedComparator(Comparator<E> comparator) {
+        return new ReverseComparator<E>(comparator);
     }
 
     /**
@@ -143,7 +144,7 @@ public class ComparatorUtils {
      *        <code>false</code> {@link Boolean}s.
      * @return  a comparator that sorts booleans
      */
-    public static Comparator booleanComparator(boolean trueFirst) {
+    public static Comparator<Boolean> booleanComparator(boolean trueFirst) {
         return BooleanComparator.getBooleanComparator(trueFirst);
     }
     
@@ -158,11 +159,12 @@ public class ComparatorUtils {
      * @return  a version of that comparator that allows nulls
      * @see NullComparator
      */
-    public static Comparator nullLowComparator(Comparator comparator) {
+    @SuppressWarnings("unchecked")
+    public static <E> Comparator<E> nullLowComparator(Comparator<E> comparator) {
         if (comparator == null) {
             comparator = NATURAL_COMPARATOR;
         }
-        return new NullComparator(comparator, false);
+        return new NullComparator<E>(comparator, false);
     }
 
     /**
@@ -176,11 +178,12 @@ public class ComparatorUtils {
      * @return  a version of that comparator that allows nulls
      * @see NullComparator
      */
-    public static Comparator nullHighComparator(Comparator comparator) {
+    @SuppressWarnings("unchecked")
+    public static <E> Comparator<E> nullHighComparator(Comparator<E> comparator) {
         if (comparator == null) {
             comparator = NATURAL_COMPARATOR;
         }
-        return new NullComparator(comparator, true);
+        return new NullComparator<E>(comparator, true);
     }
 
     /**
@@ -195,11 +198,12 @@ public class ComparatorUtils {
      * @return  a comparator that transforms its input objects before comparing them
      * @see  TransformingComparator
      */
-    public static Comparator transformedComparator(Comparator comparator, Transformer transformer) {
+    @SuppressWarnings("unchecked")
+    public static <E> Comparator<E> transformedComparator(Comparator<E> comparator, Transformer<? super E, ? extends E> transformer) {
         if (comparator == null) {
             comparator = NATURAL_COMPARATOR;
         }
-        return new TransformingComparator(transformer, comparator);
+        return new TransformingComparator<E>(transformer, comparator);
     }
 
     /**
@@ -212,7 +216,8 @@ public class ComparatorUtils {
      *  @param comparator  the sort order to use
      *  @return  the smaller of the two objects
      */
-    public static Object min(Object o1, Object o2, Comparator comparator) {
+    @SuppressWarnings("unchecked")
+    public static <E> E min(E o1, E o2, Comparator<E> comparator) {
         if (comparator == null) {
             comparator = NATURAL_COMPARATOR;
         }
@@ -230,7 +235,8 @@ public class ComparatorUtils {
      *  @param comparator  the sort order to use
      *  @return  the larger of the two objects
      */
-    public static Object max(Object o1, Object o2, Comparator comparator) {
+    @SuppressWarnings("unchecked")
+    public static <E> E max(E o1, E o2, Comparator<E> comparator) {
         if (comparator == null) {
             comparator = NATURAL_COMPARATOR;
         }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/EnumerationUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/EnumerationUtils.java b/src/java/org/apache/commons/collections/EnumerationUtils.java
index ec3b6e7..1a7b52f 100644
--- a/src/java/org/apache/commons/collections/EnumerationUtils.java
+++ b/src/java/org/apache/commons/collections/EnumerationUtils.java
@@ -16,8 +16,10 @@
  */
 package org.apache.commons.collections;
 
+import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.List;
+import java.util.StringTokenizer;
 
 import org.apache.commons.collections.iterators.EnumerationIterator;
 
@@ -47,8 +49,21 @@ public class EnumerationUtils {
      * @param enumeration  the enumeration to traverse, which should not be <code>null</code>.
      * @throws NullPointerException if the enumeration parameter is <code>null</code>.
      */
-    public static List toList(Enumeration enumeration) {
-        return IteratorUtils.toList(new EnumerationIterator(enumeration));
+    public static <E> List<E> toList(Enumeration<E> enumeration) {
+        return IteratorUtils.toList(new EnumerationIterator<E>(enumeration));
     }
 
+    /**
+     * Override toList(Enumeration) for StringTokenizer as it implements Enumeration<String>
+     * for the sake of backward compatibility.
+     * @param stringTokenizer
+     * @return List<String>
+     */
+    public static List<String> toList(StringTokenizer stringTokenizer) {
+        List<String> result = new ArrayList<String>(stringTokenizer.countTokens());
+        while (stringTokenizer.hasMoreTokens()) {
+            result.add(stringTokenizer.nextToken());
+        }
+        return result;
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/FactoryUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/FactoryUtils.java b/src/java/org/apache/commons/collections/FactoryUtils.java
index bdd991f..59b02fc 100644
--- a/src/java/org/apache/commons/collections/FactoryUtils.java
+++ b/src/java/org/apache/commons/collections/FactoryUtils.java
@@ -55,8 +55,8 @@ public class FactoryUtils {
      * 
      * @return the factory
      */
-    public static Factory exceptionFactory() {
-        return ExceptionFactory.INSTANCE;
+    public static <T> Factory<T> exceptionFactory() {
+        return ExceptionFactory.<T>getInstance();
     }
 
     /**
@@ -68,7 +68,7 @@ public class FactoryUtils {
      * @return the factory
      */
     public static <T> Factory<T> nullFactory() {
-        return ConstantFactory.NULL_INSTANCE;
+        return ConstantFactory.<T>getInstance(null);
     }
 
     /**
@@ -82,7 +82,7 @@ public class FactoryUtils {
      * @param constantToReturn  the constant object to return each time in the factory
      * @return the <code>constant</code> factory.
      */
-    public static Factory constantFactory(Object constantToReturn) {
+    public static <T> Factory<T> constantFactory(T constantToReturn) {
         return ConstantFactory.getInstance(constantToReturn);
     }
 
@@ -103,8 +103,8 @@ public class FactoryUtils {
      * @throws IllegalArgumentException if the prototype is null
      * @throws IllegalArgumentException if the prototype cannot be cloned
      */
-    public static Factory prototypeFactory(Object prototype) {
-        return PrototypeFactory.getInstance(prototype);
+    public static <T> Factory<T> prototypeFactory(T  prototype) {
+        return PrototypeFactory.<T>getInstance(prototype);
     }
 
     /**
@@ -135,7 +135,7 @@ public class FactoryUtils {
      * @throws IllegalArgumentException if the paramTypes and args don't match
      * @throws IllegalArgumentException if the constructor doesn't exist
      */
-    public static <T> Factory<T> instantiateFactory(Class<T> classToInstantiate, Class[] paramTypes, Object[] args) {
+    public static <T> Factory<T> instantiateFactory(Class<T> classToInstantiate, Class<?>[] paramTypes, Object[] args) {
         return InstantiateFactory.getInstance(classToInstantiate, paramTypes, args);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/FunctorException.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/FunctorException.java b/src/java/org/apache/commons/collections/FunctorException.java
index 6651fc8..ce9166a 100644
--- a/src/java/org/apache/commons/collections/FunctorException.java
+++ b/src/java/org/apache/commons/collections/FunctorException.java
@@ -30,11 +30,14 @@ import java.io.PrintWriter;
  */
 public class FunctorException extends RuntimeException {
     
+    /** Serialization version */
+    private static final long serialVersionUID = 9139387246344345475L;
+
     /**
      * Does JDK support nested exceptions
      */
     private static final boolean JDK_SUPPORTS_NESTED;
-    
+
     static {
         boolean flag = false;
         try {
@@ -45,7 +48,7 @@ public class FunctorException extends RuntimeException {
         }
         JDK_SUPPORTS_NESTED = flag;
     }
-    
+
     /**
      * Root cause of the exception
      */


[13/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/buffer/TestBoundedBuffer.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/buffer/TestBoundedBuffer.java b/src/test/org/apache/commons/collections/buffer/TestBoundedBuffer.java
index 5ad63d7..057f469 100644
--- a/src/test/org/apache/commons/collections/buffer/TestBoundedBuffer.java
+++ b/src/test/org/apache/commons/collections/buffer/TestBoundedBuffer.java
@@ -28,7 +28,7 @@ import java.util.Arrays;
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-public class TestBoundedBuffer extends AbstractTestObject {
+public class TestBoundedBuffer<E> extends AbstractTestObject {
 
     public TestBoundedBuffer(String testName) {
         super(testName);
@@ -51,136 +51,142 @@ public class TestBoundedBuffer extends AbstractTestObject {
         return false;
     }
 
-    public Object makeObject() {
-        return BoundedBuffer.decorate(new UnboundedFifoBuffer(), 1);
+    public Buffer<E> makeObject() {
+        return BoundedBuffer.decorate(new UnboundedFifoBuffer<E>(), 1);
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testMaxSize() {
-        final Buffer bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer(), 2, 500);
-        BoundedCollection bc = (BoundedCollection) bounded;
+        final Buffer<E> bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer<E>(), 2, 500);
+        BoundedCollection<?> bc = (BoundedCollection<?>) bounded;
         assertEquals(2, bc.maxSize());
         assertEquals(false, bc.isFull());
-        bounded.add("A");
+        bounded.add((E) "A");
         assertEquals(false, bc.isFull());
-        bounded.add("B");
+        bounded.add((E) "B");
         assertEquals(true, bc.isFull());
         bounded.remove();
         assertEquals(false, bc.isFull());
         try {
-            BoundedBuffer.decorate(new UnboundedFifoBuffer(), 0);
+            BoundedBuffer.decorate(new UnboundedFifoBuffer<E>(), 0);
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            BoundedBuffer.decorate(new UnboundedFifoBuffer(), -1);
+            BoundedBuffer.decorate(new UnboundedFifoBuffer<E>(), -1);
             fail();
         } catch (IllegalArgumentException ex) {}
     }
 
+    @SuppressWarnings("unchecked")
     public void testAddToFullBufferNoTimeout() {
-        final Buffer bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer(), 1);
-        bounded.add( "Hello" );
+        final Buffer<E> bounded = makeObject();
+        bounded.add((E) "Hello");
         try {
-            bounded.add("World");
+            bounded.add((E) "World");
             fail();
         } catch (BufferOverflowException e) {
         }
     }
 
+    @SuppressWarnings("unchecked")
     public void testAddAllToFullBufferNoTimeout() {
-        final Buffer bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer(), 1);
-        bounded.add( "Hello" );
+        final Buffer<E> bounded = makeObject();
+        bounded.add((E) "Hello");
         try {
-            bounded.addAll(Collections.singleton("World"));
+            bounded.addAll(Collections.singleton((E) "World"));
             fail();
         } catch (BufferOverflowException e) {
         }
     }
 
+    @SuppressWarnings("unchecked")
     public void testAddAllToEmptyBufferExceedMaxSizeNoTimeout() {
-        final Buffer bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer(), 1);
+        final Buffer<E> bounded = makeObject();
         try {
-            bounded.addAll(Collections.nCopies(2, "test"));
+            bounded.addAll(Collections.nCopies(2, (E) "test"));
             fail();
         } catch (BufferOverflowException e) {
         }
     }
 
+    @SuppressWarnings("unchecked")
     public void testAddToFullBufferRemoveViaIterator() {
-        final Buffer bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer(), 1, 500);
-        bounded.add( "Hello" );
-        new DelayedIteratorRemove( bounded, 200 ).start();
-        bounded.add( "World" );
-        assertEquals( 1, bounded.size() );
-        assertEquals( "World", bounded.get() );
+        final Buffer<E> bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer<E>(), 1, 500);
+        bounded.add((E) "Hello");
+        new DelayedIteratorRemove(bounded, 200).start();
+        bounded.add((E) "World");
+        assertEquals(1, bounded.size());
+        assertEquals("World", bounded.get());
 
     }
 
+    @SuppressWarnings("unchecked")
     public void testAddAllToFullBufferRemoveViaIterator() {
-        final Buffer bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer(), 2, 500);
-        bounded.add( "Hello" );
-        bounded.add( "World" );
-        new DelayedIteratorRemove( bounded, 200, 2 ).start();
-        bounded.addAll( Arrays.asList( new String[] { "Foo", "Bar" } ) );
-        assertEquals( 2, bounded.size() );
-        assertEquals( "Foo", bounded.remove() );
-        assertEquals( "Bar", bounded.remove() );
+        final Buffer<E> bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer<E>(), 2, 500);
+        bounded.add((E) "Hello");
+        bounded.add((E) "World");
+        new DelayedIteratorRemove(bounded, 200, 2).start();
+        bounded.addAll(Arrays.asList((E[]) new String[] { "Foo", "Bar" }));
+        assertEquals(2, bounded.size());
+        assertEquals("Foo", bounded.remove());
+        assertEquals("Bar", bounded.remove());
     }
 
+    @SuppressWarnings("unchecked")
     public void testAddToFullBufferWithTimeout() {
-        final Buffer bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer(), 1, 500);
-        bounded.add( "Hello" );
-        new DelayedRemove( bounded, 200 ).start();
-        bounded.add( "World" );
-        assertEquals( 1, bounded.size() );
-        assertEquals( "World", bounded.get() );
+        final Buffer<E> bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer<E>(), 1, 500);
+        bounded.add((E) "Hello");
+        new DelayedRemove(bounded, 200).start();
+        bounded.add((E) "World");
+        assertEquals(1, bounded.size());
+        assertEquals("World", bounded.get());
         try {
-            bounded.add( "!" );
+            bounded.add((E) "!");
             fail();
-        }
-        catch( BufferOverflowException e ) {
+        } catch (BufferOverflowException e) {
         }
     }
 
+    @SuppressWarnings("unchecked")
     public void testAddAllToFullBufferWithTimeout() {
-        final Buffer bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer(), 2, 500);
-        bounded.add( "Hello" );
-        bounded.add( "World" );
-        new DelayedRemove( bounded, 200, 2 ).start();
-
-        bounded.addAll( Arrays.asList( new String[] { "Foo", "Bar" } ) );
-        assertEquals( 2, bounded.size() );
-        assertEquals( "Foo", bounded.get() );
+        final Buffer<E> bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer<E>(), 2, 500);
+        bounded.add((E) "Hello");
+        bounded.add((E) "World");
+        new DelayedRemove(bounded, 200, 2).start();
+
+        bounded.addAll(Arrays.asList((E[]) new String[] { "Foo", "Bar" }));
+        assertEquals(2, bounded.size());
+        assertEquals("Foo", bounded.get());
         try {
-            bounded.add( "!" );
+            bounded.add((E) "!");
             fail();
-        }
-        catch( BufferOverflowException e ) {
+        } catch (BufferOverflowException e) {
         }
     }
 
     private class DelayedIteratorRemove extends Thread {
 
-        private final Buffer buffer;
+        private final Buffer<?> buffer;
 
         private final long delay;
 
         private final int nToRemove;
 
-        public DelayedIteratorRemove(Buffer buffer, long delay, int nToRemove) {
+        public DelayedIteratorRemove(Buffer<?> buffer, long delay, int nToRemove) {
             this.buffer = buffer;
             this.delay = delay;
             this.nToRemove = nToRemove;
         }
 
-        public DelayedIteratorRemove(Buffer buffer, long delay) {
+        public DelayedIteratorRemove(Buffer<?> buffer, long delay) {
             this(buffer, delay, 1);
         }
 
         public void run() {
             try {
                 Thread.sleep(delay);
-                Iterator iter = buffer.iterator();
+                Iterator<?> iter = buffer.iterator();
                 for (int i = 0; i < nToRemove; ++i) {
                     iter.next();
                     iter.remove();
@@ -193,19 +199,19 @@ public class TestBoundedBuffer extends AbstractTestObject {
 
     private class DelayedRemove extends Thread {
 
-        private final Buffer buffer;
+        private final Buffer<?> buffer;
 
         private final long delay;
 
         private final int nToRemove;
 
-        public DelayedRemove(Buffer buffer, long delay, int nToRemove) {
+        public DelayedRemove(Buffer<?> buffer, long delay, int nToRemove) {
             this.buffer = buffer;
             this.delay = delay;
             this.nToRemove = nToRemove;
         }
 
-        public DelayedRemove(Buffer buffer, long delay) {
+        public DelayedRemove(Buffer<?> buffer, long delay) {
             this(buffer, delay, 1);
         }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/buffer/TestBoundedFifoBuffer.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/buffer/TestBoundedFifoBuffer.java b/src/test/org/apache/commons/collections/buffer/TestBoundedFifoBuffer.java
index a767b6c..8ea7113 100644
--- a/src/test/org/apache/commons/collections/buffer/TestBoundedFifoBuffer.java
+++ b/src/test/org/apache/commons/collections/buffer/TestBoundedFifoBuffer.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.
@@ -17,8 +17,8 @@
 package org.apache.commons.collections.buffer;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Iterator;
+import java.util.List;
 
 import junit.framework.Test;
 
@@ -28,12 +28,12 @@ import org.apache.commons.collections.collection.AbstractTestCollection;
 
 /**
  * Test cases for BoundedFifoBuffer.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Paul Jack
  */
-public class TestBoundedFifoBuffer extends AbstractTestCollection {
+public class TestBoundedFifoBuffer<E> extends AbstractTestCollection<E> {
 
     public TestBoundedFifoBuffer(String n) {
         super(n);
@@ -45,18 +45,18 @@ public class TestBoundedFifoBuffer extends AbstractTestCollection {
 
     //-----------------------------------------------------------------------
     /**
-     *  Runs through the regular verifications, but also verifies that 
+     *  Runs through the regular verifications, but also verifies that
      *  the buffer contains the same elements in the same sequence as the
      *  list.
      */
     public void verify() {
         super.verify();
-        Iterator iterator1 = collection.iterator();
-        Iterator iterator2 = confirmed.iterator();
+        Iterator<E> iterator1 = getCollection().iterator();
+        Iterator<E> iterator2 = getConfirmed().iterator();
         while (iterator2.hasNext()) {
             assertTrue(iterator1.hasNext());
-            Object o1 = iterator1.next();
-            Object o2 = iterator2.next();
+            E o1 = iterator1.next();
+            E o2 = iterator2.next();
             assertEquals(o1, o2);
         }
     }
@@ -78,14 +78,14 @@ public class TestBoundedFifoBuffer extends AbstractTestCollection {
         return false;
     }
 
-    //-----------------------------------------------------------------------  
+    //-----------------------------------------------------------------------
     /**
      *  Returns an empty ArrayList.
      *
      *  @return an empty ArrayList
      */
-    public Collection makeConfirmedCollection() {
-        return new ArrayList();
+    public List<E> makeConfirmedCollection() {
+        return new ArrayList<E>();
     }
 
     /**
@@ -93,37 +93,37 @@ public class TestBoundedFifoBuffer extends AbstractTestCollection {
      *
      *  @return a full ArrayList
      */
-    public Collection makeConfirmedFullCollection() {
-        Collection c = makeConfirmedCollection();
+    public List<E> makeConfirmedFullCollection() {
+        List<E> c = makeConfirmedCollection();
         c.addAll(java.util.Arrays.asList(getFullElements()));
         return c;
     }
 
     /**
-     *  Returns an empty BoundedFifoBuffer that won't overflow.  
-     *  
+     *  Returns an empty BoundedFifoBuffer that won't overflow.
+     *
      *  @return an empty BoundedFifoBuffer
      */
-    public Collection makeCollection() {
-        return new BoundedFifoBuffer(100);
+    public BoundedFifoBuffer<E> makeObject() {
+        return new BoundedFifoBuffer<E>(100);
     }
 
-    //-----------------------------------------------------------------------  
+    //-----------------------------------------------------------------------
     /**
      * Tests that the removal operation actually removes the first element.
      */
     public void testBoundedFifoBufferRemove() {
         resetFull();
-        int size = confirmed.size();
+        int size = getConfirmed().size();
         for (int i = 0; i < size; i++) {
-            Object o1 = ((BoundedFifoBuffer)collection).remove();
-            Object o2 = ((ArrayList)confirmed).remove(0);
+            E o1 = getCollection().remove();
+            E o2 = getConfirmed().remove(0);
             assertEquals("Removed objects should be equal", o1, o2);
             verify();
         }
 
         try {
-            ((BoundedFifoBuffer)collection).remove();
+            getCollection().remove();
             fail("Empty buffer should raise Underflow.");
         } catch (BufferUnderflowException e) {
             // expected
@@ -135,19 +135,19 @@ public class TestBoundedFifoBuffer extends AbstractTestCollection {
      */
     public void testConstructorException1() {
         try {
-            new BoundedFifoBuffer(0);
+            new BoundedFifoBuffer<E>(0);
         } catch (IllegalArgumentException ex) {
             return;
         }
         fail();
     }
-    
+
     /**
      * Tests that the constructor correctly throws an exception.
      */
     public void testConstructorException2() {
         try {
-            new BoundedFifoBuffer(-20);
+            new BoundedFifoBuffer<E>(-20);
         } catch (IllegalArgumentException ex) {
             return;
         }
@@ -159,7 +159,7 @@ public class TestBoundedFifoBuffer extends AbstractTestCollection {
      */
     public void testConstructorException3() {
         try {
-            new BoundedFifoBuffer(null);
+            new BoundedFifoBuffer<E>(null);
         } catch (NullPointerException ex) {
             return;
         }
@@ -169,15 +169,16 @@ public class TestBoundedFifoBuffer extends AbstractTestCollection {
     public String getCompatibilityVersion() {
         return "3.1";
     }
-    
+
     // BZ 33071 -- gets start=end=1 before removal of interior element
+    @SuppressWarnings("unchecked")
     public void testShift() {
-        BoundedFifoBuffer fifo = new BoundedFifoBuffer(3);
-        fifo.add("a");
-        fifo.add("b");
-        fifo.add("c");
+        BoundedFifoBuffer<E> fifo = new BoundedFifoBuffer<E>(3);
+        fifo.add((E) "a");
+        fifo.add((E) "b");
+        fifo.add((E) "c");
         fifo.remove();
-        fifo.add("e");
+        fifo.add((E) "e");
         fifo.remove("c");
     }
 
@@ -188,4 +189,19 @@ public class TestBoundedFifoBuffer extends AbstractTestCollection {
 //        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/BoundedFifoBuffer.fullCollection.version3.1.obj");
 //    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public BoundedFifoBuffer<E> getCollection() {
+        return (BoundedFifoBuffer<E>) super.getCollection();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public List<E> getConfirmed() {
+        return (List<E>) super.getConfirmed();
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/buffer/TestBoundedFifoBuffer2.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/buffer/TestBoundedFifoBuffer2.java b/src/test/org/apache/commons/collections/buffer/TestBoundedFifoBuffer2.java
index abe84d8..7efcbd1 100644
--- a/src/test/org/apache/commons/collections/buffer/TestBoundedFifoBuffer2.java
+++ b/src/test/org/apache/commons/collections/buffer/TestBoundedFifoBuffer2.java
@@ -21,7 +21,6 @@ import java.util.Collection;
 
 import junit.framework.Test;
 
-import org.apache.commons.collections.BoundedCollection;
 import org.apache.commons.collections.BufferOverflowException;
 import org.apache.commons.collections.BulkTest;
 
@@ -33,7 +32,7 @@ import org.apache.commons.collections.BulkTest;
  * 
  * @author Unknown
  */
-public class TestBoundedFifoBuffer2 extends TestBoundedFifoBuffer {
+public class TestBoundedFifoBuffer2<E> extends TestBoundedFifoBuffer<E> {
 
     public TestBoundedFifoBuffer2(String n) {
         super(n);
@@ -50,11 +49,10 @@ public class TestBoundedFifoBuffer2 extends TestBoundedFifoBuffer {
      *
      *  @return a full BoundedFifoBuffer
      */
-    public Collection makeFullCollection() {
-        return new BoundedFifoBuffer(Arrays.asList(getFullElements()));
+    public Collection<E> makeFullCollection() {
+        return new BoundedFifoBuffer<E>(Arrays.asList(getFullElements()));
     }
 
-
     /**
      *  Overridden to skip the add tests.  All of them would fail with a 
      *  BufferOverflowException.
@@ -65,7 +63,6 @@ public class TestBoundedFifoBuffer2 extends TestBoundedFifoBuffer {
         return false;
     }
 
-
     /**
      *  Overridden because the add operations raise BufferOverflowException
      *  instead of UnsupportedOperationException.
@@ -73,14 +70,13 @@ public class TestBoundedFifoBuffer2 extends TestBoundedFifoBuffer {
     public void testUnsupportedAdd() {
     }
 
-
     /**
      *  Tests to make sure the add operations raise BufferOverflowException.
      */
     public void testBufferOverflow() {
         resetFull();
         try {
-            collection.add(getOtherElements()[0]);
+            getCollection().add(getOtherElements()[0]);
             fail("add should raise BufferOverflow.");
         } catch (BufferOverflowException e) {
             // expected
@@ -88,7 +84,7 @@ public class TestBoundedFifoBuffer2 extends TestBoundedFifoBuffer {
         verify();
 
         try {
-            collection.addAll(Arrays.asList(getOtherElements()));
+            getCollection().addAll(Arrays.asList(getOtherElements()));
             fail("addAll should raise BufferOverflow.");
         } catch (BufferOverflowException e) {
             // expected
@@ -99,25 +95,27 @@ public class TestBoundedFifoBuffer2 extends TestBoundedFifoBuffer {
     /**
      * Tests is full
      */
+    @SuppressWarnings("unchecked")
     public void testIsFull() {
         resetFull();
-        assertEquals(true, ((BoundedCollection) collection).isFull());
-        ((BoundedFifoBuffer) collection).remove();
-        assertEquals(false, ((BoundedCollection) collection).isFull());
-        ((BoundedFifoBuffer) collection).add("jj");
-        assertEquals(true, ((BoundedCollection) collection).isFull());
+        assertEquals(true, getCollection().isFull());
+        getCollection().remove();
+        assertEquals(false, getCollection().isFull());
+        getCollection().add((E) "jj");
+        assertEquals(true, getCollection().isFull());
     }
 
     /**
      * Tests max size
      */
+    @SuppressWarnings("unchecked")
     public void testMaxSize() {
         resetFull();
-        assertEquals(getFullElements().length, ((BoundedCollection) collection).maxSize());
-        ((BoundedFifoBuffer) collection).remove();
-        assertEquals(getFullElements().length, ((BoundedCollection) collection).maxSize());
-        ((BoundedFifoBuffer) collection).add("jj");
-        assertEquals(getFullElements().length, ((BoundedCollection) collection).maxSize());
+        assertEquals(getFullElements().length, getCollection().maxSize());
+        getCollection().remove();
+        assertEquals(getFullElements().length, getCollection().maxSize());
+        getCollection().add((E) "jj");
+        assertEquals(getFullElements().length, getCollection().maxSize());
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/buffer/TestCircularFifoBuffer.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/buffer/TestCircularFifoBuffer.java b/src/test/org/apache/commons/collections/buffer/TestCircularFifoBuffer.java
index 78f0507..cf1aebd 100644
--- a/src/test/org/apache/commons/collections/buffer/TestCircularFifoBuffer.java
+++ b/src/test/org/apache/commons/collections/buffer/TestCircularFifoBuffer.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.
@@ -35,12 +35,12 @@ import org.apache.commons.collections.collection.AbstractTestCollection;
 
 /**
  * Test cases for CircularFifoBuffer.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestCircularFifoBuffer extends AbstractTestCollection {
+public class TestCircularFifoBuffer<E> extends AbstractTestCollection<E> {
 
     public TestCircularFifoBuffer(String n) {
         super(n);
@@ -56,14 +56,14 @@ public class TestCircularFifoBuffer extends AbstractTestCollection {
 
     //-----------------------------------------------------------------------
     /**
-     *  Runs through the regular verifications, but also verifies that 
+     *  Runs through the regular verifications, but also verifies that
      *  the buffer contains the same elements in the same sequence as the
      *  list.
      */
     public void verify() {
         super.verify();
-        Iterator iterator1 = collection.iterator();
-        Iterator iterator2 = confirmed.iterator();
+        Iterator<E> iterator1 = getCollection().iterator();
+        Iterator<E> iterator2 = getConfirmed().iterator();
         while (iterator2.hasNext()) {
             assertTrue(iterator1.hasNext());
             Object o1 = iterator1.next();
@@ -95,8 +95,8 @@ public class TestCircularFifoBuffer extends AbstractTestCollection {
      *
      * @return an empty ArrayList
      */
-    public Collection makeConfirmedCollection() {
-        return new ArrayList();
+    public Collection<E> makeConfirmedCollection() {
+        return new ArrayList<E>();
     }
 
     /**
@@ -104,43 +104,44 @@ public class TestCircularFifoBuffer extends AbstractTestCollection {
      *
      * @return a full ArrayList
      */
-    public Collection makeConfirmedFullCollection() {
-        Collection c = makeConfirmedCollection();
+    public Collection<E> makeConfirmedFullCollection() {
+        Collection<E> c = makeConfirmedCollection();
         c.addAll(java.util.Arrays.asList(getFullElements()));
         return c;
     }
 
     /**
-     * Returns an empty BoundedFifoBuffer that won't overflow.  
-     *  
+     * Returns an empty BoundedFifoBuffer that won't overflow.
+     *
      * @return an empty BoundedFifoBuffer
      */
-    public Collection makeCollection() {
-        return new CircularFifoBuffer(100);
+    public Collection<E> makeObject() {
+        return new CircularFifoBuffer<E>(100);
     }
 
     //-----------------------------------------------------------------------
     /**
      * Tests that the removal operation actually removes the first element.
      */
+    @SuppressWarnings("unchecked")
     public void testCircularFifoBufferCircular() {
-        List list = new ArrayList();
-        list.add("A");
-        list.add("B");
-        list.add("C");
-        Buffer buf = new CircularFifoBuffer(list);
-        
+        List<E> list = new ArrayList<E>();
+        list.add((E) "A");
+        list.add((E) "B");
+        list.add((E) "C");
+        Buffer<E> buf = new CircularFifoBuffer<E>(list);
+
         assertEquals(true, buf.contains("A"));
         assertEquals(true, buf.contains("B"));
         assertEquals(true, buf.contains("C"));
-        
-        buf.add("D");
-        
+
+        buf.add((E) "D");
+
         assertEquals(false, buf.contains("A"));
         assertEquals(true, buf.contains("B"));
         assertEquals(true, buf.contains("C"));
         assertEquals(true, buf.contains("D"));
-        
+
         assertEquals("B", buf.get());
         assertEquals("B", buf.remove());
         assertEquals("C", buf.remove());
@@ -152,16 +153,16 @@ public class TestCircularFifoBuffer extends AbstractTestCollection {
      */
     public void testCircularFifoBufferRemove() {
         resetFull();
-        int size = confirmed.size();
+        int size = getConfirmed().size();
         for (int i = 0; i < size; i++) {
-            Object o1 = ((CircularFifoBuffer) collection).remove();
-            Object o2 = ((ArrayList) confirmed).remove(0);
+            Object o1 = getCollection().remove();
+            Object o2 = getConfirmed().remove(0);
             assertEquals("Removed objects should be equal", o1, o2);
             verify();
         }
 
         try {
-            ((CircularFifoBuffer) collection).remove();
+            getCollection().remove();
             fail("Empty buffer should raise Underflow.");
         } catch (BufferUnderflowException e) {
             // expected
@@ -173,7 +174,7 @@ public class TestCircularFifoBuffer extends AbstractTestCollection {
      */
     public void testConstructorException1() {
         try {
-            new CircularFifoBuffer(0);
+            new CircularFifoBuffer<E>(0);
         } catch (IllegalArgumentException ex) {
             return;
         }
@@ -185,220 +186,230 @@ public class TestCircularFifoBuffer extends AbstractTestCollection {
      */
     public void testConstructorException2() {
         try {
-            new CircularFifoBuffer(-20);
+            new CircularFifoBuffer<E>(-20);
         } catch (IllegalArgumentException ex) {
             return;
         }
         fail();
     }
-    
+
     /**
      * Tests that the constructor correctly throws an exception.
      */
     public void testConstructorException3() {
         try {
-            new CircularFifoBuffer(null);
+            new CircularFifoBuffer<E>(null);
         } catch (NullPointerException ex) {
             return;
         }
         fail();
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testRemoveError1() throws Exception {
         // based on bug 33071
-        CircularFifoBuffer fifo = new CircularFifoBuffer(5);
-        fifo.add("1");
-        fifo.add("2");
-        fifo.add("3");
-        fifo.add("4");
-        fifo.add("5");
-        
+        CircularFifoBuffer<E> fifo = new CircularFifoBuffer<E>(5);
+        fifo.add((E) "1");
+        fifo.add((E) "2");
+        fifo.add((E) "3");
+        fifo.add((E) "4");
+        fifo.add((E) "5");
+
         assertEquals("[1, 2, 3, 4, 5]", fifo.toString());
-        
+
         fifo.remove("3");
         assertEquals("[1, 2, 4, 5]", fifo.toString());
-        
+
         fifo.remove("4");
         assertEquals("[1, 2, 5]", fifo.toString());
     }
 
+    @SuppressWarnings("unchecked")
     public void testRemoveError2() throws Exception {
         // based on bug 33071
-        CircularFifoBuffer fifo = new CircularFifoBuffer(5);
-        fifo.add("1");
-        fifo.add("2");
-        fifo.add("3");
-        fifo.add("4");
-        fifo.add("5");
-        fifo.add("6");
-        
+        CircularFifoBuffer<E> fifo = new CircularFifoBuffer<E>(5);
+        fifo.add((E) "1");
+        fifo.add((E) "2");
+        fifo.add((E) "3");
+        fifo.add((E) "4");
+        fifo.add((E) "5");
+        fifo.add((E) "6");
+
         assertEquals(5, fifo.size());
         assertEquals("[2, 3, 4, 5, 6]", fifo.toString());
-        
+
         fifo.remove("3");
         assertEquals("[2, 4, 5, 6]", fifo.toString());
-        
+
         fifo.remove("4");
         assertEquals("[2, 5, 6]", fifo.toString());
     }
 
+    @SuppressWarnings("unchecked")
     public void testRemoveError3() throws Exception {
         // based on bug 33071
-        CircularFifoBuffer fifo = new CircularFifoBuffer(5);
-        fifo.add("1");
-        fifo.add("2");
-        fifo.add("3");
-        fifo.add("4");
-        fifo.add("5");
-        
+        CircularFifoBuffer<E> fifo = new CircularFifoBuffer<E>(5);
+        fifo.add((E) "1");
+        fifo.add((E) "2");
+        fifo.add((E) "3");
+        fifo.add((E) "4");
+        fifo.add((E) "5");
+
         assertEquals("[1, 2, 3, 4, 5]", fifo.toString());
-        
+
         fifo.remove("3");
         assertEquals("[1, 2, 4, 5]", fifo.toString());
-        
-        fifo.add("6");
-        fifo.add("7");
+
+        fifo.add((E) "6");
+        fifo.add((E) "7");
         assertEquals("[2, 4, 5, 6, 7]", fifo.toString());
-        
+
         fifo.remove("4");
         assertEquals("[2, 5, 6, 7]", fifo.toString());
     }
 
+    @SuppressWarnings("unchecked")
     public void testRemoveError4() throws Exception {
         // based on bug 33071
-        CircularFifoBuffer fifo = new CircularFifoBuffer(5);
-        fifo.add("1");
-        fifo.add("2");
-        fifo.add("3");
-        fifo.add("4");
-        fifo.add("5");  // end=0
-        fifo.add("6");  // end=1
-        fifo.add("7");  // end=2
-        
+        CircularFifoBuffer<E> fifo = new CircularFifoBuffer<E>(5);
+        fifo.add((E) "1");
+        fifo.add((E) "2");
+        fifo.add((E) "3");
+        fifo.add((E) "4");
+        fifo.add((E) "5");  // end=0
+        fifo.add((E) "6");  // end=1
+        fifo.add((E) "7");  // end=2
+
         assertEquals("[3, 4, 5, 6, 7]", fifo.toString());
-        
+
         fifo.remove("4");  // remove element in middle of array, after start
         assertEquals("[3, 5, 6, 7]", fifo.toString());
     }
 
+    @SuppressWarnings("unchecked")
     public void testRemoveError5() throws Exception {
         // based on bug 33071
-        CircularFifoBuffer fifo = new CircularFifoBuffer(5);
-        fifo.add("1");
-        fifo.add("2");
-        fifo.add("3");
-        fifo.add("4");
-        fifo.add("5");  // end=0
-        fifo.add("6");  // end=1
-        fifo.add("7");  // end=2
-        
+        CircularFifoBuffer<E> fifo = new CircularFifoBuffer<E>(5);
+        fifo.add((E) "1");
+        fifo.add((E) "2");
+        fifo.add((E) "3");
+        fifo.add((E) "4");
+        fifo.add((E) "5");  // end=0
+        fifo.add((E) "6");  // end=1
+        fifo.add((E) "7");  // end=2
+
         assertEquals("[3, 4, 5, 6, 7]", fifo.toString());
-        
+
         fifo.remove("5");  // remove element at last pos in array
         assertEquals("[3, 4, 6, 7]", fifo.toString());
     }
 
+    @SuppressWarnings("unchecked")
     public void testRemoveError6() throws Exception {
         // based on bug 33071
-        CircularFifoBuffer fifo = new CircularFifoBuffer(5);
-        fifo.add("1");
-        fifo.add("2");
-        fifo.add("3");
-        fifo.add("4");
-        fifo.add("5");  // end=0
-        fifo.add("6");  // end=1
-        fifo.add("7");  // end=2
-        
+        CircularFifoBuffer<E> fifo = new CircularFifoBuffer<E>(5);
+        fifo.add((E) "1");
+        fifo.add((E) "2");
+        fifo.add((E) "3");
+        fifo.add((E) "4");
+        fifo.add((E) "5");  // end=0
+        fifo.add((E) "6");  // end=1
+        fifo.add((E) "7");  // end=2
+
         assertEquals("[3, 4, 5, 6, 7]", fifo.toString());
-        
+
         fifo.remove("6");  // remove element at position zero in array
         assertEquals("[3, 4, 5, 7]", fifo.toString());
     }
 
+    @SuppressWarnings("unchecked")
     public void testRemoveError7() throws Exception {
         // based on bug 33071
-        CircularFifoBuffer fifo = new CircularFifoBuffer(5);
-        fifo.add("1");
-        fifo.add("2");
-        fifo.add("3");
-        fifo.add("4");
-        fifo.add("5");  // end=0
-        fifo.add("6");  // end=1
-        fifo.add("7");  // end=2
-        
+        CircularFifoBuffer<E> fifo = new CircularFifoBuffer<E>(5);
+        fifo.add((E) "1");
+        fifo.add((E) "2");
+        fifo.add((E) "3");
+        fifo.add((E) "4");
+        fifo.add((E) "5");  // end=0
+        fifo.add((E) "6");  // end=1
+        fifo.add((E) "7");  // end=2
+
         assertEquals("[3, 4, 5, 6, 7]", fifo.toString());
-        
+
         fifo.remove("7");  // remove element at position one in array
         assertEquals("[3, 4, 5, 6]", fifo.toString());
     }
 
+    @SuppressWarnings("unchecked")
     public void testRemoveError8() throws Exception {
         // based on bug 33071
-        CircularFifoBuffer fifo = new CircularFifoBuffer(5);
-        fifo.add("1");
-        fifo.add("2");
-        fifo.add("3");
-        fifo.add("4");
-        fifo.add("5");  // end=0
-        fifo.add("6");  // end=1
-        fifo.add("7");  // end=2
-        fifo.add("8");  // end=3
-        
+        CircularFifoBuffer<E> fifo = new CircularFifoBuffer<E>(5);
+        fifo.add((E) "1");
+        fifo.add((E) "2");
+        fifo.add((E) "3");
+        fifo.add((E) "4");
+        fifo.add((E) "5");  // end=0
+        fifo.add((E) "6");  // end=1
+        fifo.add((E) "7");  // end=2
+        fifo.add((E) "8");  // end=3
+
         assertEquals("[4, 5, 6, 7, 8]", fifo.toString());
-        
+
         fifo.remove("7");  // remove element at position one in array, need to shift 8
         assertEquals("[4, 5, 6, 8]", fifo.toString());
     }
 
+    @SuppressWarnings("unchecked")
     public void testRemoveError9() throws Exception {
         // based on bug 33071
-        CircularFifoBuffer fifo = new CircularFifoBuffer(5);
-        fifo.add("1");
-        fifo.add("2");
-        fifo.add("3");
-        fifo.add("4");
-        fifo.add("5");  // end=0
-        fifo.add("6");  // end=1
-        fifo.add("7");  // end=2
-        fifo.add("8");  // end=3
-        
+        CircularFifoBuffer<E> fifo = new CircularFifoBuffer<E>(5);
+        fifo.add((E) "1");
+        fifo.add((E) "2");
+        fifo.add((E) "3");
+        fifo.add((E) "4");
+        fifo.add((E) "5");  // end=0
+        fifo.add((E) "6");  // end=1
+        fifo.add((E) "7");  // end=2
+        fifo.add((E) "8");  // end=3
+
         assertEquals("[4, 5, 6, 7, 8]", fifo.toString());
-        
+
         fifo.remove("8");  // remove element at position two in array
         assertEquals("[4, 5, 6, 7]", fifo.toString());
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testRepeatedSerialization() throws Exception {
         // bug 31433
-        CircularFifoBuffer b = new CircularFifoBuffer(2);
-        b.add("a");
+        CircularFifoBuffer<E> b = new CircularFifoBuffer<E>(2);
+        b.add((E) "a");
         assertEquals(1, b.size());
         assertEquals(true, b.contains("a"));
-        
+
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         new ObjectOutputStream(bos).writeObject(b);
-        
-        CircularFifoBuffer b2 = (CircularFifoBuffer) new ObjectInputStream(
+
+        CircularFifoBuffer<E> b2 = (CircularFifoBuffer<E>) new ObjectInputStream(
             new ByteArrayInputStream(bos.toByteArray())).readObject();
-        
+
         assertEquals(1, b2.size());
         assertEquals(true, b2.contains("a"));
-        b2.add("b");
+        b2.add((E) "b");
         assertEquals(2, b2.size());
         assertEquals(true, b2.contains("a"));
         assertEquals(true, b2.contains("b"));
-        
+
         bos = new ByteArrayOutputStream();
         new ObjectOutputStream(bos).writeObject(b2);
-        
-        CircularFifoBuffer b3 = (CircularFifoBuffer) new ObjectInputStream(
+
+        CircularFifoBuffer<E> b3 = (CircularFifoBuffer<E>) new ObjectInputStream(
             new ByteArrayInputStream(bos.toByteArray())).readObject();
-        
+
         assertEquals(2, b3.size());
         assertEquals(true, b3.contains("a"));
         assertEquals(true, b3.contains("b"));
-        b3.add("c");
+        b3.add((E) "c");
         assertEquals(2, b3.size());
         assertEquals(true, b3.contains("b"));
         assertEquals(true, b3.contains("c"));
@@ -415,4 +426,19 @@ public class TestCircularFifoBuffer extends AbstractTestCollection {
 //        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/CircularFifoBuffer.fullCollection.version3.1.obj");
 //    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public CircularFifoBuffer<E> getCollection() {
+        return (CircularFifoBuffer<E>) super.getCollection();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public List<E> getConfirmed() {
+        return (List<E>) super.getConfirmed();
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/buffer/TestPredicatedBuffer.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/buffer/TestPredicatedBuffer.java b/src/test/org/apache/commons/collections/buffer/TestPredicatedBuffer.java
index 4f8c200..af5659d 100644
--- a/src/test/org/apache/commons/collections/buffer/TestPredicatedBuffer.java
+++ b/src/test/org/apache/commons/collections/buffer/TestPredicatedBuffer.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.
@@ -28,79 +28,81 @@ import org.apache.commons.collections.Predicate;
 import org.apache.commons.collections.collection.TestPredicatedCollection;
 
 /**
- * Extension of {@link TestPredicatedCollection} for exercising the 
+ * Extension of {@link TestPredicatedCollection} for exercising the
  * {@link PredicatedBuffer} implementation.
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  */
-public class TestPredicatedBuffer extends TestPredicatedCollection {
-    
+public class TestPredicatedBuffer<E> extends TestPredicatedCollection<E> {
+
     public TestPredicatedBuffer(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return new TestSuite(TestPredicatedBuffer.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestPredicatedBuffer.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
-    
+
     //---------------------------------------------------------------
-    
-    protected Buffer decorateBuffer(Buffer buffer, Predicate predicate) {
+
+    protected Buffer<E> decorateCollection(Buffer<E> buffer, Predicate<E> predicate) {
         return PredicatedBuffer.decorate(buffer, predicate);
     }
-    
-    public Collection makeCollection() {
-        return decorateBuffer(new ArrayStack(), truePredicate);
+
+    public Buffer<E> makeObject() {
+        return decorateCollection(new ArrayStack<E>(), truePredicate);
     }
-    
-    public Collection makeConfirmedCollection() {
-        return new ArrayStack();
+
+    public Collection<E> makeConfirmedCollection() {
+        return new ArrayStack<E>();
     }
-    
-    public Collection makeConfirmedFullCollection() {
-        ArrayStack list = new ArrayStack();
+
+    public Collection<E> makeConfirmedFullCollection() {
+        ArrayStack<E> list = new ArrayStack<E>();
         list.addAll(java.util.Arrays.asList(getFullElements()));
         return list;
     }
-    
+
     //------------------------------------------------------------
-    
-    public Buffer makeTestBuffer() {
-        return decorateBuffer(new ArrayStack(), testPredicate);
+
+    public Buffer<E> makeTestBuffer() {
+        return decorateCollection(new ArrayStack<E>(), testPredicate);
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testGet() {
-        Buffer buffer = makeTestBuffer();
+        Buffer<E> buffer = makeTestBuffer();
         try {
-            Object o = buffer.get();
+            buffer.get();
             fail("Expecting BufferUnderflowException");
         } catch (BufferUnderflowException ex) {
             // expected
         }
-        buffer.add("one");
-        buffer.add("two");
-        buffer.add("three");
+        buffer.add((E) "one");
+        buffer.add((E) "two");
+        buffer.add((E) "three");
         assertEquals("Buffer get", buffer.get(), "three");
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testRemove() {
-        Buffer buffer = makeTestBuffer();
-        buffer.add("one");
+        Buffer<E> buffer = makeTestBuffer();
+        buffer.add((E) "one");
         assertEquals("Buffer get", buffer.remove(), "one");
         try {
             buffer.remove();
             fail("Expecting BufferUnderflowException");
         } catch (BufferUnderflowException ex) {
             // expected
-        }      
+        }
     }
 
     public String getCompatibilityVersion() {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/buffer/TestPriorityBuffer.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/buffer/TestPriorityBuffer.java b/src/test/org/apache/commons/collections/buffer/TestPriorityBuffer.java
index 3e2aafb..cff46a8 100644
--- a/src/test/org/apache/commons/collections/buffer/TestPriorityBuffer.java
+++ b/src/test/org/apache/commons/collections/buffer/TestPriorityBuffer.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.
@@ -36,13 +36,13 @@ import org.apache.commons.collections.comparators.ReverseComparator;
 
 /**
  * Tests the PriorityBuffer.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Michael A. Smith
  * @author Steve Phelps
  */
-public class TestPriorityBuffer extends AbstractTestCollection {
+public class TestPriorityBuffer<E> extends AbstractTestCollection<E> {
 
     public static void main(String[] args) {
         junit.textui.TestRunner.run(suite());
@@ -56,22 +56,23 @@ public class TestPriorityBuffer extends AbstractTestCollection {
         super(testName);
     }
 
-    //-----------------------------------------------------------------------  
+    //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void verify() {
         super.verify();
-        PriorityBuffer heap = (PriorityBuffer) collection;
+        PriorityBuffer<E> heap = getCollection();
 
-        Comparator c = heap.comparator;
+        Comparator<? super E> c = heap.comparator;
         if (c == null) {
-            c = ComparatorUtils.naturalComparator();
+            c = ComparatorUtils.NATURAL_COMPARATOR;
         }
         if (!heap.ascendingOrder) {
             c = ComparatorUtils.reversedComparator(c);
         }
 
-        Object[] tree = heap.elements;
+        E[] tree = heap.elements;
         for (int i = 1; i <= heap.size; i++) {
-            Object parent = tree[i];
+            E parent = tree[i];
             if (i * 2 <= heap.size) {
                 assertTrue("Parent is less than or equal to its left child", c.compare(parent, tree[i * 2]) <= 0);
             }
@@ -81,7 +82,7 @@ public class TestPriorityBuffer extends AbstractTestCollection {
         }
     }
 
-    //-----------------------------------------------------------------------  
+    //-----------------------------------------------------------------------
     /**
      * Overridden because BinaryBuffer isn't fail fast.
      * @return false
@@ -90,13 +91,13 @@ public class TestPriorityBuffer extends AbstractTestCollection {
         return false;
     }
 
-    //-----------------------------------------------------------------------  
-    public Collection makeConfirmedCollection() {
-        return new ArrayList();
+    //-----------------------------------------------------------------------
+    public Collection<E> makeConfirmedCollection() {
+        return new ArrayList<E>();
     }
 
-    public Collection makeConfirmedFullCollection() {
-        ArrayList list = new ArrayList();
+    public Collection<E> makeConfirmedFullCollection() {
+        ArrayList<E> list = new ArrayList<E>();
         list.addAll(Arrays.asList(getFullElements()));
         return list;
     }
@@ -104,23 +105,25 @@ public class TestPriorityBuffer extends AbstractTestCollection {
     /**
      * Return a new, empty {@link Object} to used for testing.
      */
-    public Collection makeCollection() {
-        return new PriorityBuffer();
+    public Buffer<E> makeObject() {
+        return new PriorityBuffer<E>();
     }
 
-    //-----------------------------------------------------------------------  
-    public Object[] getFullElements() {
-        return getFullNonNullStringElements();
+    //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
+    public E[] getFullElements() {
+        return (E[]) getFullNonNullStringElements();
     }
 
-    public Object[] getOtherElements() {
-        return getOtherNonNullStringElements();
+    @SuppressWarnings("unchecked")
+    public E[] getOtherElements() {
+        return (E[]) getOtherNonNullStringElements();
     }
 
-    //-----------------------------------------------------------------------  
+    //-----------------------------------------------------------------------
     public void testBufferEmpty() {
         resetEmpty();
-        Buffer buffer = (Buffer) collection;
+        Buffer<E> buffer = getCollection();
 
         assertEquals(0, buffer.size());
         assertEquals(true, buffer.isEmpty());
@@ -134,24 +137,24 @@ public class TestPriorityBuffer extends AbstractTestCollection {
             fail();
         } catch (BufferUnderflowException ex) {}
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testBasicOps() {
-        PriorityBuffer heap = new PriorityBuffer();
-
-        heap.add("a");
-        heap.add("c");
-        heap.add("e");
-        heap.add("b");
-        heap.add("d");
-        heap.add("n");
-        heap.add("m");
-        heap.add("l");
-        heap.add("k");
-        heap.add("j");
-        heap.add("i");
-        heap.add("h");
-        heap.add("g");
-        heap.add("f");
+        PriorityBuffer<E> heap = new PriorityBuffer<E>();
+        heap.add((E) "a");
+        heap.add((E) "c");
+        heap.add((E) "e");
+        heap.add((E) "b");
+        heap.add((E) "d");
+        heap.add((E) "n");
+        heap.add((E) "m");
+        heap.add((E) "l");
+        heap.add((E) "k");
+        heap.add((E) "j");
+        heap.add((E) "i");
+        heap.add((E) "h");
+        heap.add((E) "g");
+        heap.add((E) "f");
 
         assertTrue("heap should not be empty after adds", !heap.isEmpty());
 
@@ -184,8 +187,9 @@ public class TestPriorityBuffer extends AbstractTestCollection {
         } catch (BufferUnderflowException ex) {}
     }
 
+    @SuppressWarnings("unchecked")
     public void testBasicComparatorOps() {
-        PriorityBuffer heap = new PriorityBuffer(new ReverseComparator(new ComparableComparator()));
+        PriorityBuffer<E> heap = new PriorityBuffer<E>(new ReverseComparator<E>((Comparator<E>) ComparableComparator.INSTANCE));
 
         assertTrue("heap should be empty after create", heap.isEmpty());
 
@@ -199,20 +203,20 @@ public class TestPriorityBuffer extends AbstractTestCollection {
             fail("NoSuchElementException should be thrown if remove is called before any elements are added");
         } catch (BufferUnderflowException ex) {}
 
-        heap.add("a");
-        heap.add("c");
-        heap.add("e");
-        heap.add("b");
-        heap.add("d");
-        heap.add("n");
-        heap.add("m");
-        heap.add("l");
-        heap.add("k");
-        heap.add("j");
-        heap.add("i");
-        heap.add("h");
-        heap.add("g");
-        heap.add("f");
+        heap.add((E) "a");
+        heap.add((E) "c");
+        heap.add((E) "e");
+        heap.add((E) "b");
+        heap.add((E) "d");
+        heap.add((E) "n");
+        heap.add((E) "m");
+        heap.add((E) "l");
+        heap.add((E) "k");
+        heap.add((E) "j");
+        heap.add((E) "i");
+        heap.add((E) "h");
+        heap.add((E) "g");
+        heap.add((E) "f");
 
         assertTrue("heap should not be empty after adds", !heap.isEmpty());
 
@@ -250,28 +254,28 @@ public class TestPriorityBuffer extends AbstractTestCollection {
     }
 
     /**
-     * Illustrates bad internal heap state reported in Bugzilla PR #235818. 
-     */  
+     * Illustrates bad internal heap state reported in Bugzilla PR #235818.
+     */
+    @SuppressWarnings("unchecked")
     public void testAddRemove() {
         resetEmpty();
-        PriorityBuffer heap = (PriorityBuffer) collection;
-        heap.add(new Integer(0));
-        heap.add(new Integer(2));
-        heap.add(new Integer(4));
-        heap.add(new Integer(3));
-        heap.add(new Integer(8));
-        heap.add(new Integer(10));
-        heap.add(new Integer(12));
-        heap.add(new Integer(3));
-        confirmed.addAll(heap);
+        PriorityBuffer heap = getCollection();
+        heap.add(0);
+        heap.add(2);
+        heap.add(4);
+        heap.add(3);
+        heap.add(8);
+        heap.add(10);
+        heap.add(12);
+        heap.add(3);
+        getConfirmed().addAll(heap);
         // System.out.println(heap);
-        Object obj = new Integer(10);
-        heap.remove(obj);
-        confirmed.remove(obj);
+        heap.remove(10);
+        getConfirmed().remove(10);
         // System.out.println(heap);
         verify();
     }
-    
+
     /**
      * Generate heaps staring with Integers from 0 - heapSize - 1.
      * Then perform random add / remove operations, checking
@@ -285,29 +289,29 @@ public class TestPriorityBuffer extends AbstractTestCollection {
         int heapSize = 100;
         int operations = 20;
         Random randGenerator = new Random();
-        PriorityBuffer h = null;
-        for(int i=0; i < iterations; i++) {
-            if (i < iterations / 2) {          
-                h = new PriorityBuffer(true);
+        PriorityBuffer<Integer> h = null;
+        for (int i = 0; i < iterations; i++) {
+            if (i < iterations / 2) {
+                h = new PriorityBuffer<Integer>(true);
             } else {
-                h = new PriorityBuffer(false);
+                h = new PriorityBuffer<Integer>(false);
             }
-            for(int r = 0; r < heapSize; r++) {
-                h.add( new Integer( randGenerator.nextInt(heapSize)) );
+            for (int r = 0; r < heapSize; r++) {
+                h.add(randGenerator.nextInt(heapSize));
             }
-            for( int r = 0; r < operations; r++ ) {
+            for (int r = 0; r < operations; r++) {
                 h.remove(new Integer(r));
-                h.add(new Integer(randGenerator.nextInt(heapSize)));
+                h.add(randGenerator.nextInt(heapSize));
             }
             checkOrder(h);
         }
     }
-     
+
     /**
      * Pops all elements from the heap and verifies that the elements come off
      * in the correct order.  NOTE: this method empties the heap.
      */
-    protected void checkOrder(PriorityBuffer h) {
+    protected void checkOrder(PriorityBuffer<?> h) {
         Integer lastNum = null;
         Integer num = null;
         while (!h.isEmpty()) {
@@ -321,17 +325,17 @@ public class TestPriorityBuffer extends AbstractTestCollection {
             num = null;
         }
     }
-    
+
     /**
      * Returns a string showing the contents of the heap formatted as a tree.
-     * Makes no attempt at padding levels or handling wrapping. 
+     * Makes no attempt at padding levels or handling wrapping.
      */
-    protected String showTree(PriorityBuffer h) {
+    protected String showTree(PriorityBuffer<?> h) {
         int count = 1;
         StringBuffer buffer = new StringBuffer();
         for (int offset = 1; count < h.size() + 1; offset *= 2) {
             for (int i = offset; i < offset * 2; i++) {
-                if (i < h.elements.length && h.elements[i] != null) 
+                if (i < h.elements.length && h.elements[i] != null)
                     buffer.append(h.elements[i] + " ");
                 count++;
             }
@@ -344,15 +348,16 @@ public class TestPriorityBuffer extends AbstractTestCollection {
      * Generates 500 randomly initialized heaps of size 100
      * and tests that after serializing and restoring them to a byte array
      * that the following conditions hold:
-     * 
-     *  - the size of the restored heap is the same 
+     *
+     *  - the size of the restored heap is the same
      *      as the size of the orignal heap
-     *  
+     *
      *  - all elements in the original heap are present in the restored heap
-     *  
-     *  - the heap order of the restored heap is intact as 
+     *
+     *  - the heap order of the restored heap is intact as
      *      verified by checkOrder()
      */
+    @SuppressWarnings("unchecked")
     public void testSerialization() {
         int iterations = 500;
         int heapSize = 100;
@@ -360,17 +365,17 @@ public class TestPriorityBuffer extends AbstractTestCollection {
         Random randGenerator = new Random();
         for (int i = 0; i < iterations; i++) {
             if (i < iterations / 2) {
-                h = new PriorityBuffer(true);
+                h = new PriorityBuffer<E>(true);
             } else {
-                h = new PriorityBuffer(false);
+                h = new PriorityBuffer<E>(false);
             }
             for (int r = 0; r < heapSize; r++) {
                 h.add(new Integer(randGenerator.nextInt(heapSize)));
             }
             assertTrue(h.size() == heapSize);
-            PriorityBuffer h1 = serializeAndRestore(h);
+            PriorityBuffer<?> h1 = serializeAndRestore(h);
             assertTrue(h1.size() == heapSize);
-            Iterator hit = h.iterator();
+            Iterator<?> hit = h.iterator();
             while (hit.hasNext()) {
                 Integer n = (Integer) hit.next();
                 assertTrue(h1.contains(n));
@@ -379,11 +384,11 @@ public class TestPriorityBuffer extends AbstractTestCollection {
         }
     }
 
-    public PriorityBuffer serializeAndRestore(PriorityBuffer h) {
-        PriorityBuffer h1 = null;
+    public PriorityBuffer<?> serializeAndRestore(PriorityBuffer<E> h) {
+        PriorityBuffer<?> h1 = null;
         try {
             byte[] objekt = writeExternalFormToBytes(h);
-            h1 = (PriorityBuffer) readExternalFormFromBytes(objekt);
+            h1 = (PriorityBuffer<?>) readExternalFormFromBytes(objekt);
         } catch (IOException e) {
             e.printStackTrace();
             fail(e.toString());
@@ -405,4 +410,11 @@ public class TestPriorityBuffer extends AbstractTestCollection {
 //        writeExternalFormToDisk((java.io.Serializable) collection, "C:/commons/collections/data/test/PriorityBuffer.fullCollection.version3.2.obj");
 //    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public PriorityBuffer<E> getCollection() {
+        return (PriorityBuffer<E>) super.getCollection();
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/buffer/TestSynchronizedBuffer.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/buffer/TestSynchronizedBuffer.java b/src/test/org/apache/commons/collections/buffer/TestSynchronizedBuffer.java
index 7bb47fd..305a788 100644
--- a/src/test/org/apache/commons/collections/buffer/TestSynchronizedBuffer.java
+++ b/src/test/org/apache/commons/collections/buffer/TestSynchronizedBuffer.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.
@@ -27,48 +27,47 @@ import org.apache.commons.collections.Buffer;
 import org.apache.commons.collections.collection.AbstractTestCollection;
 
 /**
- * Extension of {@link AbstractTestCollection} for exercising the 
+ * Extension of {@link AbstractTestCollection} for exercising the
  * {@link SynchronizedBuffer} implementation.
  *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  * @author Stephen Colebourne
  */
-public class TestSynchronizedBuffer extends AbstractTestCollection {
-    
+public class TestSynchronizedBuffer<E> extends AbstractTestCollection<E> {
+
     public TestSynchronizedBuffer(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return new TestSuite(TestSynchronizedBuffer.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestSynchronizedBuffer.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    //-----------------------------------------------------------------------    
-    public Collection makeCollection() {
-        return SynchronizedBuffer.decorate(new UnboundedFifoBuffer());
+    //-----------------------------------------------------------------------
+    public Buffer<E> makeObject() {
+        return SynchronizedBuffer.decorate(new UnboundedFifoBuffer<E>());
     }
-    
-    public Collection makeFullCollection() {
-        Buffer buffer = new UnboundedFifoBuffer();
+
+    public Collection<E> makeFullCollection() {
+        Buffer<E> buffer = new UnboundedFifoBuffer<E>();
         buffer.addAll(Arrays.asList(getFullElements()));
         return SynchronizedBuffer.decorate(buffer);
     }
-    
-    public Collection makeConfirmedCollection() {
-        ArrayStack list = new ArrayStack();
-        return list;
+
+    public Collection<E> makeConfirmedCollection() {
+        return new ArrayStack<E>();
     }
 
-    public Collection makeConfirmedFullCollection() {
-        ArrayStack list = new ArrayStack();
+    public Collection<E> makeConfirmedFullCollection() {
+        ArrayStack<E> list = new ArrayStack<E>();
         list.addAll(Arrays.asList(getFullElements()));
         return list;
     }
@@ -76,7 +75,7 @@ public class TestSynchronizedBuffer extends AbstractTestCollection {
     public boolean isNullSupported() {
         return false;
     }
-    
+
     public String getCompatibilityVersion() {
         return "3.1";
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/buffer/TestTransformedBuffer.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/buffer/TestTransformedBuffer.java b/src/test/org/apache/commons/collections/buffer/TestTransformedBuffer.java
index 910622e..d1498a1 100644
--- a/src/test/org/apache/commons/collections/buffer/TestTransformedBuffer.java
+++ b/src/test/org/apache/commons/collections/buffer/TestTransformedBuffer.java
@@ -49,9 +49,9 @@ public class TestTransformedBuffer extends TestCase {
     }
 
     public void testTransformedBuffer() {
-        Buffer buffer = TransformedBuffer.decorate(new ArrayStack(), TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
+        Buffer<Object> buffer = TransformedBuffer.decorate(new ArrayStack<Object>(), TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(0, buffer.size());
-        Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
+        Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" };
         for (int i = 0; i < els.length; i++) {
             buffer.add(els[i]);
             assertEquals(i + 1, buffer.size());

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/buffer/TestUnboundedFifoBuffer.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/buffer/TestUnboundedFifoBuffer.java b/src/test/org/apache/commons/collections/buffer/TestUnboundedFifoBuffer.java
index 69978f0..a45248d 100644
--- a/src/test/org/apache/commons/collections/buffer/TestUnboundedFifoBuffer.java
+++ b/src/test/org/apache/commons/collections/buffer/TestUnboundedFifoBuffer.java
@@ -19,6 +19,7 @@ package org.apache.commons.collections.buffer;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.List;
 
 import junit.framework.Test;
 
@@ -32,7 +33,7 @@ import org.apache.commons.collections.collection.AbstractTestCollection;
  * 
  * @author Unknown
  */
-public class TestUnboundedFifoBuffer extends AbstractTestCollection {
+public class TestUnboundedFifoBuffer<E> extends AbstractTestCollection<E> {
 
     public TestUnboundedFifoBuffer(String n) {
         super(n);
@@ -49,8 +50,8 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
      */
     public void verify() {
         super.verify();
-        Iterator iterator1 = collection.iterator();
-        Iterator iterator2 = confirmed.iterator();
+        Iterator<E> iterator1 = getCollection().iterator();
+        Iterator<E> iterator2 = getConfirmed().iterator();
         while (iterator2.hasNext()) {
             assertTrue(iterator1.hasNext());
             Object o1 = iterator1.next();
@@ -82,8 +83,8 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
      *
      *  @return an empty ArrayList
      */
-    public Collection makeConfirmedCollection() {
-        return new ArrayList();
+    public Collection<E> makeConfirmedCollection() {
+        return new ArrayList<E>();
     }
 
     /**
@@ -91,8 +92,8 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
      *
      *  @return a full ArrayList
      */
-    public Collection makeConfirmedFullCollection() {
-        Collection c = makeConfirmedCollection();
+    public Collection<E> makeConfirmedFullCollection() {
+        Collection<E> c = makeConfirmedCollection();
         c.addAll(java.util.Arrays.asList(getFullElements()));
         return c;
     }
@@ -102,8 +103,8 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
      *
      *  @return an empty UnboundedFifoBuffer
      */
-    public Collection makeCollection() {
-        return new UnboundedFifoBuffer(5);
+    public Collection<E> makeObject() {
+        return new UnboundedFifoBuffer<E>(5);
     }
 
     //-----------------------------------------------------------------------
@@ -112,10 +113,10 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
      */
     public void testUnboundedFifoBufferRemove() {
         resetFull();
-        int size = confirmed.size();
+        int size = getConfirmed().size();
         for (int i = 0; i < size; i++) {
-            Object o1 = ((UnboundedFifoBuffer)collection).remove();
-            Object o2 = ((ArrayList)confirmed).remove(0);
+            E o1 = getCollection().remove();
+            E o2 = getConfirmed().remove(0);
             assertEquals("Removed objects should be equal", o1, o2);
             verify();
         }
@@ -126,7 +127,7 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
      */
     public void testConstructorException1() {
         try {
-            new UnboundedFifoBuffer(0);
+            new UnboundedFifoBuffer<E>(0);
         } catch (IllegalArgumentException ex) {
             return;
         }
@@ -138,7 +139,7 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
      */
     public void testConstructorException2() {
         try {
-            new UnboundedFifoBuffer(-20);
+            new UnboundedFifoBuffer<E>(-20);
         } catch (IllegalArgumentException ex) {
             return;
         }
@@ -146,43 +147,45 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testInternalStateAdd() {
-        UnboundedFifoBuffer test = new UnboundedFifoBuffer(2);
+        UnboundedFifoBuffer<E> test = new UnboundedFifoBuffer<E>(2);
         assertEquals(3, test.buffer.length);
         assertEquals(0, test.head);
         assertEquals(0, test.tail);
-        test.add("A");
+        test.add((E) "A");
         assertEquals(3, test.buffer.length);
         assertEquals(0, test.head);
         assertEquals(1, test.tail);
-        test.add("B");
+        test.add((E) "B");
         assertEquals(3, test.buffer.length);
         assertEquals(0, test.head);
         assertEquals(2, test.tail);
-        test.add("C");  // forces buffer increase
+        test.add((E) "C");  // forces buffer increase
         assertEquals(5, test.buffer.length);
         assertEquals(0, test.head);
         assertEquals(3, test.tail);
-        test.add("D");
+        test.add((E) "D");
         assertEquals(5, test.buffer.length);
         assertEquals(0, test.head);
         assertEquals(4, test.tail);
     }
 
+    @SuppressWarnings("unchecked")
     public void testInternalStateAddWithWrap() {
-        UnboundedFifoBuffer test = new UnboundedFifoBuffer(3);
+        UnboundedFifoBuffer<E> test = new UnboundedFifoBuffer<E>(3);
         assertEquals(4, test.buffer.length);
         assertEquals(0, test.head);
         assertEquals(0, test.tail);
-        test.add("A");
+        test.add((E) "A");
         assertEquals(4, test.buffer.length);
         assertEquals(0, test.head);
         assertEquals(1, test.tail);
-        test.add("B");
+        test.add((E) "B");
         assertEquals(4, test.buffer.length);
         assertEquals(0, test.head);
         assertEquals(2, test.tail);
-        test.add("C");
+        test.add((E) "C");
         assertEquals(4, test.buffer.length);
         assertEquals(0, test.head);
         assertEquals(3, test.tail);
@@ -194,21 +197,22 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
         assertEquals(4, test.buffer.length);
         assertEquals(2, test.head);
         assertEquals(3, test.tail);
-        test.add("D");
+        test.add((E) "D");
         assertEquals(4, test.buffer.length);
         assertEquals(2, test.head);
         assertEquals(0, test.tail);
-        test.add("E");
+        test.add((E) "E");
         assertEquals(4, test.buffer.length);
         assertEquals(2, test.head);
         assertEquals(1, test.tail);
     }
 
+    @SuppressWarnings("unchecked")
     public void testInternalStateRemove1() {
-        UnboundedFifoBuffer test = new UnboundedFifoBuffer(4);
-        test.add("A");
-        test.add("B");
-        test.add("C");
+        UnboundedFifoBuffer<E> test = new UnboundedFifoBuffer<E>(4);
+        test.add((E) "A");
+        test.add((E) "B");
+        test.add((E) "C");
         assertEquals(5, test.buffer.length);
         assertEquals(0, test.head);
         assertEquals(3, test.tail);
@@ -218,17 +222,18 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
         assertEquals(1, test.head);
         assertEquals(3, test.tail);
         
-        test.add("D");
+        test.add((E) "D");
         assertEquals(5, test.buffer.length);
         assertEquals(1, test.head);
         assertEquals(4, test.tail);
     }
 
+    @SuppressWarnings("unchecked")
     public void testInternalStateRemove2() {
-        UnboundedFifoBuffer test = new UnboundedFifoBuffer(4);
-        test.add("A");
-        test.add("B");
-        test.add("C");
+        UnboundedFifoBuffer<E> test = new UnboundedFifoBuffer<E>(4);
+        test.add((E) "A");
+        test.add((E) "B");
+        test.add((E) "C");
         assertEquals(5, test.buffer.length);
         assertEquals(0, test.head);
         assertEquals(3, test.tail);
@@ -238,41 +243,43 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
         assertEquals(0, test.head);
         assertEquals(2, test.tail);
         
-        test.add("D");
+        test.add((E) "D");
         assertEquals(5, test.buffer.length);
         assertEquals(0, test.head);
         assertEquals(3, test.tail);
     }
 
+    @SuppressWarnings("unchecked")
     public void testInternalStateIteratorRemove1() {
-        UnboundedFifoBuffer test = new UnboundedFifoBuffer(4);
-        test.add("A");
-        test.add("B");
-        test.add("C");
+        UnboundedFifoBuffer<E> test = new UnboundedFifoBuffer<E>(4);
+        test.add((E) "A");
+        test.add((E) "B");
+        test.add((E) "C");
         assertEquals(5, test.buffer.length);
         assertEquals(0, test.head);
         assertEquals(3, test.tail);
         
-        Iterator it = test.iterator();
+        Iterator<E> it = test.iterator();
         it.next();
         it.remove();
         assertEquals(5, test.buffer.length);
         assertEquals(1, test.head);
         assertEquals(3, test.tail);
         
-        test.add("D");
+        test.add((E) "D");
         assertEquals(5, test.buffer.length);
         assertEquals(1, test.head);
         assertEquals(4, test.tail);
     }
 
+    @SuppressWarnings("unchecked")
     public void testInternalStateIteratorRemove2() {
-        UnboundedFifoBuffer test = new UnboundedFifoBuffer(4);
-        test.add("A");
-        test.add("B");
-        test.add("C");
+        UnboundedFifoBuffer<E> test = new UnboundedFifoBuffer<E>(4);
+        test.add((E) "A");
+        test.add((E) "B");
+        test.add((E) "C");
         
-        Iterator it = test.iterator();
+        Iterator<E> it = test.iterator();
         it.next();
         it.next();
         it.remove();
@@ -280,24 +287,25 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
         assertEquals(0, test.head);
         assertEquals(2, test.tail);
         
-        test.add("D");
+        test.add((E) "D");
         assertEquals(5, test.buffer.length);
         assertEquals(0, test.head);
         assertEquals(3, test.tail);
     }
 
+    @SuppressWarnings("unchecked")
     public void testInternalStateIteratorRemoveWithTailAtEnd1() {
-        UnboundedFifoBuffer test = new UnboundedFifoBuffer(3);
-        test.add("A");
-        test.add("B");
-        test.add("C");
+        UnboundedFifoBuffer<E> test = new UnboundedFifoBuffer<E>(3);
+        test.add((E) "A");
+        test.add((E) "B");
+        test.add((E) "C");
         test.remove("A");
-        test.add("D");
+        test.add((E) "D");
         assertEquals(4, test.buffer.length);
         assertEquals(1, test.head);
         assertEquals(0, test.tail);
         
-        Iterator it = test.iterator();
+        Iterator<E> it = test.iterator();
         assertEquals("B", it.next());
         it.remove();
         assertEquals(4, test.buffer.length);
@@ -305,18 +313,19 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
         assertEquals(0, test.tail);
     }
 
+    @SuppressWarnings("unchecked")
     public void testInternalStateIteratorRemoveWithTailAtEnd2() {
-        UnboundedFifoBuffer test = new UnboundedFifoBuffer(3);
-        test.add("A");
-        test.add("B");
-        test.add("C");
+        UnboundedFifoBuffer<E> test = new UnboundedFifoBuffer<E>(3);
+        test.add((E) "A");
+        test.add((E) "B");
+        test.add((E) "C");
         test.remove("A");
-        test.add("D");
+        test.add((E) "D");
         assertEquals(4, test.buffer.length);
         assertEquals(1, test.head);
         assertEquals(0, test.tail);
         
-        Iterator it = test.iterator();
+        Iterator<E> it = test.iterator();
         assertEquals("B", it.next());
         assertEquals("C", it.next());
         it.remove();
@@ -325,18 +334,19 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
         assertEquals(3, test.tail);
     }
 
+    @SuppressWarnings("unchecked")
     public void testInternalStateIteratorRemoveWithTailAtEnd3() {
-        UnboundedFifoBuffer test = new UnboundedFifoBuffer(3);
-        test.add("A");
-        test.add("B");
-        test.add("C");
+        UnboundedFifoBuffer<E> test = new UnboundedFifoBuffer<E>(3);
+        test.add((E) "A");
+        test.add((E) "B");
+        test.add((E) "C");
         test.remove("A");
-        test.add("D");
+        test.add((E) "D");
         assertEquals(4, test.buffer.length);
         assertEquals(1, test.head);
         assertEquals(0, test.tail);
         
-        Iterator it = test.iterator();
+        Iterator<E> it = test.iterator();
         assertEquals("B", it.next());
         assertEquals("C", it.next());
         assertEquals("D", it.next());
@@ -346,20 +356,21 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
         assertEquals(3, test.tail);
     }
 
+    @SuppressWarnings("unchecked")
     public void testInternalStateIteratorRemoveWithWrap1() {
-        UnboundedFifoBuffer test = new UnboundedFifoBuffer(3);
-        test.add("A");
-        test.add("B");
-        test.add("C");
+        UnboundedFifoBuffer<E> test = new UnboundedFifoBuffer<E>(3);
+        test.add((E) "A");
+        test.add((E) "B");
+        test.add((E) "C");
         test.remove("A");
         test.remove("B");
-        test.add("D");
-        test.add("E");
+        test.add((E) "D");
+        test.add((E) "E");
         assertEquals(4, test.buffer.length);
         assertEquals(2, test.head);
         assertEquals(1, test.tail);
         
-        Iterator it = test.iterator();
+        Iterator<E> it = test.iterator();
         assertEquals("C", it.next());
         it.remove();
         assertEquals(4, test.buffer.length);
@@ -367,20 +378,21 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
         assertEquals(1, test.tail);
     }
 
+    @SuppressWarnings("unchecked")
     public void testInternalStateIteratorRemoveWithWrap2() {
-        UnboundedFifoBuffer test = new UnboundedFifoBuffer(3);
-        test.add("A");
-        test.add("B");
-        test.add("C");
+        UnboundedFifoBuffer<E> test = new UnboundedFifoBuffer<E>(3);
+        test.add((E) "A");
+        test.add((E) "B");
+        test.add((E) "C");
         test.remove("A");
         test.remove("B");
-        test.add("D");
-        test.add("E");
+        test.add((E) "D");
+        test.add((E) "E");
         assertEquals(4, test.buffer.length);
         assertEquals(2, test.head);
         assertEquals(1, test.tail);
         
-        Iterator it = test.iterator();
+        Iterator<E> it = test.iterator();
         assertEquals("C", it.next());
         assertEquals("D", it.next());
         it.remove();
@@ -389,20 +401,21 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
         assertEquals(0, test.tail);
     }
 
+    @SuppressWarnings("unchecked")
     public void testInternalStateIteratorRemoveWithWrap3() {
-        UnboundedFifoBuffer test = new UnboundedFifoBuffer(3);
-        test.add("A");
-        test.add("B");
-        test.add("C");
+        UnboundedFifoBuffer<E> test = new UnboundedFifoBuffer<E>(3);
+        test.add((E) "A");
+        test.add((E) "B");
+        test.add((E) "C");
         test.remove("A");
         test.remove("B");
-        test.add("D");
-        test.add("E");
+        test.add((E) "D");
+        test.add((E) "E");
         assertEquals(4, test.buffer.length);
         assertEquals(2, test.head);
         assertEquals(1, test.tail);
         
-        Iterator it = test.iterator();
+        Iterator<E> it = test.iterator();
         assertEquals("C", it.next());
         assertEquals("D", it.next());
         assertEquals("E", it.next());
@@ -424,4 +437,19 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
 //        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/UnboundedFifoBuffer.fullCollection.version3.1.obj");
 //    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public UnboundedFifoBuffer<E> getCollection() {
+        return (UnboundedFifoBuffer<E>) super.getCollection();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public List<E> getConfirmed() {
+        return (List<E>) super.getConfirmed();
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/buffer/TestUnmodifiableBuffer.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/buffer/TestUnmodifiableBuffer.java b/src/test/org/apache/commons/collections/buffer/TestUnmodifiableBuffer.java
index 94b21f9..538dc8a 100644
--- a/src/test/org/apache/commons/collections/buffer/TestUnmodifiableBuffer.java
+++ b/src/test/org/apache/commons/collections/buffer/TestUnmodifiableBuffer.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.
@@ -27,48 +27,47 @@ import org.apache.commons.collections.Buffer;
 import org.apache.commons.collections.collection.AbstractTestCollection;
 
 /**
- * Extension of {@link AbstractTestCollection} for exercising the 
+ * Extension of {@link AbstractTestCollection} for exercising the
  * {@link UnmodifiableBuffer} implementation.
  *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  * @author Stephen Colebourne
  */
-public class TestUnmodifiableBuffer extends AbstractTestCollection {
-    
+public class TestUnmodifiableBuffer<E> extends AbstractTestCollection<E> {
+
     public TestUnmodifiableBuffer(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return new TestSuite(TestUnmodifiableBuffer.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestUnmodifiableBuffer.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    //-----------------------------------------------------------------------    
-    public Collection makeCollection() {
-        return UnmodifiableBuffer.decorate(new UnboundedFifoBuffer());
+    //-----------------------------------------------------------------------
+    public Collection<E> makeObject() {
+        return UnmodifiableBuffer.decorate(new UnboundedFifoBuffer<E>());
     }
-    
-    public Collection makeFullCollection() {
-        Buffer buffer = new UnboundedFifoBuffer();
+
+    public Collection<E> makeFullCollection() {
+        Buffer<E> buffer = new UnboundedFifoBuffer<E>();
         buffer.addAll(Arrays.asList(getFullElements()));
         return UnmodifiableBuffer.decorate(buffer);
     }
-    
-    public Collection makeConfirmedCollection() {
-        ArrayStack list = new ArrayStack();
-        return list;
+
+    public Collection<E> makeConfirmedCollection() {
+        return new ArrayStack<E>();
     }
 
-    public Collection makeConfirmedFullCollection() {
-        ArrayStack list = new ArrayStack();
+    public Collection<E> makeConfirmedFullCollection() {
+        ArrayStack<E> list = new ArrayStack<E>();
         list.addAll(Arrays.asList(getFullElements()));
         return list;
     }
@@ -76,20 +75,19 @@ public class TestUnmodifiableBuffer extends AbstractTestCollection {
     public boolean isAddSupported() {
         return false;
     }
-    
+
     public boolean isRemoveSupported() {
         return false;
     }
-    
+
     public boolean isNullSupported() {
         return false;
     }
-    
+
     public void testBufferRemove() {
         resetEmpty();
-        Buffer buffer = (Buffer) collection;
         try {
-            buffer.remove();
+            getCollection().remove();
             fail();
         } catch (UnsupportedOperationException ex) {}
     }
@@ -105,4 +103,11 @@ public class TestUnmodifiableBuffer extends AbstractTestCollection {
 //        writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/UnmodifiableBuffer.fullCollection.version3.1.obj");
 //    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Buffer<E> getCollection() {
+        return (Buffer<E>) super.getCollection();
+    }
 }


[73/77] [abbrv] commons-collections git commit: Replacing '^ \* $' with '^ \*$' - to help with merging to trunk

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/bidimap/DualHashBidiMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bidimap/DualHashBidiMap.java b/src/java/org/apache/commons/collections/bidimap/DualHashBidiMap.java
index b0927aa..59722c7 100644
--- a/src/java/org/apache/commons/collections/bidimap/DualHashBidiMap.java
+++ b/src/java/org/apache/commons/collections/bidimap/DualHashBidiMap.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.
@@ -35,10 +35,10 @@ import org.apache.commons.collections.BidiMap;
  * <p>
  * NOTE: From Commons Collections 3.1, all subclasses will use <code>HashMap</code>
  * and the flawed <code>createMap</code> method is ignored.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Id$
- * 
+ *
  * @author Matthew Hawthorne
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java b/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java
index 90b4ad2..9ec65bc 100644
--- a/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java
+++ b/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.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.
@@ -27,7 +27,7 @@ import org.apache.commons.collections.collection.AbstractCollectionDecorator;
  * @param <E> the type of the elements in the buffer
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public abstract class AbstractBufferDecorator<E> extends AbstractCollectionDecorator<E> implements

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java b/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java
index 362ef6a..8c17f0c 100644
--- a/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java
+++ b/src/java/org/apache/commons/collections/buffer/BlockingBuffer.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/buffer/BoundedBuffer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/buffer/BoundedBuffer.java b/src/java/org/apache/commons/collections/buffer/BoundedBuffer.java
index fc92c3e..22f7a24 100644
--- a/src/java/org/apache/commons/collections/buffer/BoundedBuffer.java
+++ b/src/java/org/apache/commons/collections/buffer/BoundedBuffer.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/buffer/PredicatedBuffer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/buffer/PredicatedBuffer.java b/src/java/org/apache/commons/collections/buffer/PredicatedBuffer.java
index 8c97b5a..566283f 100644
--- a/src/java/org/apache/commons/collections/buffer/PredicatedBuffer.java
+++ b/src/java/org/apache/commons/collections/buffer/PredicatedBuffer.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.
@@ -35,7 +35,7 @@ import org.apache.commons.collections.collection.PredicatedCollection;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Paul Jack
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/buffer/PriorityBuffer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/buffer/PriorityBuffer.java b/src/java/org/apache/commons/collections/buffer/PriorityBuffer.java
index f6b6e90..66d66d0 100644
--- a/src/java/org/apache/commons/collections/buffer/PriorityBuffer.java
+++ b/src/java/org/apache/commons/collections/buffer/PriorityBuffer.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.
@@ -55,7 +55,7 @@ import org.apache.commons.collections.comparators.ComparableComparator;
  *
  * @since Commons Collections 3.0 (previously BinaryHeap v1.0)
  * @version $Revision$ $Date$
- * 
+ *
  * @author Peter Donald
  * @author Ram Chidambaram
  * @author Michael A. Smith

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/buffer/SynchronizedBuffer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/buffer/SynchronizedBuffer.java b/src/java/org/apache/commons/collections/buffer/SynchronizedBuffer.java
index 460c9b8..ddf357f 100644
--- a/src/java/org/apache/commons/collections/buffer/SynchronizedBuffer.java
+++ b/src/java/org/apache/commons/collections/buffer/SynchronizedBuffer.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,7 +30,7 @@ import org.apache.commons.collections.collection.SynchronizedCollection;
  * @param <E> the type of the elements in the buffer
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class SynchronizedBuffer<E>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/buffer/TransformedBuffer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/buffer/TransformedBuffer.java b/src/java/org/apache/commons/collections/buffer/TransformedBuffer.java
index c8ba28e..8dc4a4c 100644
--- a/src/java/org/apache/commons/collections/buffer/TransformedBuffer.java
+++ b/src/java/org/apache/commons/collections/buffer/TransformedBuffer.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.
@@ -32,7 +32,7 @@ import org.apache.commons.collections.collection.TransformedCollection;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TransformedBuffer<E> extends TransformedCollection<E> implements Buffer<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java b/src/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java
index a4799ef..1061751 100644
--- a/src/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java
+++ b/src/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.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.
@@ -34,7 +34,7 @@ import org.apache.commons.collections.iterators.UnmodifiableIterator;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public final class UnmodifiableBuffer<E>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/collection/AbstractCollectionDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/collection/AbstractCollectionDecorator.java b/src/java/org/apache/commons/collections/collection/AbstractCollectionDecorator.java
index a0727f7..7e2f3e2 100644
--- a/src/java/org/apache/commons/collections/collection/AbstractCollectionDecorator.java
+++ b/src/java/org/apache/commons/collections/collection/AbstractCollectionDecorator.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.
@@ -38,7 +38,7 @@ import java.util.Iterator;
  * @param <E> the type of the elements in the collection
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Paul Jack
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/collection/AbstractUntypedCollectionDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/collection/AbstractUntypedCollectionDecorator.java b/src/java/org/apache/commons/collections/collection/AbstractUntypedCollectionDecorator.java
index c67394c..6bc76c6 100644
--- a/src/java/org/apache/commons/collections/collection/AbstractUntypedCollectionDecorator.java
+++ b/src/java/org/apache/commons/collections/collection/AbstractUntypedCollectionDecorator.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.
@@ -35,12 +35,12 @@ import java.util.Collection;
  * {@link #iterator()}. Instead it simply returns the value from the wrapped
  * collection. This may be undesirable, for example if you are trying to write
  * an unmodifiable implementation it might provide a loophole.
- * 
+ *
  * @param <D> the type of the elements in the decorated collection
  * @param <E> the element type of the Collection implementation
  * @since Commons Collections 5
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Paul Jack
  * @author Matt Benson

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/collection/PredicatedCollection.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/collection/PredicatedCollection.java b/src/java/org/apache/commons/collections/collection/PredicatedCollection.java
index 0a0a3f4..c52be26 100644
--- a/src/java/org/apache/commons/collections/collection/PredicatedCollection.java
+++ b/src/java/org/apache/commons/collections/collection/PredicatedCollection.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.
@@ -36,7 +36,7 @@ import org.apache.commons.collections.Predicate;
  * @param <E> the type of the elements in the collection
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Paul Jack
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/collection/SynchronizedCollection.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/collection/SynchronizedCollection.java b/src/java/org/apache/commons/collections/collection/SynchronizedCollection.java
index ff9fdcf..c2dc64a 100644
--- a/src/java/org/apache/commons/collections/collection/SynchronizedCollection.java
+++ b/src/java/org/apache/commons/collections/collection/SynchronizedCollection.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.
@@ -37,7 +37,7 @@ import java.util.Iterator;
  * @param <E> the type of the elements in the collection
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class SynchronizedCollection<E> implements Collection<E>, Serializable {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/collection/TransformedCollection.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/collection/TransformedCollection.java b/src/java/org/apache/commons/collections/collection/TransformedCollection.java
index 7aaa7a3..534d614 100644
--- a/src/java/org/apache/commons/collections/collection/TransformedCollection.java
+++ b/src/java/org/apache/commons/collections/collection/TransformedCollection.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.
@@ -35,7 +35,7 @@ import org.apache.commons.collections.Transformer;
  * @param <E> the type of the elements in the collection
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TransformedCollection<E> extends AbstractCollectionDecorator<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/collection/UnmodifiableCollection.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/collection/UnmodifiableCollection.java b/src/java/org/apache/commons/collections/collection/UnmodifiableCollection.java
index 44978ce..299d4c5 100644
--- a/src/java/org/apache/commons/collections/collection/UnmodifiableCollection.java
+++ b/src/java/org/apache/commons/collections/collection/UnmodifiableCollection.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,7 +30,7 @@ import org.apache.commons.collections.iterators.UnmodifiableIterator;
  * @param <E> the type of the elements in the collection
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public final class UnmodifiableCollection<E>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/comparators/BooleanComparator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/comparators/BooleanComparator.java b/src/java/org/apache/commons/collections/comparators/BooleanComparator.java
index 0efd38f..cf4bf82 100644
--- a/src/java/org/apache/commons/collections/comparators/BooleanComparator.java
+++ b/src/java/org/apache/commons/collections/comparators/BooleanComparator.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.
@@ -26,10 +26,10 @@ import java.util.Comparator;
  * @see #getTrueFirstComparator()
  * @see #getFalseFirstComparator()
  * @see #getBooleanComparator(boolean)
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Rodney Waldhoff
  */
 public final class BooleanComparator implements Comparator<Boolean>, Serializable {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/comparators/ComparableComparator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/comparators/ComparableComparator.java b/src/java/org/apache/commons/collections/comparators/ComparableComparator.java
index 6cac25c..0430b94 100644
--- a/src/java/org/apache/commons/collections/comparators/ComparableComparator.java
+++ b/src/java/org/apache/commons/collections/comparators/ComparableComparator.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/comparators/NullComparator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/comparators/NullComparator.java b/src/java/org/apache/commons/collections/comparators/NullComparator.java
index 3262426..1334ea4 100644
--- a/src/java/org/apache/commons/collections/comparators/NullComparator.java
+++ b/src/java/org/apache/commons/collections/comparators/NullComparator.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/comparators/ReverseComparator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/comparators/ReverseComparator.java b/src/java/org/apache/commons/collections/comparators/ReverseComparator.java
index a28ead1..71f130f 100644
--- a/src/java/org/apache/commons/collections/comparators/ReverseComparator.java
+++ b/src/java/org/apache/commons/collections/comparators/ReverseComparator.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 org.apache.commons.collections.ComparatorUtils;
 /**
  * Reverses the order of another comparator by reversing the arguments
  * to its {@link #compare(Object, Object) compare} method.
- * 
+ *
  * @since Commons Collections 2.0
  * @version $Revision$ $Date$
  *
  * @author Henri Yandell
  * @author Michael A. Smith
- * 
+ *
  * @see java.util.Collections#reverseOrder()
  */
 public class ReverseComparator<E> implements Comparator<E>, Serializable {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/comparators/TransformingComparator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/comparators/TransformingComparator.java b/src/java/org/apache/commons/collections/comparators/TransformingComparator.java
index 62ba50c..6b0ee81 100644
--- a/src/java/org/apache/commons/collections/comparators/TransformingComparator.java
+++ b/src/java/org/apache/commons/collections/comparators/TransformingComparator.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.
@@ -25,10 +25,10 @@ import org.apache.commons.collections.Transformer;
  * Decorates another Comparator with transformation behavior. That is, the
  * return value from the transform operation will be passed to the decorated
  * {@link Comparator#compare(Object,Object) compare} method.
- * 
+ *
  * @since Commons Collections 2.0 (?)
  * @version $Revision$ $Date$
- * 
+ *
  * @see org.apache.commons.collections.Transformer
  * @see org.apache.commons.collections.comparators.ComparableComparator
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/AllPredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/AllPredicate.java b/src/java/org/apache/commons/collections/functors/AllPredicate.java
index edde7e9..e1fec84 100644
--- a/src/java/org/apache/commons/collections/functors/AllPredicate.java
+++ b/src/java/org/apache/commons/collections/functors/AllPredicate.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/ChainedClosure.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/ChainedClosure.java b/src/java/org/apache/commons/collections/functors/ChainedClosure.java
index bf2c476..c5f3736 100644
--- a/src/java/org/apache/commons/collections/functors/ChainedClosure.java
+++ b/src/java/org/apache/commons/collections/functors/ChainedClosure.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,7 @@ import org.apache.commons.collections.Closure;
 
 /**
  * Closure implementation that chains the specified closures together.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/ChainedTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/ChainedTransformer.java b/src/java/org/apache/commons/collections/functors/ChainedTransformer.java
index ca69f45..35c9296 100644
--- a/src/java/org/apache/commons/collections/functors/ChainedTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/ChainedTransformer.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.
@@ -26,7 +26,7 @@ import org.apache.commons.collections.Transformer;
  * <p>
  * The input object is passed to the first transformer. The transformed result
  * is passed to the second transformer and so on.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/CloneTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/CloneTransformer.java b/src/java/org/apache/commons/collections/functors/CloneTransformer.java
index e17888d..2900f7a 100644
--- a/src/java/org/apache/commons/collections/functors/CloneTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/CloneTransformer.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,7 +24,7 @@ import org.apache.commons.collections.Transformer;
  * Transformer implementation that returns a clone of the input object.
  * <p>
  * Clone is performed using <code>PrototypeFactory.getInstance(input).create()</code>.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/ClosureTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/ClosureTransformer.java b/src/java/org/apache/commons/collections/functors/ClosureTransformer.java
index e55685e..e54ce63 100644
--- a/src/java/org/apache/commons/collections/functors/ClosureTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/ClosureTransformer.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,7 +24,7 @@ import org.apache.commons.collections.Transformer;
 /**
  * Transformer implementation that calls a Closure using the input object
  * and then returns the input.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/ConstantFactory.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/ConstantFactory.java b/src/java/org/apache/commons/collections/functors/ConstantFactory.java
index ef7fea9..bf4a7ac 100644
--- a/src/java/org/apache/commons/collections/functors/ConstantFactory.java
+++ b/src/java/org/apache/commons/collections/functors/ConstantFactory.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.
@@ -26,7 +26,7 @@ import org.apache.commons.collections.Factory;
  * No check is made that the object is immutable. In general, only immutable
  * objects should use the constant factory. Mutable objects should
  * use the prototype factory.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/ConstantTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/ConstantTransformer.java b/src/java/org/apache/commons/collections/functors/ConstantTransformer.java
index bd748bd..d660b41 100644
--- a/src/java/org/apache/commons/collections/functors/ConstantTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/ConstantTransformer.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.
@@ -26,7 +26,7 @@ import org.apache.commons.collections.Transformer;
  * No check is made that the object is immutable. In general, only immutable
  * objects should use the constant factory. Mutable objects should
  * use the prototype factory.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/EqualPredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/EqualPredicate.java b/src/java/org/apache/commons/collections/functors/EqualPredicate.java
index 231a235..f9d63f1 100644
--- a/src/java/org/apache/commons/collections/functors/EqualPredicate.java
+++ b/src/java/org/apache/commons/collections/functors/EqualPredicate.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.
@@ -25,7 +25,7 @@ import org.apache.commons.collections.Predicate;
 /**
  * Predicate implementation that returns true if the input is the same object
  * as the one stored in this predicate by equals.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/ExceptionClosure.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/ExceptionClosure.java b/src/java/org/apache/commons/collections/functors/ExceptionClosure.java
index b5f73a9..755e4a7 100644
--- a/src/java/org/apache/commons/collections/functors/ExceptionClosure.java
+++ b/src/java/org/apache/commons/collections/functors/ExceptionClosure.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,7 @@ import org.apache.commons.collections.FunctorException;
 
 /**
  * Closure implementation that always throws an exception.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/ExceptionFactory.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/ExceptionFactory.java b/src/java/org/apache/commons/collections/functors/ExceptionFactory.java
index 56d54ef..aa8e022 100644
--- a/src/java/org/apache/commons/collections/functors/ExceptionFactory.java
+++ b/src/java/org/apache/commons/collections/functors/ExceptionFactory.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,7 @@ import org.apache.commons.collections.FunctorException;
 
 /**
  * Factory implementation that always throws an exception.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/FactoryTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/FactoryTransformer.java b/src/java/org/apache/commons/collections/functors/FactoryTransformer.java
index 340aa00..0988d85 100644
--- a/src/java/org/apache/commons/collections/functors/FactoryTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/FactoryTransformer.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,7 @@ import org.apache.commons.collections.Transformer;
 
 /**
  * Transformer implementation that calls a Factory and returns the result.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/ForClosure.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/ForClosure.java b/src/java/org/apache/commons/collections/functors/ForClosure.java
index b77ed5e..f9abcba 100644
--- a/src/java/org/apache/commons/collections/functors/ForClosure.java
+++ b/src/java/org/apache/commons/collections/functors/ForClosure.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.
@@ -22,7 +22,7 @@ import org.apache.commons.collections.Closure;
 
 /**
  * Closure implementation that calls another closure n times, like a for loop.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/IfClosure.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/IfClosure.java b/src/java/org/apache/commons/collections/functors/IfClosure.java
index 151874a..733af13 100644
--- a/src/java/org/apache/commons/collections/functors/IfClosure.java
+++ b/src/java/org/apache/commons/collections/functors/IfClosure.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,7 +24,7 @@ import org.apache.commons.collections.Predicate;
 /**
  * Closure implementation acts as an if statement calling one or other closure
  * based on a predicate.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/InstantiateFactory.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/InstantiateFactory.java b/src/java/org/apache/commons/collections/functors/InstantiateFactory.java
index a09c580..277c62c 100644
--- a/src/java/org/apache/commons/collections/functors/InstantiateFactory.java
+++ b/src/java/org/apache/commons/collections/functors/InstantiateFactory.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.
@@ -25,7 +25,7 @@ import org.apache.commons.collections.FunctorException;
 
 /**
  * Factory implementation that creates a new object instance by reflection.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/InvokerTransformer.java b/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
index 0ab3dbb..b3a2294 100644
--- a/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/InvokerTransformer.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.
@@ -25,7 +25,7 @@ import org.apache.commons.collections.Transformer;
 
 /**
  * Transformer implementation that creates a new object instance by reflection.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/NOPClosure.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/NOPClosure.java b/src/java/org/apache/commons/collections/functors/NOPClosure.java
index 3fa08c2..c844319 100644
--- a/src/java/org/apache/commons/collections/functors/NOPClosure.java
+++ b/src/java/org/apache/commons/collections/functors/NOPClosure.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.
@@ -22,7 +22,7 @@ import org.apache.commons.collections.Closure;
 
 /**
  * Closure implementation that does nothing.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/NOPTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/NOPTransformer.java b/src/java/org/apache/commons/collections/functors/NOPTransformer.java
index a21e44a..eedf67e 100644
--- a/src/java/org/apache/commons/collections/functors/NOPTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/NOPTransformer.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.
@@ -22,7 +22,7 @@ import org.apache.commons.collections.Transformer;
 
 /**
  * Transformer implementation that does nothing.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/NotNullPredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/NotNullPredicate.java b/src/java/org/apache/commons/collections/functors/NotNullPredicate.java
index 218ad82..545265b 100644
--- a/src/java/org/apache/commons/collections/functors/NotNullPredicate.java
+++ b/src/java/org/apache/commons/collections/functors/NotNullPredicate.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.
@@ -22,7 +22,7 @@ import org.apache.commons.collections.Predicate;
 
 /**
  * Predicate implementation that returns true if the input is not null.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/NotPredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/NotPredicate.java b/src/java/org/apache/commons/collections/functors/NotPredicate.java
index 5bc171b..4f32af3 100644
--- a/src/java/org/apache/commons/collections/functors/NotPredicate.java
+++ b/src/java/org/apache/commons/collections/functors/NotPredicate.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.
@@ -22,7 +22,7 @@ import org.apache.commons.collections.Predicate;
 
 /**
  * Predicate implementation that returns the opposite of the decorated predicate.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/NullIsExceptionPredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/NullIsExceptionPredicate.java b/src/java/org/apache/commons/collections/functors/NullIsExceptionPredicate.java
index d8269fa..e9635f3 100644
--- a/src/java/org/apache/commons/collections/functors/NullIsExceptionPredicate.java
+++ b/src/java/org/apache/commons/collections/functors/NullIsExceptionPredicate.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,7 @@ import org.apache.commons.collections.Predicate;
 
 /**
  * Predicate implementation that throws an exception if the input is null.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/NullIsTruePredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/NullIsTruePredicate.java b/src/java/org/apache/commons/collections/functors/NullIsTruePredicate.java
index 0ba668f..e7160a3 100644
--- a/src/java/org/apache/commons/collections/functors/NullIsTruePredicate.java
+++ b/src/java/org/apache/commons/collections/functors/NullIsTruePredicate.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.
@@ -22,7 +22,7 @@ import org.apache.commons.collections.Predicate;
 
 /**
  * Predicate implementation that returns true if the input is null.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/NullPredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/NullPredicate.java b/src/java/org/apache/commons/collections/functors/NullPredicate.java
index 4f28165..6fa409a 100644
--- a/src/java/org/apache/commons/collections/functors/NullPredicate.java
+++ b/src/java/org/apache/commons/collections/functors/NullPredicate.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.
@@ -22,7 +22,7 @@ import org.apache.commons.collections.Predicate;
 
 /**
  * Predicate implementation that returns true if the input is null.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/OnePredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/OnePredicate.java b/src/java/org/apache/commons/collections/functors/OnePredicate.java
index 5f3252e..83fe864 100644
--- a/src/java/org/apache/commons/collections/functors/OnePredicate.java
+++ b/src/java/org/apache/commons/collections/functors/OnePredicate.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/PredicateDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/PredicateDecorator.java b/src/java/org/apache/commons/collections/functors/PredicateDecorator.java
index 9e61b92..00ea158 100644
--- a/src/java/org/apache/commons/collections/functors/PredicateDecorator.java
+++ b/src/java/org/apache/commons/collections/functors/PredicateDecorator.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.
@@ -22,10 +22,10 @@ import org.apache.commons.collections.Predicate;
  * Defines a predicate that decorates one or more other predicates.
  * <p>
  * This interface enables tools to access the decorated predicates.
- * 
+ *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Stephen Kestle
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/PredicateTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/PredicateTransformer.java b/src/java/org/apache/commons/collections/functors/PredicateTransformer.java
index ca8c93b..ee747d2 100644
--- a/src/java/org/apache/commons/collections/functors/PredicateTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/PredicateTransformer.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,7 +24,7 @@ import org.apache.commons.collections.Transformer;
 /**
  * Transformer implementation that calls a Predicate using the input object
  * and then returns the result.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/PrototypeFactory.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/PrototypeFactory.java b/src/java/org/apache/commons/collections/functors/PrototypeFactory.java
index c23d584..6726fde 100644
--- a/src/java/org/apache/commons/collections/functors/PrototypeFactory.java
+++ b/src/java/org/apache/commons/collections/functors/PrototypeFactory.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,7 +30,7 @@ import org.apache.commons.collections.FunctorException;
 
 /**
  * Factory implementation that creates a new instance each time based on a prototype.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/StringValueTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/StringValueTransformer.java b/src/java/org/apache/commons/collections/functors/StringValueTransformer.java
index 3e54967..fb27dfe 100644
--- a/src/java/org/apache/commons/collections/functors/StringValueTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/StringValueTransformer.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/SwitchTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/SwitchTransformer.java b/src/java/org/apache/commons/collections/functors/SwitchTransformer.java
index 3e62247..0fc71cc 100644
--- a/src/java/org/apache/commons/collections/functors/SwitchTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/SwitchTransformer.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.
@@ -25,7 +25,7 @@ import org.apache.commons.collections.Transformer;
 /**
  * Transformer implementation calls the transformer whose predicate returns true,
  * like a switch statement.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/TransformerClosure.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/TransformerClosure.java b/src/java/org/apache/commons/collections/functors/TransformerClosure.java
index 614b194..79c41bb 100644
--- a/src/java/org/apache/commons/collections/functors/TransformerClosure.java
+++ b/src/java/org/apache/commons/collections/functors/TransformerClosure.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,7 +24,7 @@ import org.apache.commons.collections.Transformer;
 /**
  * Closure implementation that calls a Transformer using the input object
  * and ignore the result.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/TruePredicate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/TruePredicate.java b/src/java/org/apache/commons/collections/functors/TruePredicate.java
index 3cdf80d..fa6bd57 100644
--- a/src/java/org/apache/commons/collections/functors/TruePredicate.java
+++ b/src/java/org/apache/commons/collections/functors/TruePredicate.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.
@@ -22,7 +22,7 @@ import org.apache.commons.collections.Predicate;
 
 /**
  * Predicate implementation that always returns true.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/functors/WhileClosure.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/WhileClosure.java b/src/java/org/apache/commons/collections/functors/WhileClosure.java
index 9970809..a1bf7cb 100644
--- a/src/java/org/apache/commons/collections/functors/WhileClosure.java
+++ b/src/java/org/apache/commons/collections/functors/WhileClosure.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,7 +24,7 @@ import org.apache.commons.collections.Predicate;
 /**
  * Closure implementation that executes a closure repeatedly until a condition is met,
  * like a do-while or while loop.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/AbstractEmptyIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/AbstractEmptyIterator.java b/src/java/org/apache/commons/collections/iterators/AbstractEmptyIterator.java
index 4546ddf..0f21ecd 100644
--- a/src/java/org/apache/commons/collections/iterators/AbstractEmptyIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/AbstractEmptyIterator.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,7 @@ import java.util.NoSuchElementException;
  *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 abstract class AbstractEmptyIterator<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/AbstractEmptyMapIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/AbstractEmptyMapIterator.java b/src/java/org/apache/commons/collections/iterators/AbstractEmptyMapIterator.java
index d59684b..d0cb3c2 100644
--- a/src/java/org/apache/commons/collections/iterators/AbstractEmptyMapIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/AbstractEmptyMapIterator.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.
@@ -21,7 +21,7 @@ package org.apache.commons.collections.iterators;
  *
  * @since Commons Collections 5
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Matt Benson
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/AbstractIteratorDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/AbstractIteratorDecorator.java b/src/java/org/apache/commons/collections/iterators/AbstractIteratorDecorator.java
index 2151ebc..9e0d359 100644
--- a/src/java/org/apache/commons/collections/iterators/AbstractIteratorDecorator.java
+++ b/src/java/org/apache/commons/collections/iterators/AbstractIteratorDecorator.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.
@@ -25,7 +25,7 @@ import java.util.Iterator;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author James Strachan
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/AbstractListIteratorDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/AbstractListIteratorDecorator.java b/src/java/org/apache/commons/collections/iterators/AbstractListIteratorDecorator.java
index f30c9ef..90332dc 100644
--- a/src/java/org/apache/commons/collections/iterators/AbstractListIteratorDecorator.java
+++ b/src/java/org/apache/commons/collections/iterators/AbstractListIteratorDecorator.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.
@@ -25,7 +25,7 @@ import java.util.ListIterator;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Rodney Waldhoff
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/AbstractMapIteratorDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/AbstractMapIteratorDecorator.java b/src/java/org/apache/commons/collections/iterators/AbstractMapIteratorDecorator.java
index f728680..76b7c6d 100644
--- a/src/java/org/apache/commons/collections/iterators/AbstractMapIteratorDecorator.java
+++ b/src/java/org/apache/commons/collections/iterators/AbstractMapIteratorDecorator.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.
@@ -25,7 +25,7 @@ import org.apache.commons.collections.MapIterator;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class AbstractMapIteratorDecorator<K, V> implements MapIterator<K, V> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/AbstractOrderedMapIteratorDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/AbstractOrderedMapIteratorDecorator.java b/src/java/org/apache/commons/collections/iterators/AbstractOrderedMapIteratorDecorator.java
index 8f1d687..c1be869 100644
--- a/src/java/org/apache/commons/collections/iterators/AbstractOrderedMapIteratorDecorator.java
+++ b/src/java/org/apache/commons/collections/iterators/AbstractOrderedMapIteratorDecorator.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.
@@ -25,7 +25,7 @@ import org.apache.commons.collections.OrderedMapIterator;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class AbstractOrderedMapIteratorDecorator<K, V> implements OrderedMapIterator<K, V> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/AbstractUntypedIteratorDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/AbstractUntypedIteratorDecorator.java b/src/java/org/apache/commons/collections/iterators/AbstractUntypedIteratorDecorator.java
index 57ba89f..a7aa9d5 100644
--- a/src/java/org/apache/commons/collections/iterators/AbstractUntypedIteratorDecorator.java
+++ b/src/java/org/apache/commons/collections/iterators/AbstractUntypedIteratorDecorator.java
@@ -1,5 +1,5 @@
 /**
- * 
+ *
  */
 package org.apache.commons.collections.iterators;
 
@@ -10,10 +10,10 @@ import java.util.Iterator;
  * without committing the generic type of the Iterator implementation.
  * <p>
  * All methods are forwarded to the decorated iterator.
- * 
+ *
  * @since Commons Collections 5
  * @version $Revision$ $Date$
- * 
+ *
  * @author James Strachan
  * @author Stephen Colebourne
  * @author Matt Benson

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/ArrayIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/ArrayIterator.java b/src/java/org/apache/commons/collections/iterators/ArrayIterator.java
index 42e9528..e912d6a 100644
--- a/src/java/org/apache/commons/collections/iterators/ArrayIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/ArrayIterator.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java b/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java
index 55662d8..8a2d9f6 100644
--- a/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/ArrayListIterator.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.
@@ -28,7 +28,7 @@ import org.apache.commons.collections.ResettableListIterator;
  * The array can be either an array of object or of primitives. If you know 
  * that you have an object array, the {@link ObjectArrayListIterator}
  * class is a better choice, as it will perform better.
- * 
+ *
  * <p>
  * This iterator does not support {@link #add(Object)} or {@link #remove()}, as the array 
  * cannot be changed in size. The {@link #set(Object)} method is supported however.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/CollatingIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/CollatingIterator.java b/src/java/org/apache/commons/collections/iterators/CollatingIterator.java
index 9105e9e..998df64 100644
--- a/src/java/org/apache/commons/collections/iterators/CollatingIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/CollatingIterator.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,11 +33,11 @@ import org.apache.commons.collections.list.UnmodifiableList;
  * Given two ordered {@link Iterator} instances <code>A</code> and
  * <code>B</code>, the {@link #next} method on this iterator will return the
  * lesser of <code>A.next()</code> and <code>B.next()</code>.
- * 
+ *
  * @since Commons Collections 2.1
  * @version $Revision$ $Date: 2006-10-27 19:52:37 -0500 (Fri, 27 Oct
  * 2006) $
- * 
+ *
  * @author Rodney Waldhoff
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/EmptyIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/EmptyIterator.java b/src/java/org/apache/commons/collections/iterators/EmptyIterator.java
index 09614bd..c8657f3 100644
--- a/src/java/org/apache/commons/collections/iterators/EmptyIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/EmptyIterator.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,7 +29,7 @@ import org.apache.commons.collections.ResettableIterator;
  *
  * @since Commons Collections 2.1.1 and 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class EmptyIterator<E> extends AbstractEmptyIterator<E> implements ResettableIterator<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/EmptyListIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/EmptyListIterator.java b/src/java/org/apache/commons/collections/iterators/EmptyListIterator.java
index 4d702cb..a5ca6d2 100644
--- a/src/java/org/apache/commons/collections/iterators/EmptyListIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/EmptyListIterator.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.
@@ -26,11 +26,11 @@ import org.apache.commons.collections.ResettableListIterator;
  * This class provides an implementation of an empty list iterator. This class
  * provides for binary compatability between Commons Collections 2.1.1 and 3.1
  * due to issues with <code>IteratorUtils</code>.
- * 
+ *
  * @since Commons Collections 2.1.1 and 3.1
  * @version $Revision$ $Date: 2006-10-27 19:52:37 -0500 (Fri, 27 Oct
  * 2006) $
- * 
+ *
  * @author Stephen Colebourne
  */
 public class EmptyListIterator<E> extends AbstractEmptyIterator<E> implements

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/EmptyMapIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/EmptyMapIterator.java b/src/java/org/apache/commons/collections/iterators/EmptyMapIterator.java
index e8d5c39..507d5dc 100644
--- a/src/java/org/apache/commons/collections/iterators/EmptyMapIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/EmptyMapIterator.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,7 +24,7 @@ import org.apache.commons.collections.ResettableIterator;
  *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class EmptyMapIterator<K, V> extends AbstractEmptyMapIterator<K, V> implements

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/EmptyOrderedIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/EmptyOrderedIterator.java b/src/java/org/apache/commons/collections/iterators/EmptyOrderedIterator.java
index c90d816..35406f8 100644
--- a/src/java/org/apache/commons/collections/iterators/EmptyOrderedIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/EmptyOrderedIterator.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,7 +24,7 @@ import org.apache.commons.collections.ResettableIterator;
  *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class EmptyOrderedIterator<E> extends AbstractEmptyIterator<E> implements OrderedIterator<E>, ResettableIterator<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/EmptyOrderedMapIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/EmptyOrderedMapIterator.java b/src/java/org/apache/commons/collections/iterators/EmptyOrderedMapIterator.java
index 219982b..0f029dc 100644
--- a/src/java/org/apache/commons/collections/iterators/EmptyOrderedMapIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/EmptyOrderedMapIterator.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,7 +24,7 @@ import org.apache.commons.collections.ResettableIterator;
  *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class EmptyOrderedMapIterator<K, V> extends AbstractEmptyMapIterator<K, V> implements

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java b/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java
index 1d73050..da5ba73 100644
--- a/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/EntrySetMapIterator.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.


[38/77] [abbrv] commons-collections git commit: make all [collections] maps implement IterableMap

Posted by ch...@apache.org.
make all [collections] maps implement IterableMap

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@740150 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/04956211
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/04956211
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/04956211

Branch: refs/heads/collections_jdk5_branch
Commit: 049562110777529a3d4efba4b2197e3c29dc7935
Parents: bba9e0c
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Mon Feb 2 23:24:00 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Mon Feb 2 23:24:00 2009 +0000

----------------------------------------------------------------------
 .../apache/commons/collections/BoundedMap.java  |   4 +-
 .../apache/commons/collections/MapUtils.java    |  12 +--
 .../apache/commons/collections/MultiMap.java    |   3 +-
 .../collections/map/AbstractIterableMap.java    |  38 +++++++
 .../collections/map/AbstractMapDecorator.java   |  10 +-
 .../commons/collections/map/CompositeMap.java   |   2 +-
 .../commons/collections/map/DefaultedMap.java   |   3 +-
 .../map/EntrySetToMapIteratorAdapter.java       | 106 +++++++++++++++++++
 .../commons/collections/map/FixedSizeMap.java   |   3 +-
 .../commons/collections/map/PredicatedMap.java  |   3 +-
 .../collections/map/StaticBucketMap.java        |   2 +-
 .../commons/collections/map/TransformedMap.java |   3 +-
 .../bidimap/AbstractTestBidiMap.java            |   4 +-
 .../map/AbstractTestIterableMap.java            |   3 +
 .../collections/map/AbstractTestMap.java        |  20 ++++
 .../collections/map/TestCompositeMap.java       |   2 +-
 .../collections/map/TestDefaultedMap.java       |   5 +-
 .../collections/map/TestFixedSizeMap.java       |   8 +-
 .../commons/collections/map/TestLazyMap.java    |   2 +-
 .../collections/map/TestPredicatedMap.java      |   9 +-
 .../collections/map/TestStaticBucketMap.java    |  10 +-
 .../collections/map/TestTransformedMap.java     |   5 +-
 22 files changed, 223 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/04956211/src/java/org/apache/commons/collections/BoundedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/BoundedMap.java b/src/java/org/apache/commons/collections/BoundedMap.java
index 0a8123f..9f8ea67 100644
--- a/src/java/org/apache/commons/collections/BoundedMap.java
+++ b/src/java/org/apache/commons/collections/BoundedMap.java
@@ -16,8 +16,6 @@
  */
 package org.apache.commons.collections;
 
-import java.util.Map;
-
 /**
  * Defines a map that is bounded in size.
  * <p>
@@ -30,7 +28,7 @@ import java.util.Map;
  * 
  * @author Stephen Colebourne
  */
-public interface BoundedMap<K, V> extends Map<K, V> {
+public interface BoundedMap<K, V> extends IterableMap<K, V> {
 
     /**
      * Returns true if this map is full and no new elements can be added.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/04956211/src/java/org/apache/commons/collections/MapUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/MapUtils.java b/src/java/org/apache/commons/collections/MapUtils.java
index b3c33a9..ea017ff 100644
--- a/src/java/org/apache/commons/collections/MapUtils.java
+++ b/src/java/org/apache/commons/collections/MapUtils.java
@@ -1270,7 +1270,7 @@ public class MapUtils {
      * @return a predicated map backed by the given map
      * @throws IllegalArgumentException  if the Map is null
      */
-    public static <K, V> Map<K, V> predicatedMap(Map<K, V> map, Predicate<? super K> keyPred, Predicate<? super V> valuePred) {
+    public static <K, V> IterableMap<K, V> predicatedMap(Map<K, V> map, Predicate<? super K> keyPred, Predicate<? super V> valuePred) {
         return PredicatedMap.decorate(map, keyPred, valuePred);
     }
 
@@ -1295,7 +1295,7 @@ public class MapUtils {
      * @return a transformed map backed by the given map
      * @throws IllegalArgumentException  if the Map is null
      */
-    public static <K, V> Map<K, V> transformedMap(Map<K, V> map,
+    public static <K, V> IterableMap<K, V> transformedMap(Map<K, V> map,
             Transformer<? super K, ? extends K> keyTransformer,
             Transformer<? super V, ? extends V> valueTransformer) {
         return TransformedMap.decorate(map, keyTransformer, valueTransformer);
@@ -1311,7 +1311,7 @@ public class MapUtils {
      * @return a fixed-size map backed by that map
      * @throws IllegalArgumentException  if the Map is null
      */
-    public static <K, V> Map<K, V> fixedSizeMap(Map<K, V> map) {
+    public static <K, V> IterableMap<K, V> fixedSizeMap(Map<K, V> map) {
         return FixedSizeMap.decorate(map);
     }
 
@@ -1343,7 +1343,7 @@ public class MapUtils {
      * @return a lazy map backed by the given map
      * @throws IllegalArgumentException  if the Map or Factory is null
      */
-    public static <K, V> Map<K, V> lazyMap(Map<K, V> map, Factory<? extends V> factory) {
+    public static <K, V> IterableMap<K, V> lazyMap(Map<K, V> map, Factory<? extends V> factory) {
         return LazyMap.getLazyMap(map, factory);
     }
 
@@ -1382,7 +1382,7 @@ public class MapUtils {
      * @return a lazy map backed by the given map
      * @throws IllegalArgumentException  if the Map or Transformer is null
      */
-    public static <K, V> Map<K, V> lazyMap(Map<K, V> map, Transformer<? super K, ? extends V> transformerFactory) {
+    public static <K, V> IterableMap<K, V> lazyMap(Map<K, V> map, Transformer<? super K, ? extends V> transformerFactory) {
         return LazyMap.getLazyMap(map, transformerFactory);
     }
 
@@ -1397,7 +1397,7 @@ public class MapUtils {
      * @return an ordered map backed by the given map
      * @throws IllegalArgumentException  if the Map is null
      */
-    public static <K, V> Map<K, V> orderedMap(Map<K, V> map) {
+    public static <K, V> IterableMap<K, V> orderedMap(Map<K, V> map) {
         return ListOrderedMap.decorate(map);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/04956211/src/java/org/apache/commons/collections/MultiMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/MultiMap.java b/src/java/org/apache/commons/collections/MultiMap.java
index 388b56a..2b7333e 100644
--- a/src/java/org/apache/commons/collections/MultiMap.java
+++ b/src/java/org/apache/commons/collections/MultiMap.java
@@ -17,7 +17,6 @@
 package org.apache.commons.collections;
 
 import java.util.Collection;
-import java.util.Map;
 
 /** 
  * Defines a map that holds a collection of values against each key.
@@ -47,7 +46,7 @@ import java.util.Map;
  * @author James Strachan
  * @author Stephen Colebourne
  */
-public interface MultiMap<K, V> extends Map<K, Object> {
+public interface MultiMap<K, V> extends IterableMap<K, Object> {
 
     /**
      * Removes a specific value from map.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/04956211/src/java/org/apache/commons/collections/map/AbstractIterableMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/AbstractIterableMap.java b/src/java/org/apache/commons/collections/map/AbstractIterableMap.java
new file mode 100644
index 0000000..2f812cb
--- /dev/null
+++ b/src/java/org/apache/commons/collections/map/AbstractIterableMap.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections.map;
+
+import org.apache.commons.collections.IterableMap;
+import org.apache.commons.collections.MapIterator;
+
+/**
+ * Provide a basic {@link IterableMap} implementation.
+ * @since Commons Collections 5
+ * @TODO fix version
+ * @version $Revision$ $Date$
+ * 
+ * @author Matt Benson
+ */
+public abstract class AbstractIterableMap<K, V> implements IterableMap<K, V> {
+
+    /**
+     * {@inheritDoc}
+     */
+    public MapIterator<K, V> mapIterator() {
+        return new EntrySetToMapIteratorAdapter<K, V>(entrySet());
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/04956211/src/java/org/apache/commons/collections/map/AbstractMapDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/AbstractMapDecorator.java b/src/java/org/apache/commons/collections/map/AbstractMapDecorator.java
index b9197cc..821dc95 100644
--- a/src/java/org/apache/commons/collections/map/AbstractMapDecorator.java
+++ b/src/java/org/apache/commons/collections/map/AbstractMapDecorator.java
@@ -20,6 +20,8 @@ import java.util.Collection;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.commons.collections.MapIterator;
+
 /**
  * Provides a base decorator that enables additional functionality to be added
  * to a Map via decoration.
@@ -41,7 +43,7 @@ import java.util.Set;
  * @author Daniel Rall
  * @author Stephen Colebourne
  */
-public abstract class AbstractMapDecorator<K, V> implements Map<K, V> {
+public abstract class AbstractMapDecorator<K, V> extends AbstractIterableMap<K, V> {
 
     /** The map to decorate */
     protected transient Map<K, V> map;
@@ -140,4 +142,10 @@ public abstract class AbstractMapDecorator<K, V> implements Map<K, V> {
         return decorated().toString();
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public MapIterator<K, V> mapIterator() {
+        return new EntrySetToMapIteratorAdapter<K, V>(entrySet());
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/04956211/src/java/org/apache/commons/collections/map/CompositeMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/CompositeMap.java b/src/java/org/apache/commons/collections/map/CompositeMap.java
index 264d7ec..432e492 100644
--- a/src/java/org/apache/commons/collections/map/CompositeMap.java
+++ b/src/java/org/apache/commons/collections/map/CompositeMap.java
@@ -42,7 +42,7 @@ import org.apache.commons.collections.set.CompositeSet;
  *
  * @author Brian McCallister
  */
-public class CompositeMap<K, V> implements Map<K, V> {
+public class CompositeMap<K, V> extends AbstractIterableMap<K, V> {
 
     /** Array of all maps in the composite */
     private Map<K, V>[] composite;

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/04956211/src/java/org/apache/commons/collections/map/DefaultedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/DefaultedMap.java b/src/java/org/apache/commons/collections/map/DefaultedMap.java
index 2ecd36e..010de2f 100644
--- a/src/java/org/apache/commons/collections/map/DefaultedMap.java
+++ b/src/java/org/apache/commons/collections/map/DefaultedMap.java
@@ -24,6 +24,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.commons.collections.Factory;
+import org.apache.commons.collections.IterableMap;
 import org.apache.commons.collections.Transformer;
 import org.apache.commons.collections.functors.ConstantTransformer;
 import org.apache.commons.collections.functors.FactoryTransformer;
@@ -95,7 +96,7 @@ public class DefaultedMap<K, V> extends AbstractMapDecorator<K, V> implements Se
      * @param factory  the factory to use to create entries, must not be null
      * @throws IllegalArgumentException if map or factory is null
      */
-    public static <K, V> Map<K, V> decorate(Map<K, V> map, Factory<? extends V> factory) {
+    public static <K, V> IterableMap<K, V> decorate(Map<K, V> map, Factory<? extends V> factory) {
         if (factory == null) {
             throw new IllegalArgumentException("Factory must not be null");
         }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/04956211/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.java b/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.java
new file mode 100644
index 0000000..a9d3f43
--- /dev/null
+++ b/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections.map;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.ResettableIterator;
+
+/**
+ * Adapts a Map entrySet to the MapIterator interface.
+ * 
+ * @since Commons Collections 5
+ * @TODO fix version
+ * @version $Revision$ $Date$
+ * 
+ * @author Matt Benson
+ */
+public class EntrySetToMapIteratorAdapter<K, V> implements MapIterator<K, V>, ResettableIterator<K> {
+    private Set<Map.Entry<K, V>> entrySet;
+
+    private transient Iterator<Map.Entry<K, V>> iterator;
+    private transient Map.Entry<K, V> entry;
+
+    /**
+     * Create a new EntrySetToMapIteratorAdapter.
+     */
+    public EntrySetToMapIteratorAdapter(Set<Map.Entry<K, V>> entrySet) {
+        this.entrySet = entrySet;
+        reset();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public K getKey() {
+        return current().getKey();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public V getValue() {
+        return current().getValue();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public V setValue(V value) {
+        return current().setValue(value);
+    };
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasNext() {
+        return iterator.hasNext();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public K next() {
+        entry = iterator.next();
+        return getKey();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public synchronized void reset() {
+        iterator = entrySet.iterator();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void remove() {
+        iterator.remove();
+        entry = null;
+    }
+
+    private synchronized Map.Entry<K, V> current() {
+        if (entry == null) {
+            throw new IllegalStateException();
+        }
+        return entry;
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/04956211/src/java/org/apache/commons/collections/map/FixedSizeMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/FixedSizeMap.java b/src/java/org/apache/commons/collections/map/FixedSizeMap.java
index 6c4ab3f..b293508 100644
--- a/src/java/org/apache/commons/collections/map/FixedSizeMap.java
+++ b/src/java/org/apache/commons/collections/map/FixedSizeMap.java
@@ -25,6 +25,7 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.commons.collections.BoundedMap;
+import org.apache.commons.collections.IterableMap;
 import org.apache.commons.collections.collection.UnmodifiableCollection;
 import org.apache.commons.collections.set.UnmodifiableSet;
 
@@ -68,7 +69,7 @@ public class FixedSizeMap<K, V>
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if map is null
      */
-    public static <K, V> Map<K, V> decorate(Map<K, V> map) {
+    public static <K, V> IterableMap<K, V> decorate(Map<K, V> map) {
         return new FixedSizeMap<K, V>(map);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/04956211/src/java/org/apache/commons/collections/map/PredicatedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/PredicatedMap.java b/src/java/org/apache/commons/collections/map/PredicatedMap.java
index 537fe35..eebce71 100644
--- a/src/java/org/apache/commons/collections/map/PredicatedMap.java
+++ b/src/java/org/apache/commons/collections/map/PredicatedMap.java
@@ -23,6 +23,7 @@ import java.io.Serializable;
 import java.util.Iterator;
 import java.util.Map;
 
+import org.apache.commons.collections.IterableMap;
 import org.apache.commons.collections.Predicate;
 
 /**
@@ -74,7 +75,7 @@ public class PredicatedMap<K, V>
      * @param valuePredicate  the predicate to validate to values, null means no check
      * @throws IllegalArgumentException if the map is null
      */
-    public static <K, V> Map<K, V> decorate(Map<K, V> map, Predicate<? super K> keyPredicate, Predicate<? super V> valuePredicate) {
+    public static <K, V> IterableMap<K, V> decorate(Map<K, V> map, Predicate<? super K> keyPredicate, Predicate<? super V> valuePredicate) {
         return new PredicatedMap<K, V>(map, keyPredicate, valuePredicate);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/04956211/src/java/org/apache/commons/collections/map/StaticBucketMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/StaticBucketMap.java b/src/java/org/apache/commons/collections/map/StaticBucketMap.java
index 7486d70..fa03680 100644
--- a/src/java/org/apache/commons/collections/map/StaticBucketMap.java
+++ b/src/java/org/apache/commons/collections/map/StaticBucketMap.java
@@ -101,7 +101,7 @@ import org.apache.commons.collections.KeyValue;
  * @author Janek Bogucki
  * @author Kazuya Ujihara
  */
-public final class StaticBucketMap<K, V> implements Map<K, V> {
+public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
 
     /** The default number of buckets to use */
     private static final int DEFAULT_BUCKETS = 255;

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/04956211/src/java/org/apache/commons/collections/map/TransformedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/TransformedMap.java b/src/java/org/apache/commons/collections/map/TransformedMap.java
index 4df0f2e..56741fd 100644
--- a/src/java/org/apache/commons/collections/map/TransformedMap.java
+++ b/src/java/org/apache/commons/collections/map/TransformedMap.java
@@ -22,6 +22,7 @@ import java.io.ObjectOutputStream;
 import java.io.Serializable;
 import java.util.Map;
 
+import org.apache.commons.collections.IterableMap;
 import org.apache.commons.collections.Transformer;
 
 /**
@@ -69,7 +70,7 @@ public class TransformedMap<K, V>
      * @param valueTransformer  the transformer to use for value conversion, null means no transformation
      * @throws IllegalArgumentException if map is null
      */
-    public static <K, V> Map<K, V> decorate(Map<K, V> map,
+    public static <K, V> IterableMap<K, V> decorate(Map<K, V> map,
             Transformer<? super K, ? extends K> keyTransformer,
             Transformer<? super V, ? extends V> valueTransformer) {
         return new TransformedMap<K, V>(map, keyTransformer, valueTransformer);

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/04956211/src/test/org/apache/commons/collections/bidimap/AbstractTestBidiMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/bidimap/AbstractTestBidiMap.java b/src/test/org/apache/commons/collections/bidimap/AbstractTestBidiMap.java
index 7f026db..148473d 100644
--- a/src/test/org/apache/commons/collections/bidimap/AbstractTestBidiMap.java
+++ b/src/test/org/apache/commons/collections/bidimap/AbstractTestBidiMap.java
@@ -26,7 +26,7 @@ import org.apache.commons.collections.BidiMap;
 import org.apache.commons.collections.BulkTest;
 import org.apache.commons.collections.MapIterator;
 import org.apache.commons.collections.iterators.AbstractTestMapIterator;
-import org.apache.commons.collections.map.AbstractTestMap;
+import org.apache.commons.collections.map.AbstractTestIterableMap;
 
 /**
  * Abstract test class for {@link BidiMap} methods and contracts.
@@ -36,7 +36,7 @@ import org.apache.commons.collections.map.AbstractTestMap;
  * @author Matthew Hawthorne
  * @author Stephen Colebourne
  */
-public abstract class AbstractTestBidiMap<K, V> extends AbstractTestMap<K, V> {
+public abstract class AbstractTestBidiMap<K, V> extends AbstractTestIterableMap<K, V> {
 
     public AbstractTestBidiMap(String testName) {
         super(testName);

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/04956211/src/test/org/apache/commons/collections/map/AbstractTestIterableMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/AbstractTestIterableMap.java b/src/test/org/apache/commons/collections/map/AbstractTestIterableMap.java
index 0e7b3e1..5213f93 100644
--- a/src/test/org/apache/commons/collections/map/AbstractTestIterableMap.java
+++ b/src/test/org/apache/commons/collections/map/AbstractTestIterableMap.java
@@ -60,6 +60,7 @@ public abstract class AbstractTestIterableMap<K, V> extends AbstractTestMap<K, V
     //-----------------------------------------------------------------------
     public void testFailFastEntrySet() {
         if (isRemoveSupported() == false) return;
+        if (isFailFastExpected() == false) return;
         resetFull();
         Iterator<Map.Entry<K, V>> it = getMap().entrySet().iterator();
         Map.Entry<K, V> val = it.next();
@@ -81,6 +82,7 @@ public abstract class AbstractTestIterableMap<K, V> extends AbstractTestMap<K, V
 
     public void testFailFastKeySet() {
         if (isRemoveSupported() == false) return;
+        if (isFailFastExpected() == false) return;
         resetFull();
         Iterator<K> it = getMap().keySet().iterator();
         K val = it.next();
@@ -102,6 +104,7 @@ public abstract class AbstractTestIterableMap<K, V> extends AbstractTestMap<K, V
 
     public void testFailFastValues() {
         if (isRemoveSupported() == false) return;
+        if (isFailFastExpected() == false) return;
         resetFull();
         Iterator<V> it = getMap().values().iterator();
         it.next();

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/04956211/src/test/org/apache/commons/collections/map/AbstractTestMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/AbstractTestMap.java b/src/test/org/apache/commons/collections/map/AbstractTestMap.java
index 47155f3..514f1cd 100644
--- a/src/test/org/apache/commons/collections/map/AbstractTestMap.java
+++ b/src/test/org/apache/commons/collections/map/AbstractTestMap.java
@@ -28,6 +28,7 @@ import java.util.Map.Entry;
 
 import org.apache.commons.collections.AbstractTestObject;
 import org.apache.commons.collections.BulkTest;
+import org.apache.commons.collections.IterableMap;
 import org.apache.commons.collections.collection.AbstractTestCollection;
 import org.apache.commons.collections.set.AbstractTestSet;
 
@@ -275,6 +276,18 @@ public abstract class AbstractTestMap<K, V> extends AbstractTestObject {
     }
 
     /**
+     * Returns true if the maps produced by
+     * {@link #makeEmptyMap()} and {@link #makeFullMap()}
+     * provide fail-fast behavior on their various iterators.
+     * <p>
+     * Default implementation returns true.
+     * Override if your collection class does not support fast failure.
+     */
+    public boolean isFailFastExpected() {
+        return true;
+    }
+
+    /**
      *  Returns the set of keys in the mappings used to test the map.  This
      *  method must return an array with the same length as {@link
      *  #getSampleValues()} and all array elements must be different. The
@@ -1701,6 +1714,13 @@ public abstract class AbstractTestMap<K, V> extends AbstractTestObject {
         assertTrue("Map's values should still equal HashMap's", test.isEmpty());
     }
 
+    /**
+     * All [collections] Map implementations should implement IterableMap.
+     */
+    public void testSubsetInterfaces() {
+        resetEmpty();
+        assertTrue(getMap() instanceof IterableMap);
+    }
 
     /**
      * Erases any leftover instance variables by setting them to null.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/04956211/src/test/org/apache/commons/collections/map/TestCompositeMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestCompositeMap.java b/src/test/org/apache/commons/collections/map/TestCompositeMap.java
index 7fd3e6e..0f89192 100644
--- a/src/test/org/apache/commons/collections/map/TestCompositeMap.java
+++ b/src/test/org/apache/commons/collections/map/TestCompositeMap.java
@@ -33,7 +33,7 @@ import java.util.Collection;
  *
  * @author Brian McCallister
  */
-public class TestCompositeMap<K, V> extends AbstractTestMap<K, V> {
+public class TestCompositeMap<K, V> extends AbstractTestIterableMap<K, V> {
     /** used as a flag in MapMutator tests */
     private boolean pass = false;
     

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/04956211/src/test/org/apache/commons/collections/map/TestDefaultedMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestDefaultedMap.java b/src/test/org/apache/commons/collections/map/TestDefaultedMap.java
index ac0576a..4f04930 100644
--- a/src/test/org/apache/commons/collections/map/TestDefaultedMap.java
+++ b/src/test/org/apache/commons/collections/map/TestDefaultedMap.java
@@ -24,6 +24,7 @@ import junit.framework.TestSuite;
 
 import org.apache.commons.collections.Factory;
 import org.apache.commons.collections.FactoryUtils;
+import org.apache.commons.collections.IterableMap;
 import org.apache.commons.collections.Transformer;
 import org.apache.commons.collections.functors.ConstantFactory;
 
@@ -36,7 +37,7 @@ import org.apache.commons.collections.functors.ConstantFactory;
  *
  * @author Stephen Colebourne
  */
-public class TestDefaultedMap<K, V> extends AbstractTestMap<K, V> {
+public class TestDefaultedMap<K, V> extends AbstractTestIterableMap<K, V> {
 
     protected final Factory<V> nullFactory = FactoryUtils.<V>nullFactory();
 
@@ -54,7 +55,7 @@ public class TestDefaultedMap<K, V> extends AbstractTestMap<K, V> {
     }
 
     //-----------------------------------------------------------------------
-    public Map<K, V> makeObject() {
+    public IterableMap<K, V> makeObject() {
         return DefaultedMap.decorate(new HashMap<K, V>(), nullFactory);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/04956211/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java b/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java
index e70bd7a..8ffb22c 100644
--- a/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java
+++ b/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java
@@ -19,6 +19,8 @@ package org.apache.commons.collections.map;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.commons.collections.IterableMap;
+
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
@@ -31,7 +33,7 @@ import junit.framework.TestSuite;
  *
  * @author Stephen Colebourne
  */
-public class TestFixedSizeMap<K, V> extends AbstractTestMap<K, V> {
+public class TestFixedSizeMap<K, V> extends AbstractTestIterableMap<K, V> {
 
     public TestFixedSizeMap(String testName) {
         super(testName);
@@ -46,11 +48,11 @@ public class TestFixedSizeMap<K, V> extends AbstractTestMap<K, V> {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Map<K, V> makeObject() {
+    public IterableMap<K, V> makeObject() {
         return FixedSizeMap.decorate(new HashMap<K, V>());
     }
 
-    public Map<K, V> makeFullMap() {
+    public IterableMap<K, V> makeFullMap() {
         Map<K, V> map = new HashMap<K, V>();
         addSampleMappings(map);
         return FixedSizeMap.decorate(map);

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/04956211/src/test/org/apache/commons/collections/map/TestLazyMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestLazyMap.java b/src/test/org/apache/commons/collections/map/TestLazyMap.java
index d3394fb..c7042b2 100644
--- a/src/test/org/apache/commons/collections/map/TestLazyMap.java
+++ b/src/test/org/apache/commons/collections/map/TestLazyMap.java
@@ -35,7 +35,7 @@ import org.junit.Test;
  *
  * @author Phil Steitz
  */
-public class TestLazyMap<K, V> extends AbstractTestMap<K, V> {
+public class TestLazyMap<K, V> extends AbstractTestIterableMap<K, V> {
 
 	private static final Factory<Integer> oneFactory = FactoryUtils.constantFactory(1);
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/04956211/src/test/org/apache/commons/collections/map/TestPredicatedMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestPredicatedMap.java b/src/test/org/apache/commons/collections/map/TestPredicatedMap.java
index 9edb140..99f6b79 100644
--- a/src/test/org/apache/commons/collections/map/TestPredicatedMap.java
+++ b/src/test/org/apache/commons/collections/map/TestPredicatedMap.java
@@ -23,6 +23,7 @@ import java.util.Map;
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
+import org.apache.commons.collections.IterableMap;
 import org.apache.commons.collections.Predicate;
 import org.apache.commons.collections.functors.TruePredicate;
 
@@ -35,7 +36,7 @@ import org.apache.commons.collections.functors.TruePredicate;
  *
  * @author Phil Steitz
  */
-public class TestPredicatedMap<K, V> extends AbstractTestMap<K, V> {
+public class TestPredicatedMap<K, V> extends AbstractTestIterableMap<K, V> {
 
     protected static final Predicate<Object> truePredicate = TruePredicate.<Object>truePredicate();
 
@@ -59,16 +60,16 @@ public class TestPredicatedMap<K, V> extends AbstractTestMap<K, V> {
     }
 
     //-----------------------------------------------------------------------
-    protected Map<K, V> decorateMap(Map<K, V> map, Predicate<? super K> keyPredicate,
+    protected IterableMap<K, V> decorateMap(Map<K, V> map, Predicate<? super K> keyPredicate,
         Predicate<? super V> valuePredicate) {
         return PredicatedMap.decorate(map, keyPredicate, valuePredicate);
     }
 
-    public Map<K, V> makeObject() {
+    public IterableMap<K, V> makeObject() {
         return decorateMap(new HashMap<K, V>(), truePredicate, truePredicate);
     }
 
-    public Map<K, V> makeTestMap() {
+    public IterableMap<K, V> makeTestMap() {
         return decorateMap(new HashMap<K, V>(), testPredicate, testPredicate);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/04956211/src/test/org/apache/commons/collections/map/TestStaticBucketMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestStaticBucketMap.java b/src/test/org/apache/commons/collections/map/TestStaticBucketMap.java
index a9c1c70..31014a0 100644
--- a/src/test/org/apache/commons/collections/map/TestStaticBucketMap.java
+++ b/src/test/org/apache/commons/collections/map/TestStaticBucketMap.java
@@ -28,7 +28,7 @@ import org.apache.commons.collections.BulkTest;
  *
  * @author Michael A. Smith
  */
-public class TestStaticBucketMap<K, V> extends AbstractTestMap<K, V> {
+public class TestStaticBucketMap<K, V> extends AbstractTestIterableMap<K, V> {
 
     public TestStaticBucketMap(String name) {
         super(name);
@@ -47,6 +47,14 @@ public class TestStaticBucketMap<K, V> extends AbstractTestMap<K, V> {
         return new StaticBucketMap<K, V>(30);
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isFailFastExpected() {
+        return false;
+    }
+
     public String[] ignoredTests() {
         String pre = "TestStaticBucketMap.bulkTestMap";
         String post = ".testCollectionIteratorFailFast";

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/04956211/src/test/org/apache/commons/collections/map/TestTransformedMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestTransformedMap.java b/src/test/org/apache/commons/collections/map/TestTransformedMap.java
index 15f8a18..517bce2 100644
--- a/src/test/org/apache/commons/collections/map/TestTransformedMap.java
+++ b/src/test/org/apache/commons/collections/map/TestTransformedMap.java
@@ -23,6 +23,7 @@ import java.util.Set;
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
+import org.apache.commons.collections.IterableMap;
 import org.apache.commons.collections.Transformer;
 import org.apache.commons.collections.TransformerUtils;
 import org.apache.commons.collections.collection.TestTransformedCollection;
@@ -36,7 +37,7 @@ import org.apache.commons.collections.collection.TestTransformedCollection;
  *
  * @author Stephen Colebourne
  */
-public class TestTransformedMap<K, V> extends AbstractTestMap<K, V> {
+public class TestTransformedMap<K, V> extends AbstractTestIterableMap<K, V> {
 
     public TestTransformedMap(String testName) {
         super(testName);
@@ -52,7 +53,7 @@ public class TestTransformedMap<K, V> extends AbstractTestMap<K, V> {
     }
 
     //-----------------------------------------------------------------------
-    public Map<K, V> makeObject() {
+    public IterableMap<K, V> makeObject() {
         return TransformedMap.decorate(new HashMap<K, V>(), TransformerUtils.<K> nopTransformer(),
                 TransformerUtils.<V> nopTransformer());
     }


[64/77] [abbrv] commons-collections git commit: Make private immutable variables final Add missing @Override markers and fix some raw types

Posted by ch...@apache.org.
Make private immutable variables final
Add missing @Override markers and fix some raw types

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@813954 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/a944755f
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/a944755f
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/a944755f

Branch: refs/heads/collections_jdk5_branch
Commit: a944755f6af8297ca2d6f540da44a236ecbd2a26
Parents: 0a52bf5
Author: Sebastian Bazley <se...@apache.org>
Authored: Fri Sep 11 17:50:42 2009 +0000
Committer: Sebastian Bazley <se...@apache.org>
Committed: Fri Sep 11 17:50:42 2009 +0000

----------------------------------------------------------------------
 .../collections/map/StaticBucketMap.java        | 27 ++++++++++++++++----
 1 file changed, 22 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/a944755f/src/java/org/apache/commons/collections/map/StaticBucketMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/StaticBucketMap.java b/src/java/org/apache/commons/collections/map/StaticBucketMap.java
index fa03680..141eefc 100644
--- a/src/java/org/apache/commons/collections/map/StaticBucketMap.java
+++ b/src/java/org/apache/commons/collections/map/StaticBucketMap.java
@@ -106,9 +106,9 @@ public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
     /** The default number of buckets to use */
     private static final int DEFAULT_BUCKETS = 255;
     /** The array of buckets, where the actual data is held */
-    private Node<K, V>[] buckets;
+    private final Node<K, V>[] buckets;
     /** The matching array of locks */
-    private Lock[] locks;
+    private final Lock[] locks;
 
     /**
      * Initializes the map with the default number of buckets (255).
@@ -410,11 +410,12 @@ public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
      * @param obj  the object to compare to
      * @return true if equal
      */
+    @Override
     public boolean equals(Object obj) {
         if (obj == this) {
             return true;
         }
-        if (obj instanceof Map == false) {
+        if (obj instanceof Map<?, ?> == false) {
             return false;
         }
         Map<?, ?> other = (Map<?, ?>) obj;
@@ -426,6 +427,7 @@ public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
      * 
      * @return the hash code
      */
+    @Override
     public int hashCode() {
         int hashCode = 0;
 
@@ -459,16 +461,18 @@ public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
             return value;
         }
 
+        @Override
         public int hashCode() {
             return ((key == null ? 0 : key.hashCode()) ^
                     (value == null ? 0 : value.hashCode()));
         }
 
+        @Override
         public boolean equals(Object obj) {
             if (obj == this) {
                 return true;
             }
-            if (obj instanceof Map.Entry == false) {
+            if (obj instanceof Map.Entry<?, ?> == false) {
                 return false;
             }
 
@@ -553,18 +557,22 @@ public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
 
     private class EntrySet extends AbstractSet<Map.Entry<K, V>> {
 
+        @Override
         public int size() {
             return StaticBucketMap.this.size();
         }
 
+        @Override
         public void clear() {
             StaticBucketMap.this.clear();
         }
 
+        @Override
         public Iterator<Map.Entry<K, V>> iterator() {
             return new EntryIterator();
         }
 
+        @Override
         public boolean contains(Object obj) {
             Map.Entry<?, ?> entry = (Map.Entry<?, ?>) obj;
             int hash = getHash(entry.getKey());
@@ -576,8 +584,9 @@ public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
             return false;
         }
 
+        @Override
         public boolean remove(Object obj) {
-            if (obj instanceof Map.Entry == false) {
+            if (obj instanceof Map.Entry<?, ?> == false) {
                 return false;
             }
             Map.Entry<?, ?> entry = (Map.Entry<?, ?>) obj;
@@ -597,22 +606,27 @@ public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
 
     private class KeySet extends AbstractSet<K> {
 
+        @Override
         public int size() {
             return StaticBucketMap.this.size();
         }
 
+        @Override
         public void clear() {
             StaticBucketMap.this.clear();
         }
 
+        @Override
         public Iterator<K> iterator() {
             return new KeyIterator();
         }
 
+        @Override
         public boolean contains(Object obj) {
             return StaticBucketMap.this.containsKey(obj);
         }
 
+        @Override
         public boolean remove(Object obj) {
             int hash = getHash(obj);
             synchronized (locks[hash]) {
@@ -632,14 +646,17 @@ public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
 
     private class Values extends AbstractCollection<V> {
 
+        @Override
         public int size() {
             return StaticBucketMap.this.size();
         }
 
+        @Override
         public void clear() {
             StaticBucketMap.this.clear();
         }
 
+        @Override
         public Iterator<V> iterator() {
             return new ValueIterator();
         }


[43/77] [abbrv] commons-collections git commit: comment

Posted by ch...@apache.org.
comment

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@751849 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/28228c8a
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/28228c8a
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/28228c8a

Branch: refs/heads/collections_jdk5_branch
Commit: 28228c8a834715ad6f7284d63ccdde25a4f1a4e7
Parents: 1bc525d
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Mon Mar 9 21:32:22 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Mon Mar 9 21:32:22 2009 +0000

----------------------------------------------------------------------
 src/java/org/apache/commons/collections/OrderedIterator.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/28228c8a/src/java/org/apache/commons/collections/OrderedIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/OrderedIterator.java b/src/java/org/apache/commons/collections/OrderedIterator.java
index 809cdcb..e2231c1 100644
--- a/src/java/org/apache/commons/collections/OrderedIterator.java
+++ b/src/java/org/apache/commons/collections/OrderedIterator.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.
@@ -17,10 +17,11 @@
 package org.apache.commons.collections;
 
 import java.util.Iterator;
+import java.util.ListIterator;
 import java.util.NoSuchElementException;
 
 /**
- * Defines an iterator that operates over an ordered container.
+ * Defines an iterator that operates over an ordered container. Subset of {@link ListIterator}.
  * <p>
  * This iterator allows both forward and reverse iteration through the container.
  *


[21/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/DefaultedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/DefaultedMap.java b/src/java/org/apache/commons/collections/map/DefaultedMap.java
index 3b6c827..2ecd36e 100644
--- a/src/java/org/apache/commons/collections/map/DefaultedMap.java
+++ b/src/java/org/apache/commons/collections/map/DefaultedMap.java
@@ -63,15 +63,13 @@ import org.apache.commons.collections.functors.FactoryTransformer;
  * @author Rafael U.C. Afonso
  * @see LazyMap
  */
-public class DefaultedMap
-        extends AbstractMapDecorator
-        implements Map, Serializable {
+public class DefaultedMap<K, V> extends AbstractMapDecorator<K, V> implements Serializable {
 
     /** Serialization version */
     private static final long serialVersionUID = 19698628745827L;
 
     /** The transformer to use if the map does not contain a key */
-    protected final Object value;
+    private final Transformer<? super K, ? extends V> value;
 
     //-----------------------------------------------------------------------
     /**
@@ -83,11 +81,8 @@ public class DefaultedMap
      * @param defaultValue  the default value to return when the key is not found
      * @throws IllegalArgumentException if map is null
      */
-    public static Map decorate(Map map, Object defaultValue) {
-        if (defaultValue instanceof Transformer) {
-            defaultValue = ConstantTransformer.getInstance(defaultValue);
-        }
-        return new DefaultedMap(map, defaultValue);
+    public static <K, V> Map<K, V> decorate(Map<K, V> map, V defaultValue) {
+        return new DefaultedMap<K, V>(map, ConstantTransformer.getInstance(defaultValue));
     }
 
     /**
@@ -100,11 +95,11 @@ public class DefaultedMap
      * @param factory  the factory to use to create entries, must not be null
      * @throws IllegalArgumentException if map or factory is null
      */
-    public static Map decorate(Map map, Factory factory) {
+    public static <K, V> Map<K, V> decorate(Map<K, V> map, Factory<? extends V> factory) {
         if (factory == null) {
             throw new IllegalArgumentException("Factory must not be null");
         }
-        return new DefaultedMap(map, FactoryTransformer.getInstance(factory));
+        return new DefaultedMap<K, V>(map, FactoryTransformer.getInstance(factory));
     }
 
     /**
@@ -118,11 +113,11 @@ public class DefaultedMap
      * @param transformer  the transformer to use as a factory to create entries, must not be null
      * @throws IllegalArgumentException if map or factory is null
      */
-    public static Map decorate(Map map, Transformer transformer) {
+    public static <K, V> Map<K, V> decorate(Map<K, V> map, Transformer<? super K, ? extends V> transformer) {
         if (transformer == null) {
            throw new IllegalArgumentException("Transformer must not be null");
        }
-       return new DefaultedMap(map, transformer);
+       return new DefaultedMap<K, V>(map, transformer);
     }
 
     //-----------------------------------------------------------------------
@@ -135,12 +130,18 @@ public class DefaultedMap
      * 
      * @param defaultValue  the default value to return when the key is not found
      */
-    public DefaultedMap(Object defaultValue) {
-        super(new HashMap());
-        if (defaultValue instanceof Transformer) {
-            defaultValue = ConstantTransformer.getInstance(defaultValue);
-        }
-        this.value = defaultValue;
+    public DefaultedMap(V defaultValue) {
+        this(ConstantTransformer.getInstance(defaultValue));
+    }
+
+    /**
+     * Constructs a new empty <code>DefaultedMap</code> that decorates
+     * a <code>HashMap</code>.
+     * <p>
+     * @param defaultValueTransformer transformer to use to generate missing values.
+     */
+    public DefaultedMap(Transformer<? super K, ? extends V> defaultValueTransformer) {
+        this(new HashMap<K, V>(), defaultValueTransformer);
     }
 
     /**
@@ -150,9 +151,9 @@ public class DefaultedMap
      * @param value  the value to use
      * @throws IllegalArgumentException if map or transformer is null
      */
-    protected DefaultedMap(Map map, Object value) {
+    protected DefaultedMap(Map<K, V> map, Transformer<? super K, ? extends V> defaultValueTransformer) {
         super(map);
-        this.value = value;
+        this.value = defaultValueTransformer;
     }
 
     //-----------------------------------------------------------------------
@@ -174,19 +175,18 @@ public class DefaultedMap
      * @throws IOException
      * @throws ClassNotFoundException
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
         map = (Map) in.readObject();
     }
 
     //-----------------------------------------------------------------------
-    public Object get(Object key) {
+    @SuppressWarnings("unchecked")
+    public V get(Object key) {
         // create value for key if key is not currently in the map
         if (map.containsKey(key) == false) {
-            if (value instanceof Transformer) {
-                return ((Transformer) value).transform(key);
-            }
-            return value;
+            return value.transform((K) key);
         }
         return map.get(key);
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/FixedSizeMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/FixedSizeMap.java b/src/java/org/apache/commons/collections/map/FixedSizeMap.java
index 2947f15..6c4ab3f 100644
--- a/src/java/org/apache/commons/collections/map/FixedSizeMap.java
+++ b/src/java/org/apache/commons/collections/map/FixedSizeMap.java
@@ -21,7 +21,6 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -56,9 +55,9 @@ import org.apache.commons.collections.set.UnmodifiableSet;
  * @author Stephen Colebourne
  * @author Paul Jack
  */
-public class FixedSizeMap
-        extends AbstractMapDecorator
-        implements Map, BoundedMap, Serializable {
+public class FixedSizeMap<K, V>
+        extends AbstractMapDecorator<K, V>
+        implements Map<K, V>, BoundedMap<K, V>, Serializable {
 
     /** Serialization version */
     private static final long serialVersionUID = 7450927208116179316L;
@@ -69,8 +68,8 @@ public class FixedSizeMap
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if map is null
      */
-    public static Map decorate(Map map) {
-        return new FixedSizeMap(map);
+    public static <K, V> Map<K, V> decorate(Map<K, V> map) {
+        return new FixedSizeMap<K, V>(map);
     }
 
     //-----------------------------------------------------------------------
@@ -80,7 +79,7 @@ public class FixedSizeMap
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if map is null
      */
-    protected FixedSizeMap(Map map) {
+    protected FixedSizeMap(Map<K, V> map) {
         super(map);
     }
 
@@ -105,22 +104,23 @@ public class FixedSizeMap
      * @throws ClassNotFoundException
      * @since Commons Collections 3.1
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
         map = (Map) in.readObject();
     }
 
     //-----------------------------------------------------------------------
-    public Object put(Object key, Object value) {
+    public V put(K key, V value) {
         if (map.containsKey(key) == false) {
             throw new IllegalArgumentException("Cannot put new key/value pair - Map is fixed size");
         }
         return map.put(key, value);
     }
 
-    public void putAll(Map mapToCopy) {
-        for (Iterator it = mapToCopy.keySet().iterator(); it.hasNext(); ) {
-            if (mapToCopy.containsKey(it.next()) == false) {
+    public void putAll(Map<? extends K, ? extends V> mapToCopy) {
+        for (K key : mapToCopy.keySet()) {
+            if (!containsKey(key)) {
                 throw new IllegalArgumentException("Cannot put new key/value pair - Map is fixed size");
             }
         }
@@ -131,23 +131,23 @@ public class FixedSizeMap
         throw new UnsupportedOperationException("Map is fixed size");
     }
 
-    public Object remove(Object key) {
+    public V remove(Object key) {
         throw new UnsupportedOperationException("Map is fixed size");
     }
 
-    public Set entrySet() {
-        Set set = map.entrySet();
+    public Set<Map.Entry<K, V>> entrySet() {
+        Set<Map.Entry<K, V>> set = map.entrySet();
         // unmodifiable set will still allow modification via Map.Entry objects
         return UnmodifiableSet.decorate(set);
     }
 
-    public Set keySet() {
-        Set set = map.keySet();
+    public Set<K> keySet() {
+        Set<K> set = map.keySet();
         return UnmodifiableSet.decorate(set);
     }
 
-    public Collection values() {
-        Collection coll = map.values();
+    public Collection<V> values() {
+        Collection<V> coll = map.values();
         return UnmodifiableCollection.decorate(coll);
     }
 
@@ -158,5 +158,5 @@ public class FixedSizeMap
     public int maxSize() {
         return size();
     }
-   
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/FixedSizeSortedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/FixedSizeSortedMap.java b/src/java/org/apache/commons/collections/map/FixedSizeSortedMap.java
index 7f48b60..eb50fb7 100644
--- a/src/java/org/apache/commons/collections/map/FixedSizeSortedMap.java
+++ b/src/java/org/apache/commons/collections/map/FixedSizeSortedMap.java
@@ -21,12 +21,12 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 import java.util.SortedMap;
 
 import org.apache.commons.collections.BoundedMap;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.collection.UnmodifiableCollection;
 import org.apache.commons.collections.set.UnmodifiableSet;
 
@@ -57,9 +57,9 @@ import org.apache.commons.collections.set.UnmodifiableSet;
  * @author Stephen Colebourne
  * @author Paul Jack
  */
-public class FixedSizeSortedMap
-        extends AbstractSortedMapDecorator
-        implements SortedMap, BoundedMap, Serializable {
+public class FixedSizeSortedMap<K, V>
+        extends AbstractSortedMapDecorator<K, V>
+        implements SortedMap<K, V>, BoundedMap<K, V>, Serializable {
 
     /** Serialization version */
     private static final long serialVersionUID = 3126019624511683653L;
@@ -70,8 +70,8 @@ public class FixedSizeSortedMap
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if map is null
      */
-    public static SortedMap decorate(SortedMap map) {
-        return new FixedSizeSortedMap(map);
+    public static <K, V> SortedMap<K, V> decorate(SortedMap<K, V> map) {
+        return new FixedSizeSortedMap<K, V>(map);
     }
 
     //-----------------------------------------------------------------------
@@ -81,7 +81,7 @@ public class FixedSizeSortedMap
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if map is null
      */
-    protected FixedSizeSortedMap(SortedMap map) {
+    protected FixedSizeSortedMap(SortedMap<K, V> map) {
         super(map);
     }
 
@@ -90,8 +90,8 @@ public class FixedSizeSortedMap
      * 
      * @return the decorated map
      */
-    protected SortedMap getSortedMap() {
-        return (SortedMap) map;
+    protected SortedMap<K, V> getSortedMap() {
+        return (SortedMap<K, V>) map;
     }
 
     //-----------------------------------------------------------------------
@@ -106,24 +106,23 @@ public class FixedSizeSortedMap
     /**
      * Read the map in using a custom routine.
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
         map = (Map) in.readObject();
     }
 
     //-----------------------------------------------------------------------
-    public Object put(Object key, Object value) {
+    public V put(K key, V value) {
         if (map.containsKey(key) == false) {
             throw new IllegalArgumentException("Cannot put new key/value pair - Map is fixed size");
         }
         return map.put(key, value);
     }
 
-    public void putAll(Map mapToCopy) {
-        for (Iterator it = mapToCopy.keySet().iterator(); it.hasNext(); ) {
-            if (mapToCopy.containsKey(it.next()) == false) {
-                throw new IllegalArgumentException("Cannot put new key/value pair - Map is fixed size");
-            }
+    public void putAll(Map<? extends K, ? extends V> mapToCopy) {
+        if (CollectionUtils.isSubCollection(mapToCopy.keySet(), keySet())) {
+            throw new IllegalArgumentException("Cannot put new key/value pair - Map is fixed size");
         }
         map.putAll(mapToCopy);
     }
@@ -132,39 +131,33 @@ public class FixedSizeSortedMap
         throw new UnsupportedOperationException("Map is fixed size");
     }
 
-    public Object remove(Object key) {
+    public V remove(Object key) {
         throw new UnsupportedOperationException("Map is fixed size");
     }
 
-    public Set entrySet() {
-        Set set = map.entrySet();
-        return UnmodifiableSet.decorate(set);
+    public Set<Map.Entry<K, V>> entrySet() {
+        return UnmodifiableSet.decorate(map.entrySet());
     }
 
-    public Set keySet() {
-        Set set = map.keySet();
-        return UnmodifiableSet.decorate(set);
+    public Set<K> keySet() {
+        return UnmodifiableSet.decorate(map.keySet());
     }
 
-    public Collection values() {
-        Collection coll = map.values();
-        return UnmodifiableCollection.decorate(coll);
+    public Collection<V> values() {
+        return UnmodifiableCollection.decorate(map.values());
     }
 
     //-----------------------------------------------------------------------
-    public SortedMap subMap(Object fromKey, Object toKey) {
-        SortedMap map = getSortedMap().subMap(fromKey, toKey);
-        return new FixedSizeSortedMap(map);
+    public SortedMap<K, V> subMap(K fromKey, K toKey) {
+        return new FixedSizeSortedMap<K, V>(getSortedMap().subMap(fromKey, toKey));
     }
 
-    public SortedMap headMap(Object toKey) {
-        SortedMap map = getSortedMap().headMap(toKey);
-        return new FixedSizeSortedMap(map);
+    public SortedMap<K, V> headMap(K toKey) {
+        return new FixedSizeSortedMap<K, V>(getSortedMap().headMap(toKey));
     }
 
-    public SortedMap tailMap(Object fromKey) {
-        SortedMap map = getSortedMap().tailMap(fromKey);
-        return new FixedSizeSortedMap(map);
+    public SortedMap<K, V> tailMap(K fromKey) {
+        return new FixedSizeSortedMap<K, V>(getSortedMap().tailMap(fromKey));
     }
 
     public boolean isFull() {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/Flat3Map.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/Flat3Map.java b/src/java/org/apache/commons/collections/map/Flat3Map.java
index 5759a73..b371092 100644
--- a/src/java/org/apache/commons/collections/map/Flat3Map.java
+++ b/src/java/org/apache/commons/collections/map/Flat3Map.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.
@@ -64,7 +64,7 @@ import org.apache.commons.collections.iterators.EmptyMapIterator;
  * <strong>Note that Flat3Map is not synchronized and is not thread-safe.</strong>
  * If you wish to use this map from multiple threads concurrently, you must use
  * appropriate synchronization. The simplest approach is to wrap this map
- * using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw 
+ * using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw
  * exceptions when accessed by concurrent threads without synchronization.
  *
  * @since Commons Collections 3.0
@@ -72,7 +72,7 @@ import org.apache.commons.collections.iterators.EmptyMapIterator;
  *
  * @author Stephen Colebourne
  */
-public class Flat3Map implements IterableMap, Serializable, Cloneable {
+public class Flat3Map<K, V> implements IterableMap<K, V>, Serializable, Cloneable {
 
     /** Serialization version */
     private static final long serialVersionUID = -6701087419741928296L;
@@ -86,19 +86,19 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
     /** Hash, used while in flat mode */
     private transient int hash3;
     /** Key, used while in flat mode */
-    private transient Object key1;
+    private transient K key1;
     /** Key, used while in flat mode */
-    private transient Object key2;
+    private transient K key2;
     /** Key, used while in flat mode */
-    private transient Object key3;
+    private transient K key3;
     /** Value, used while in flat mode */
-    private transient Object value1;
+    private transient V value1;
     /** Value, used while in flat mode */
-    private transient Object value2;
+    private transient V value2;
     /** Value, used while in flat mode */
-    private transient Object value3;
+    private transient V value3;
     /** Map, used while in delegate mode */
-    private transient AbstractHashedMap delegateMap;
+    private transient AbstractHashedMap<K, V> delegateMap;
 
     /**
      * Constructor.
@@ -113,7 +113,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
      * @param map  the map to copy
      * @throws NullPointerException if the map is null
      */
-    public Flat3Map(Map map) {
+    public Flat3Map(Map<? extends K, ? extends V> map) {
         super();
         putAll(map);
     }
@@ -121,11 +121,11 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
     //-----------------------------------------------------------------------
     /**
      * Gets the value mapped to the key specified.
-     * 
+     *
      * @param key  the key
      * @return the mapped value, null if no match
      */
-    public Object get(Object key) {
+    public V get(Object key) {
         if (delegateMap != null) {
             return delegateMap.get(key);
         }
@@ -158,7 +158,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
 
     /**
      * Gets the size of the map.
-     * 
+     *
      * @return the size
      */
     public int size() {
@@ -170,7 +170,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
 
     /**
      * Checks whether the map is currently empty.
-     * 
+     *
      * @return true if the map is currently size zero
      */
     public boolean isEmpty() {
@@ -180,7 +180,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
     //-----------------------------------------------------------------------
     /**
      * Checks whether the map contains the specified key.
-     * 
+     *
      * @param key  the key to search for
      * @return true if the map contains the key
      */
@@ -215,7 +215,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
 
     /**
      * Checks whether the map contains the specified value.
-     * 
+     *
      * @param value  the value to search for
      * @return true if the map contains the key
      */
@@ -248,12 +248,12 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
     //-----------------------------------------------------------------------
     /**
      * Puts a key-value mapping into this map.
-     * 
+     *
      * @param key  the key to add
      * @param value  the value to add
      * @return the value previously mapped to this key, null if none
      */
-    public Object put(Object key, Object value) {
+    public V put(K key, V value) {
         if (delegateMap != null) {
             return delegateMap.put(key, value);
         }
@@ -262,19 +262,19 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
             switch (size) {  // drop through
                 case 3:
                     if (key3 == null) {
-                        Object old = value3;
+                        V old = value3;
                         value3 = value;
                         return old;
                     }
                 case 2:
                     if (key2 == null) {
-                        Object old = value2;
+                        V old = value2;
                         value2 = value;
                         return old;
                     }
                 case 1:
                     if (key1 == null) {
-                        Object old = value1;
+                        V old = value1;
                         value1 = value;
                         return old;
                     }
@@ -285,26 +285,26 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
                 switch (size) {  // drop through
                     case 3:
                         if (hash3 == hashCode && key.equals(key3)) {
-                            Object old = value3;
+                            V old = value3;
                             value3 = value;
                             return old;
                         }
                     case 2:
                         if (hash2 == hashCode && key.equals(key2)) {
-                            Object old = value2;
+                            V old = value2;
                             value2 = value;
                             return old;
                         }
                     case 1:
                         if (hash1 == hashCode && key.equals(key1)) {
-                            Object old = value1;
+                            V old = value1;
                             value1 = value;
                             return old;
                         }
                 }
             }
         }
-        
+
         // add new mapping
         switch (size) {
             default:
@@ -333,11 +333,11 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
 
     /**
      * Puts all the values from the specified map into this map.
-     * 
+     *
      * @param map  the map to add
      * @throws NullPointerException if the map is null
      */
-    public void putAll(Map map) {
+    public void putAll(Map<? extends K, ? extends V> map) {
         int size = map.size();
         if (size == 0) {
             return;
@@ -347,8 +347,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
             return;
         }
         if (size < 4) {
-            for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
-                Map.Entry entry = (Map.Entry) it.next();
+            for (Map.Entry<? extends K, ? extends V> entry : map.entrySet()) {
                 put(entry.getKey(), entry.getValue());
             }
         } else {
@@ -370,7 +369,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
             case 1:
                 delegateMap.put(key1, value1);
         }
-        
+
         size = 0;
         hash1 = hash2 = hash3 = 0;
         key1 = key2 = key3 = null;
@@ -387,17 +386,17 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
      * @return a new AbstractHashedMap or subclass
      * @since Commons Collections 3.1
      */
-    protected AbstractHashedMap createDelegateMap() {
-        return new HashedMap();
+    protected AbstractHashedMap<K, V> createDelegateMap() {
+        return new HashedMap<K, V>();
     }
 
     /**
      * Removes the specified mapping from this map.
-     * 
+     *
      * @param key  the mapping to remove
      * @return the value mapped to the removed key, null if key not in map
      */
-    public Object remove(Object key) {
+    public V remove(Object key) {
         if (delegateMap != null) {
             return delegateMap.remove(key);
         }
@@ -408,7 +407,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
             switch (size) {  // drop through
                 case 3:
                     if (key3 == null) {
-                        Object old = value3;
+                        V old = value3;
                         hash3 = 0;
                         key3 = null;
                         value3 = null;
@@ -416,7 +415,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
                         return old;
                     }
                     if (key2 == null) {
-                        Object old = value3;
+                        V old = value3;
                         hash2 = hash3;
                         key2 = key3;
                         value2 = value3;
@@ -427,7 +426,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
                         return old;
                     }
                     if (key1 == null) {
-                        Object old = value3;
+                        V old = value3;
                         hash1 = hash3;
                         key1 = key3;
                         value1 = value3;
@@ -440,7 +439,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
                     return null;
                 case 2:
                     if (key2 == null) {
-                        Object old = value2;
+                        V old = value2;
                         hash2 = 0;
                         key2 = null;
                         value2 = null;
@@ -448,7 +447,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
                         return old;
                     }
                     if (key1 == null) {
-                        Object old = value2;
+                        V old = value2;
                         hash1 = hash2;
                         key1 = key2;
                         value1 = value2;
@@ -461,7 +460,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
                     return null;
                 case 1:
                     if (key1 == null) {
-                        Object old = value1;
+                        V old = value1;
                         hash1 = 0;
                         key1 = null;
                         value1 = null;
@@ -475,7 +474,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
                 switch (size) {  // drop through
                     case 3:
                         if (hash3 == hashCode && key.equals(key3)) {
-                            Object old = value3;
+                            V old = value3;
                             hash3 = 0;
                             key3 = null;
                             value3 = null;
@@ -483,7 +482,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
                             return old;
                         }
                         if (hash2 == hashCode && key.equals(key2)) {
-                            Object old = value3;
+                            V old = value3;
                             hash2 = hash3;
                             key2 = key3;
                             value2 = value3;
@@ -494,7 +493,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
                             return old;
                         }
                         if (hash1 == hashCode && key.equals(key1)) {
-                            Object old = value3;
+                            V old = value3;
                             hash1 = hash3;
                             key1 = key3;
                             value1 = value3;
@@ -507,7 +506,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
                         return null;
                     case 2:
                         if (hash2 == hashCode && key.equals(key2)) {
-                            Object old = value2;
+                            V old = value2;
                             hash2 = 0;
                             key2 = null;
                             value2 = null;
@@ -515,7 +514,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
                             return old;
                         }
                         if (hash1 == hashCode && key.equals(key1)) {
-                            Object old = value2;
+                            V old = value2;
                             hash1 = hash2;
                             key1 = key2;
                             value1 = value2;
@@ -528,7 +527,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
                         return null;
                     case 1:
                         if (hash1 == hashCode && key.equals(key1)) {
-                            Object old = value1;
+                            V old = value1;
                             hash1 = 0;
                             key1 = null;
                             value1 = null;
@@ -566,28 +565,28 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
      * methods to get the key and value, and set the value.
      * It avoids the need to create an entrySet/keySet/values object.
      * It also avoids creating the Map Entry object.
-     * 
+     *
      * @return the map iterator
      */
-    public MapIterator mapIterator() {
+    public MapIterator<K, V> mapIterator() {
         if (delegateMap != null) {
             return delegateMap.mapIterator();
         }
         if (size == 0) {
-            return EmptyMapIterator.INSTANCE;
+            return EmptyMapIterator.<K, V>getInstance();
         }
-        return new FlatMapIterator(this);
+        return new FlatMapIterator<K, V>(this);
     }
 
     /**
      * FlatMapIterator
      */
-    static class FlatMapIterator implements MapIterator, ResettableIterator {
-        private final Flat3Map parent;
+    static class FlatMapIterator<K, V> implements MapIterator<K, V>, ResettableIterator<K> {
+        private final Flat3Map<K, V> parent;
         private int nextIndex = 0;
         private boolean canRemove = false;
-        
-        FlatMapIterator(Flat3Map parent) {
+
+        FlatMapIterator(Flat3Map<K, V> parent) {
             super();
             this.parent = parent;
         }
@@ -596,7 +595,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
             return (nextIndex < parent.size);
         }
 
-        public Object next() {
+        public K next() {
             if (hasNext() == false) {
                 throw new NoSuchElementException(AbstractHashedMap.NO_NEXT_ENTRY);
             }
@@ -614,7 +613,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
             canRemove = false;
         }
 
-        public Object getKey() {
+        public K getKey() {
             if (canRemove == false) {
                 throw new IllegalStateException(AbstractHashedMap.GETKEY_INVALID);
             }
@@ -629,7 +628,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
             throw new IllegalStateException("Invalid map index");
         }
 
-        public Object getValue() {
+        public V getValue() {
             if (canRemove == false) {
                 throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID);
             }
@@ -644,13 +643,13 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
             throw new IllegalStateException("Invalid map index");
         }
 
-        public Object setValue(Object value) {
+        public V setValue(V value) {
             if (canRemove == false) {
                 throw new IllegalStateException(AbstractHashedMap.SETVALUE_INVALID);
             }
-            Object old = getValue();
+            V old = getValue();
             switch (nextIndex) {
-                case 3: 
+                case 3:
                     parent.value3 = value;
                     break;
                 case 2:
@@ -662,44 +661,43 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
             }
             return old;
         }
-        
+
         public void reset() {
             nextIndex = 0;
             canRemove = false;
         }
-        
+
         public String toString() {
             if (canRemove) {
                 return "Iterator[" + getKey() + "=" + getValue() + "]";
-            } else {
-                return "Iterator[]";
             }
+            return "Iterator[]";
         }
     }
-    
+
     /**
      * Gets the entrySet view of the map.
      * Changes made to the view affect this map.
-     * The Map Entry is not an independent object and changes as the 
+     * The Map Entry is not an independent object and changes as the
      * iterator progresses.
      * To simply iterate through the entries, use {@link #mapIterator()}.
-     * 
+     *
      * @return the entrySet view
      */
-    public Set entrySet() {
+    public Set<Map.Entry<K, V>> entrySet() {
         if (delegateMap != null) {
             return delegateMap.entrySet();
         }
-        return new EntrySet(this);
+        return new EntrySet<K, V>(this);
     }
-    
+
     /**
      * EntrySet
      */
-    static class EntrySet extends AbstractSet {
-        private final Flat3Map parent;
-        
-        EntrySet(Flat3Map parent) {
+    static class EntrySet<K, V> extends AbstractSet<Map.Entry<K, V>> {
+        private final Flat3Map<K, V> parent;
+
+        EntrySet(Flat3Map<K, V> parent) {
             super();
             this.parent = parent;
         }
@@ -707,43 +705,42 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
         public int size() {
             return parent.size();
         }
-        
+
         public void clear() {
             parent.clear();
         }
-        
+
         public boolean remove(Object obj) {
             if (obj instanceof Map.Entry == false) {
                 return false;
             }
-            Map.Entry entry = (Map.Entry) obj;
+            Map.Entry<?, ?> entry = (Map.Entry<?, ?>) obj;
             Object key = entry.getKey();
             boolean result = parent.containsKey(key);
             parent.remove(key);
             return result;
         }
 
-        public Iterator iterator() {
+        public Iterator<Map.Entry<K, V>> iterator() {
             if (parent.delegateMap != null) {
                 return parent.delegateMap.entrySet().iterator();
             }
             if (parent.size() == 0) {
-                return EmptyIterator.INSTANCE;
+                return EmptyIterator.<Map.Entry<K, V>>getInstance();
             }
-            return new EntrySetIterator(parent);
+            return new EntrySetIterator<K, V>(parent);
         }
     }
 
-    /**
-     * EntrySetIterator and MapEntry
-     */
-    static class EntrySetIterator implements Iterator, Map.Entry {
-        private final Flat3Map parent;
+    static abstract class EntryIterator<K, V> implements Map.Entry<K, V> {
+        private final Flat3Map<K, V> parent;
         private int nextIndex = 0;
-        private boolean canRemove = false;
-        
-        EntrySetIterator(Flat3Map parent) {
-            super();
+        protected boolean canRemove = false;
+
+        /**
+         * Create a new Flat3Map.EntryIterator.
+         */
+        public EntryIterator(Flat3Map<K, V> parent) {
             this.parent = parent;
         }
 
@@ -751,7 +748,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
             return (nextIndex < parent.size);
         }
 
-        public Object next() {
+        public Map.Entry<K, V> nextEntry() {
             if (hasNext() == false) {
                 throw new NoSuchElementException(AbstractHashedMap.NO_NEXT_ENTRY);
             }
@@ -769,7 +766,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
             canRemove = false;
         }
 
-        public Object getKey() {
+        public K getKey() {
             if (canRemove == false) {
                 throw new IllegalStateException(AbstractHashedMap.GETKEY_INVALID);
             }
@@ -784,7 +781,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
             throw new IllegalStateException("Invalid map index");
         }
 
-        public Object getValue() {
+        public V getValue() {
             if (canRemove == false) {
                 throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID);
             }
@@ -799,13 +796,13 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
             throw new IllegalStateException("Invalid map index");
         }
 
-        public Object setValue(Object value) {
+        public V setValue(V value) {
             if (canRemove == false) {
                 throw new IllegalStateException(AbstractHashedMap.SETVALUE_INVALID);
             }
-            Object old = getValue();
+            V old = getValue();
             switch (nextIndex) {
-                case 3: 
+                case 3:
                     parent.value3 = value;
                     break;
                 case 2:
@@ -817,7 +814,21 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
             }
             return old;
         }
-        
+    }
+
+    /**
+     * EntrySetIterator and MapEntry
+     */
+    static class EntrySetIterator<K, V> extends EntryIterator<K, V> implements Iterator<Map.Entry<K, V>> {
+
+        EntrySetIterator(Flat3Map<K, V> parent) {
+            super(parent);
+        }
+
+        public Map.Entry<K, V> next() {
+            return nextEntry();
+        }
+
         public boolean equals(Object obj) {
             if (canRemove == false) {
                 return false;
@@ -825,13 +836,13 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
             if (obj instanceof Map.Entry == false) {
                 return false;
             }
-            Map.Entry other = (Map.Entry) obj;
+            Map.Entry<?, ?> other = (Map.Entry<?, ?>) obj;
             Object key = getKey();
             Object value = getValue();
             return (key == null ? other.getKey() == null : key.equals(other.getKey())) &&
                    (value == null ? other.getValue() == null : value.equals(other.getValue()));
         }
-        
+
         public int hashCode() {
             if (canRemove == false) {
                 return 0;
@@ -841,37 +852,36 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
             return (key == null ? 0 : key.hashCode()) ^
                    (value == null ? 0 : value.hashCode());
         }
-        
+
         public String toString() {
             if (canRemove) {
                 return getKey() + "=" + getValue();
-            } else {
-                return "";
             }
+            return "";
         }
     }
-    
+
     /**
      * Gets the keySet view of the map.
      * Changes made to the view affect this map.
      * To simply iterate through the keys, use {@link #mapIterator()}.
-     * 
+     *
      * @return the keySet view
      */
-    public Set keySet() {
+    public Set<K> keySet() {
         if (delegateMap != null) {
             return delegateMap.keySet();
         }
-        return new KeySet(this);
+        return new KeySet<K>(this);
     }
 
     /**
      * KeySet
      */
-    static class KeySet extends AbstractSet {
-        private final Flat3Map parent;
-        
-        KeySet(Flat3Map parent) {
+    static class KeySet<K> extends AbstractSet<K> {
+        private final Flat3Map<K, ?> parent;
+
+        KeySet(Flat3Map<K, ?> parent) {
             super();
             this.parent = parent;
         }
@@ -879,11 +889,11 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
         public int size() {
             return parent.size();
         }
-        
+
         public void clear() {
             parent.clear();
         }
-        
+
         public boolean contains(Object key) {
             return parent.containsKey(key);
         }
@@ -894,53 +904,54 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
             return result;
         }
 
-        public Iterator iterator() {
+        public Iterator<K> iterator() {
             if (parent.delegateMap != null) {
                 return parent.delegateMap.keySet().iterator();
             }
             if (parent.size() == 0) {
-                return EmptyIterator.INSTANCE;
+                return EmptyIterator.<K>getInstance();
             }
-            return new KeySetIterator(parent);
+            return new KeySetIterator<K>(parent);
         }
     }
 
     /**
      * KeySetIterator
      */
-    static class KeySetIterator extends EntrySetIterator {
-        
-        KeySetIterator(Flat3Map parent) {
-            super(parent);
+    static class KeySetIterator<K> extends EntryIterator<K, Object> implements Iterator<K>{
+
+        @SuppressWarnings("unchecked")
+        KeySetIterator(Flat3Map<K, ?> parent) {
+            super((Flat3Map<K, Object>) parent);
         }
 
-        public Object next() {
-            super.next();
+        public K next() {
+            nextEntry();
             return getKey();
         }
     }
-    
+
     /**
      * Gets the values view of the map.
      * Changes made to the view affect this map.
      * To simply iterate through the values, use {@link #mapIterator()}.
-     * 
+     *
      * @return the values view
      */
-    public Collection values() {
+    public Collection<V> values() {
         if (delegateMap != null) {
             return delegateMap.values();
         }
-        return new Values(this);
+        return new Values<V>(this);
     }
 
     /**
      * Values
      */
-    static class Values extends AbstractCollection {
-        private final Flat3Map parent;
-        
-        Values(Flat3Map parent) {
+    static class Values<V> extends AbstractCollection<V> {
+        private final Flat3Map<?, V> parent;
+
+        Values(Flat3Map<?, V> parent) {
             super();
             this.parent = parent;
         }
@@ -948,37 +959,38 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
         public int size() {
             return parent.size();
         }
-        
+
         public void clear() {
             parent.clear();
         }
-        
+
         public boolean contains(Object value) {
             return parent.containsValue(value);
         }
 
-        public Iterator iterator() {
+        public Iterator<V> iterator() {
             if (parent.delegateMap != null) {
                 return parent.delegateMap.values().iterator();
             }
             if (parent.size() == 0) {
-                return EmptyIterator.INSTANCE;
+                return EmptyIterator.<V>getInstance();
             }
-            return new ValuesIterator(parent);
+            return new ValuesIterator<V>(parent);
         }
     }
 
     /**
      * ValuesIterator
      */
-    static class ValuesIterator extends EntrySetIterator {
-        
-        ValuesIterator(Flat3Map parent) {
-            super(parent);
+    static class ValuesIterator<V> extends EntryIterator<Object, V> implements Iterator<V> {
+
+        @SuppressWarnings("unchecked")
+        ValuesIterator(Flat3Map<?, V> parent) {
+            super((Flat3Map<Object, V>) parent);
         }
 
-        public Object next() {
-            super.next();
+        public V next() {
+            nextEntry();
             return getValue();
         }
     }
@@ -990,7 +1002,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
     private void writeObject(ObjectOutputStream out) throws IOException {
         out.defaultWriteObject();
         out.writeInt(size());
-        for (MapIterator it = mapIterator(); it.hasNext();) {
+        for (MapIterator<?, ?> it = mapIterator(); it.hasNext();) {
             out.writeObject(it.next());  // key
             out.writeObject(it.getValue());  // value
         }
@@ -999,6 +1011,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
     /**
      * Read the map in using a custom routine.
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
         int count = in.readInt();
@@ -1006,7 +1019,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
             delegateMap = createDelegateMap();
         }
         for (int i = count; i > 0; i--) {
-            put(in.readObject(), in.readObject());
+            put((K) in.readObject(), (V) in.readObject());
         }
     }
 
@@ -1017,11 +1030,12 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
      * @return a shallow clone
      * @since Commons Collections 3.1
      */
-    public Object clone() {
+    @SuppressWarnings("unchecked")
+    public Flat3Map<K, V> clone() {
         try {
-            Flat3Map cloned = (Flat3Map) super.clone();
+            Flat3Map<K, V> cloned = (Flat3Map<K, V>) super.clone();
             if (cloned.delegateMap != null) {
-                cloned.delegateMap = (HashedMap) cloned.delegateMap.clone();
+                cloned.delegateMap = (HashedMap<K, V>) cloned.delegateMap.clone();
             }
             return cloned;
         } catch (CloneNotSupportedException ex) {
@@ -1031,7 +1045,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
 
     /**
      * Compares this map with another.
-     * 
+     *
      * @param obj  the object to compare to
      * @return true if equal
      */
@@ -1045,7 +1059,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
         if (obj instanceof Map == false) {
             return false;
         }
-        Map other = (Map) obj;
+        Map<?, ?> other = (Map<?, ?>) obj;
         if (size != other.size()) {
             return false;
         }
@@ -1083,7 +1097,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
 
     /**
      * Gets the standard Map hashCode.
-     * 
+     *
      * @return the hash code defined in the Map interface
      */
     public int hashCode() {
@@ -1104,7 +1118,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
 
     /**
      * Gets the map as a String.
-     * 
+     *
      * @return a string version of the map
      */
     public String toString() {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/HashedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/HashedMap.java b/src/java/org/apache/commons/collections/map/HashedMap.java
index dd491f0..c880ea7 100644
--- a/src/java/org/apache/commons/collections/map/HashedMap.java
+++ b/src/java/org/apache/commons/collections/map/HashedMap.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.
@@ -26,14 +26,14 @@ import java.util.Map;
  * A <code>Map</code> implementation that is a general purpose alternative
  * to <code>HashMap</code>.
  * <p>
- * This implementation improves on the JDK1.4 HashMap by adding the 
+ * This implementation improves on the JDK1.4 HashMap by adding the
  * {@link org.apache.commons.collections.MapIterator MapIterator}
  * functionality and many methods for subclassing.
  * <p>
  * <strong>Note that HashedMap is not synchronized and is not thread-safe.</strong>
  * If you wish to use this map from multiple threads concurrently, you must use
  * appropriate synchronization. The simplest approach is to wrap this map
- * using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw 
+ * using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw
  * exceptions when accessed by concurrent threads without synchronization.
  *
  * @since Commons Collections 3.0
@@ -41,12 +41,12 @@ import java.util.Map;
  *
  * @author Stephen Colebourne
  */
-public class HashedMap
-        extends AbstractHashedMap implements Serializable, Cloneable {
+public class HashedMap<K, V>
+        extends AbstractHashedMap<K, V> implements Serializable, Cloneable {
 
     /** Serialisation version */
     private static final long serialVersionUID = -1788199231038721040L;
-    
+
     /**
      * Constructs a new empty map with default size and load factor.
      */
@@ -55,7 +55,7 @@ public class HashedMap
     }
 
     /**
-     * Constructs a new, empty map with the specified initial capacity. 
+     * Constructs a new, empty map with the specified initial capacity.
      *
      * @param initialCapacity  the initial capacity
      * @throws IllegalArgumentException if the initial capacity is less than one
@@ -66,7 +66,7 @@ public class HashedMap
 
     /**
      * Constructs a new, empty map with the specified initial capacity and
-     * load factor. 
+     * load factor.
      *
      * @param initialCapacity  the initial capacity
      * @param loadFactor  the load factor
@@ -83,7 +83,7 @@ public class HashedMap
      * @param map  the map to copy
      * @throws NullPointerException if the map is null
      */
-    public HashedMap(Map map) {
+    public HashedMap(Map<K, V> map) {
         super(map);
     }
 
@@ -93,10 +93,10 @@ public class HashedMap
      *
      * @return a shallow clone
      */
-    public Object clone() {
-        return super.clone();
+    public HashedMap<K, V> clone() {
+        return (HashedMap<K, V>) super.clone();
     }
-    
+
     /**
      * Write the map out using a custom routine.
      */
@@ -112,5 +112,5 @@ public class HashedMap
         in.defaultReadObject();
         doReadObject(in);
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/IdentityMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/IdentityMap.java b/src/java/org/apache/commons/collections/map/IdentityMap.java
index afefdc1..abf563e 100644
--- a/src/java/org/apache/commons/collections/map/IdentityMap.java
+++ b/src/java/org/apache/commons/collections/map/IdentityMap.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.
@@ -32,7 +32,7 @@ import java.util.Map;
  * <strong>Note that IdentityMap is not synchronized and is not thread-safe.</strong>
  * If you wish to use this map from multiple threads concurrently, you must use
  * appropriate synchronization. The simplest approach is to wrap this map
- * using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw 
+ * using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw
  * exceptions when accessed by concurrent threads without synchronization.
  *
  * @since Commons Collections 3.0
@@ -41,8 +41,8 @@ import java.util.Map;
  * @author java util HashMap
  * @author Stephen Colebourne
  */
-public class IdentityMap
-        extends AbstractHashedMap implements Serializable, Cloneable {
+public class IdentityMap<K, V>
+        extends AbstractHashedMap<K, V> implements Serializable, Cloneable {
 
     /** Serialisation version */
     private static final long serialVersionUID = 2028493495224302329L;
@@ -55,7 +55,7 @@ public class IdentityMap
     }
 
     /**
-     * Constructs a new, empty map with the specified initial capacity. 
+     * Constructs a new, empty map with the specified initial capacity.
      *
      * @param initialCapacity  the initial capacity
      * @throws IllegalArgumentException if the initial capacity is less than one
@@ -66,7 +66,7 @@ public class IdentityMap
 
     /**
      * Constructs a new, empty map with the specified initial capacity and
-     * load factor. 
+     * load factor.
      *
      * @param initialCapacity  the initial capacity
      * @param loadFactor  the load factor
@@ -83,7 +83,7 @@ public class IdentityMap
      * @param map  the map to copy
      * @throws NullPointerException if the map is null
      */
-    public IdentityMap(Map map) {
+    public IdentityMap(Map<K, V> map) {
         super(map);
     }
 
@@ -91,18 +91,18 @@ public class IdentityMap
     /**
      * Gets the hash code for the key specified.
      * This implementation uses the identity hash code.
-     * 
+     *
      * @param key  the key to get a hash code for
      * @return the hash code
      */
     protected int hash(Object key) {
         return System.identityHashCode(key);
     }
-    
+
     /**
      * Compares two keys for equals.
      * This implementation uses <code>==</code>.
-     * 
+     *
      * @param key1  the first key to compare
      * @param key2  the second key to compare
      * @return true if equal by identity
@@ -110,11 +110,11 @@ public class IdentityMap
     protected boolean isEqualKey(Object key1, Object key2) {
         return (key1 == key2);
     }
-    
+
     /**
      * Compares two values for equals.
      * This implementation uses <code>==</code>.
-     * 
+     *
      * @param value1  the first value to compare
      * @param value2  the second value to compare
      * @return true if equal by identity
@@ -122,31 +122,31 @@ public class IdentityMap
     protected boolean isEqualValue(Object value1, Object value2) {
         return (value1 == value2);
     }
-    
+
     /**
      * Creates an entry to store the data.
      * This implementation creates an IdentityEntry instance.
-     * 
+     *
      * @param next  the next entry in sequence
      * @param hashCode  the hash code to use
      * @param key  the key to store
      * @param value  the value to store
      * @return the newly created entry
      */
-    protected HashEntry createEntry(HashEntry next, int hashCode, Object key, Object value) {
-        return new IdentityEntry(next, hashCode, key, value);
+    protected IdentityEntry<K, V> createEntry(HashEntry<K, V> next, int hashCode, K key, V value) {
+        return new IdentityEntry<K, V>(next, hashCode, key, value);
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * HashEntry
      */
-    protected static class IdentityEntry extends HashEntry {
-        
-        protected IdentityEntry(HashEntry next, int hashCode, Object key, Object value) {
+    protected static class IdentityEntry<K, V> extends HashEntry<K, V> {
+
+        protected IdentityEntry(HashEntry<K, V> next, int hashCode, K key, V value) {
             super(next, hashCode, key, value);
         }
-        
+
         public boolean equals(Object obj) {
             if (obj == this) {
                 return true;
@@ -154,28 +154,28 @@ public class IdentityMap
             if (obj instanceof Map.Entry == false) {
                 return false;
             }
-            Map.Entry other = (Map.Entry) obj;
+            Map.Entry<?, ?> other = (Map.Entry<?, ?>) obj;
             return
                 (getKey() == other.getKey()) &&
                 (getValue() == other.getValue());
         }
-        
+
         public int hashCode() {
             return System.identityHashCode(getKey()) ^
                    System.identityHashCode(getValue());
         }
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Clones the map without cloning the keys or values.
      *
      * @return a shallow clone
      */
-    public Object clone() {
-        return super.clone();
+    public IdentityMap<K, V> clone() {
+        return (IdentityMap<K, V>) super.clone();
     }
-    
+
     /**
      * Write the map out using a custom routine.
      */
@@ -191,5 +191,5 @@ public class IdentityMap
         in.defaultReadObject();
         doReadObject(in);
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/LRUMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/LRUMap.java b/src/java/org/apache/commons/collections/map/LRUMap.java
index 9b121a9..f4a0255 100644
--- a/src/java/org/apache/commons/collections/map/LRUMap.java
+++ b/src/java/org/apache/commons/collections/map/LRUMap.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.
@@ -35,7 +35,7 @@ import org.apache.commons.collections.BoundedMap;
  * <p>
  * The map implements <code>OrderedMap</code> and entries may be queried using
  * the bidirectional <code>OrderedMapIterator</code>. The order returned is
- * least recently used to most recently used. Iterators from map views can 
+ * least recently used to most recently used. Iterators from map views can
  * also be cast to <code>OrderedIterator</code> if required.
  * <p>
  * All the available iterators can be reset back to the start by casting to
@@ -44,7 +44,7 @@ import org.apache.commons.collections.BoundedMap;
  * <strong>Note that LRUMap is not synchronized and is not thread-safe.</strong>
  * If you wish to use this map from multiple threads concurrently, you must use
  * appropriate synchronization. The simplest approach is to wrap this map
- * using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw 
+ * using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw
  * <code>NullPointerException</code>'s when accessed by concurrent threads.
  *
  * @since Commons Collections 3.0 (previously in main package v1.0)
@@ -56,14 +56,14 @@ import org.apache.commons.collections.BoundedMap;
  * @author Mike Pettypiece
  * @author Mario Ivankovits
  */
-public class LRUMap
-        extends AbstractLinkedMap implements BoundedMap, Serializable, Cloneable {
-    
+public class LRUMap<K, V>
+        extends AbstractLinkedMap<K, V> implements BoundedMap<K, V>, Serializable, Cloneable {
+
     /** Serialisation version */
     private static final long serialVersionUID = -612114643488955218L;
     /** Default maximum size */
     protected static final int DEFAULT_MAX_SIZE = 100;
-    
+
     /** Maximum size */
     private transient int maxSize;
     /** Scan behaviour */
@@ -100,7 +100,7 @@ public class LRUMap
 
     /**
      * Constructs a new, empty map with the specified initial capacity and
-     * load factor. 
+     * load factor.
      *
      * @param maxSize  the maximum size of the map, -1 for no limit,
      * @param loadFactor  the load factor
@@ -140,7 +140,7 @@ public class LRUMap
      * @throws NullPointerException if the map is null
      * @throws IllegalArgumentException if the map is empty
      */
-    public LRUMap(Map map) {
+    public LRUMap(Map<K, V> map) {
         this(map, false);
     }
 
@@ -155,7 +155,7 @@ public class LRUMap
      * @throws IllegalArgumentException if the map is empty
      * @since Commons Collections 3.1
      */
-    public LRUMap(Map map, boolean scanUntilRemovable) {
+    public LRUMap(Map<K, V> map, boolean scanUntilRemovable) {
         this(map.size(), DEFAULT_LOAD_FACTOR, scanUntilRemovable);
         putAll(map);
     }
@@ -166,12 +166,12 @@ public class LRUMap
      * <p>
      * This operation changes the position of the key in the map to the
      * most recently used position (first).
-     * 
+     *
      * @param key  the key
      * @return the mapped value, null if no match
      */
-    public Object get(Object key) {
-        LinkEntry entry = (LinkEntry) getEntry(key);
+    public V get(Object key) {
+        LinkEntry<K, V> entry = getEntry(key);
         if (entry == null) {
             return null;
         }
@@ -184,10 +184,10 @@ public class LRUMap
      * Moves an entry to the MRU position at the end of the list.
      * <p>
      * This implementation moves the updated entry to the end of the list.
-     * 
+     *
      * @param entry  the entry to update
      */
-    protected void moveToMRU(LinkEntry entry) {
+    protected void moveToMRU(LinkEntry<K, V> entry) {
         if (entry.after != header) {
             modCount++;
             // remove
@@ -203,21 +203,21 @@ public class LRUMap
                 " (please report this to commons-dev@jakarta.apache.org)");
         }
     }
-    
+
     /**
      * Updates an existing key-value mapping.
      * <p>
      * This implementation moves the updated entry to the top of the list
      * using {@link #moveToMRU(AbstractLinkedMap.LinkEntry)}.
-     * 
+     *
      * @param entry  the entry to update
      * @param newValue  the new value to store
      */
-    protected void updateEntry(HashEntry entry, Object newValue) {
-        moveToMRU((LinkEntry) entry);  // handles modCount
+    protected void updateEntry(HashEntry<K, V> entry, V newValue) {
+        moveToMRU((LinkEntry<K, V>) entry);  // handles modCount
         entry.setValue(newValue);
     }
-    
+
     /**
      * Adds a new key-value mapping into this map.
      * <p>
@@ -227,15 +227,15 @@ public class LRUMap
      * From Commons Collections 3.1 this method uses {@link #isFull()} rather
      * than accessing <code>size</code> and <code>maxSize</code> directly.
      * It also handles the scanUntilRemovable functionality.
-     * 
+     *
      * @param hashIndex  the index into the data array to store at
      * @param hashCode  the hash code of the key to add
      * @param key  the key to add
      * @param value  the value to add
      */
-    protected void addMapping(int hashIndex, int hashCode, Object key, Object value) {
+    protected void addMapping(int hashIndex, int hashCode, K key, V value) {
         if (isFull()) {
-            LinkEntry reuse = header.after;
+            LinkEntry<K, V> reuse = header.after;
             boolean removeLRUEntry = false;
             if (scanUntilRemovable) {
                 while (reuse != header && reuse != null) {
@@ -255,7 +255,7 @@ public class LRUMap
             } else {
                 removeLRUEntry = removeLRU(reuse);
             }
-            
+
             if (removeLRUEntry) {
                 if (reuse == null) {
                     throw new IllegalStateException(
@@ -272,27 +272,27 @@ public class LRUMap
             super.addMapping(hashIndex, hashCode, key, value);
         }
     }
-    
+
     /**
      * Reuses an entry by removing it and moving it to a new place in the map.
      * <p>
      * This method uses {@link #removeEntry}, {@link #reuseEntry} and {@link #addEntry}.
-     * 
+     *
      * @param entry  the entry to reuse
      * @param hashIndex  the index into the data array to store at
      * @param hashCode  the hash code of the key to add
      * @param key  the key to add
      * @param value  the value to add
      */
-    protected void reuseMapping(LinkEntry entry, int hashIndex, int hashCode, Object key, Object value) {
+    protected void reuseMapping(LinkEntry<K, V> entry, int hashIndex, int hashCode, K key, V value) {
         // find the entry before the entry specified in the hash table
         // remember that the parameters (except the first) refer to the new entry,
         // not the old one
         try {
             int removeIndex = hashIndex(entry.hashCode, data.length);
-            HashEntry[] tmp = data;  // may protect against some sync issues
-            HashEntry loop = tmp[removeIndex];
-            HashEntry previous = null;
+            HashEntry<K, V>[] tmp = data;  // may protect against some sync issues
+            HashEntry<K, V> loop = tmp[removeIndex];
+            HashEntry<K, V> previous = null;
             while (loop != entry && loop != null) {
                 previous = loop;
                 loop = loop.next;
@@ -304,7 +304,7 @@ public class LRUMap
                     " Please check that your keys are immutable, and that you have used synchronization properly." +
                     " If so, then please report this to commons-dev@jakarta.apache.org as a bug.");
             }
-            
+
             // reuse the entry
             modCount++;
             removeEntry(entry, removeIndex, previous);
@@ -318,7 +318,7 @@ public class LRUMap
                     " If so, then please report this to commons-dev@jakarta.apache.org as a bug.");
         }
     }
-    
+
     /**
      * Subclass method to control removal of the least recently used entry from the map.
      * <p>
@@ -349,10 +349,10 @@ public class LRUMap
      * <p>
      * NOTE: Commons Collections 3.0 passed the wrong entry to this method.
      * This is fixed in version 3.1 onwards.
-     * 
+     *
      * @param entry  the entry to be removed
      */
-    protected boolean removeLRU(LinkEntry entry) {
+    protected boolean removeLRU(LinkEntry<K, V> entry) {
         return true;
     }
 
@@ -392,10 +392,10 @@ public class LRUMap
      *
      * @return a shallow clone
      */
-    public Object clone() {
-        return super.clone();
+    public LRUMap<K, V> clone() {
+        return (LRUMap<K, V>) super.clone();
     }
-    
+
     /**
      * Write the map out using a custom routine.
      */
@@ -411,7 +411,7 @@ public class LRUMap
         in.defaultReadObject();
         doReadObject(in);
     }
-    
+
     /**
      * Writes the data necessary for <code>put()</code> to work in deserialization.
      */
@@ -427,5 +427,5 @@ public class LRUMap
         maxSize = in.readInt();
         super.doReadObject(in);
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/LazyMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/LazyMap.java b/src/java/org/apache/commons/collections/map/LazyMap.java
index cccadfe..db0f565 100644
--- a/src/java/org/apache/commons/collections/map/LazyMap.java
+++ b/src/java/org/apache/commons/collections/map/LazyMap.java
@@ -62,9 +62,7 @@ import org.apache.commons.collections.functors.FactoryTransformer;
  * @author Stephen Colebourne
  * @author Paul Jack
  */
-public class LazyMap<K,V>
-        extends AbstractMapDecorator<K,V>
-        implements Map<K,V>, Serializable {
+public class LazyMap<K, V> extends AbstractMapDecorator<K, V> implements Map<K, V>, Serializable {
 
     /** Serialization version */
     private static final long serialVersionUID = 7990956402564206740L;

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/LinkedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/LinkedMap.java b/src/java/org/apache/commons/collections/map/LinkedMap.java
index f9da823..d6479d5 100644
--- a/src/java/org/apache/commons/collections/map/LinkedMap.java
+++ b/src/java/org/apache/commons/collections/map/LinkedMap.java
@@ -62,8 +62,7 @@ import org.apache.commons.collections.list.UnmodifiableList;
  *
  * @author Stephen Colebourne
  */
-public class LinkedMap
-        extends AbstractLinkedMap implements Serializable, Cloneable {
+public class LinkedMap<K, V> extends AbstractLinkedMap<K, V> implements Serializable, Cloneable {
 
     /** Serialisation version */
     private static final long serialVersionUID = 9077234323521161066L;
@@ -104,7 +103,7 @@ public class LinkedMap
      * @param map  the map to copy
      * @throws NullPointerException if the map is null
      */
-    public LinkedMap(Map map) {
+    public LinkedMap(Map<K, V> map) {
         super(map);
     }
 
@@ -114,8 +113,8 @@ public class LinkedMap
      *
      * @return a shallow clone
      */
-    public Object clone() {
-        return super.clone();
+    public LinkedMap<K, V> clone() {
+        return (LinkedMap<K, V>) super.clone();
     }
     
     /**
@@ -142,7 +141,7 @@ public class LinkedMap
      * @return the key at the specified index
      * @throws IndexOutOfBoundsException if the index is invalid
      */
-    public Object get(int index) {
+    public K get(int index) {
         return getEntry(index).getKey();
     }
     
@@ -153,7 +152,7 @@ public class LinkedMap
      * @return the key at the specified index
      * @throws IndexOutOfBoundsException if the index is invalid
      */
-    public Object getValue(int index) {
+    public V getValue(int index) {
         return getEntry(index).getValue();
     }
     
@@ -166,7 +165,7 @@ public class LinkedMap
     public int indexOf(Object key) {
         key = convertKey(key);
         int i = 0;
-        for (LinkEntry entry = header.after; entry != header; entry = entry.after, i++) {
+        for (LinkEntry<K, V> entry = header.after; entry != header; entry = entry.after, i++) {
             if (isEqualKey(key, entry.key)) {
                 return i;
             }
@@ -182,7 +181,7 @@ public class LinkedMap
      *  or <code>null</code> if none existed
      * @throws IndexOutOfBoundsException if the index is invalid
      */
-    public Object remove(int index) {
+    public V remove(int index) {
         return remove(get(index));
     }
 
@@ -201,29 +200,29 @@ public class LinkedMap
      * @see #keySet()
      * @return The ordered list of keys.  
      */
-    public List asList() {
-        return new LinkedMapList(this);
+    public List<K> asList() {
+        return new LinkedMapList<K>(this);
     }
 
     /**
      * List view of map.
      */
-    static class LinkedMapList extends AbstractList {
-        
-        final LinkedMap parent;
-        
-        LinkedMapList(LinkedMap parent) {
+    static class LinkedMapList<K> extends AbstractList<K> {
+
+        final LinkedMap<K, ?> parent;
+
+        LinkedMapList(LinkedMap<K, ?> parent) {
             this.parent = parent;
         }
-        
+
         public int size() {
             return parent.size();
         }
-    
-        public Object get(int index) {
+
+        public K get(int index) {
             return parent.get(index);
         }
-        
+
         public boolean contains(Object obj) {
             return parent.containsKey(obj);
         }
@@ -231,58 +230,58 @@ public class LinkedMap
         public int indexOf(Object obj) {
             return parent.indexOf(obj);
         }
-        
+
         public int lastIndexOf(Object obj) {
             return parent.indexOf(obj);
         }
-        
-        public boolean containsAll(Collection coll) {
+
+        public boolean containsAll(Collection<?> coll) {
             return parent.keySet().containsAll(coll);
         }
-        
-        public Object remove(int index) {
+
+        public K remove(int index) {
             throw new UnsupportedOperationException();
         }
-        
+
         public boolean remove(Object obj) {
             throw new UnsupportedOperationException();
         }
-        
-        public boolean removeAll(Collection coll) {
+
+        public boolean removeAll(Collection<?> coll) {
             throw new UnsupportedOperationException();
         }
-        
-        public boolean retainAll(Collection coll) {
+
+        public boolean retainAll(Collection<?> coll) {
             throw new UnsupportedOperationException();
         }
-        
+
         public void clear() {
             throw new UnsupportedOperationException();
         }
-        
+
         public Object[] toArray() {
             return parent.keySet().toArray();
         }
 
-        public Object[] toArray(Object[] array) {
+        public <T> T[] toArray(T[] array) {
             return parent.keySet().toArray(array);
         }
-        
-        public Iterator iterator() {
+
+        public Iterator<K> iterator() {
             return UnmodifiableIterator.decorate(parent.keySet().iterator());
         }
-        
-        public ListIterator listIterator() {
+
+        public ListIterator<K> listIterator() {
             return UnmodifiableListIterator.decorate(super.listIterator());
         }
-        
-        public ListIterator listIterator(int fromIndex) {
+
+        public ListIterator<K> listIterator(int fromIndex) {
             return UnmodifiableListIterator.decorate(super.listIterator(fromIndex));
         }
-        
-        public List subList(int fromIndexInclusive, int toIndexExclusive) {
+
+        public List<K> subList(int fromIndexInclusive, int toIndexExclusive) {
             return UnmodifiableList.decorate(super.subList(fromIndexInclusive, toIndexExclusive));
         }
     }
-    
+
 }


[11/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/collection/TestSynchronizedCollection.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/collection/TestSynchronizedCollection.java b/src/test/org/apache/commons/collections/collection/TestSynchronizedCollection.java
index 1dbdb00..3782e12 100644
--- a/src/test/org/apache/commons/collections/collection/TestSynchronizedCollection.java
+++ b/src/test/org/apache/commons/collections/collection/TestSynchronizedCollection.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,42 +24,41 @@ import junit.framework.Test;
 import junit.framework.TestSuite;
 
 /**
- * Extension of {@link AbstractTestCollection} for exercising the 
+ * Extension of {@link AbstractTestCollection} for exercising the
  * {@link SynchronizedCollection} implementation.
  *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  * @author Stephen Colebourne
  */
-public class TestSynchronizedCollection extends AbstractTestCollection<Object> {
-    
+public class TestSynchronizedCollection<E> extends AbstractTestCollection<E> {
+
     public TestSynchronizedCollection(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return new TestSuite(TestSynchronizedCollection.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestSynchronizedCollection.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    //-----------------------------------------------------------------------    
-    public Collection<Object> makeCollection() {
-        return SynchronizedCollection.decorate(new ArrayList<Object>());
+    //-----------------------------------------------------------------------
+    public Collection<E> makeObject() {
+        return SynchronizedCollection.decorate(new ArrayList<E>());
     }
-    
-    public Collection<Object> makeConfirmedCollection() {
-        ArrayList<Object> list = new ArrayList<Object>();
-        return list;
+
+    public Collection<E> makeConfirmedCollection() {
+        return new ArrayList<E>();
     }
 
-    public Collection<Object> makeConfirmedFullCollection() {
-        ArrayList<Object> list = new ArrayList<Object>();
+    public Collection<E> makeConfirmedFullCollection() {
+        ArrayList<E> list = new ArrayList<E>();
         list.addAll(Arrays.asList(getFullElements()));
         return list;
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/collection/TestTransformedCollection.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/collection/TestTransformedCollection.java b/src/test/org/apache/commons/collections/collection/TestTransformedCollection.java
index 3764389..6706624 100644
--- a/src/test/org/apache/commons/collections/collection/TestTransformedCollection.java
+++ b/src/test/org/apache/commons/collections/collection/TestTransformedCollection.java
@@ -71,7 +71,7 @@ public class TestTransformedCollection extends AbstractTestCollection<Object> {
         return list;
     }
     
-    public Collection<Object> makeCollection() {
+    public Collection<Object> makeObject() {
         return TransformedCollection.decorate(new ArrayList<Object>(), NOOP_TRANSFORMER);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/collection/TestUnmodifiableCollection.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/collection/TestUnmodifiableCollection.java b/src/test/org/apache/commons/collections/collection/TestUnmodifiableCollection.java
index 2a422da..e7e19f6 100644
--- a/src/test/org/apache/commons/collections/collection/TestUnmodifiableCollection.java
+++ b/src/test/org/apache/commons/collections/collection/TestUnmodifiableCollection.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.
@@ -25,48 +25,47 @@ import junit.framework.Test;
 import junit.framework.TestSuite;
 
 /**
- * Extension of {@link AbstractTestCollection} for exercising the 
+ * Extension of {@link AbstractTestCollection} for exercising the
  * {@link UnmodifiableCollection} implementation.
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  * @author Stephen Colebourne
  */
-public class TestUnmodifiableCollection extends AbstractTestCollection<Object> {
-    
+public class TestUnmodifiableCollection<E> extends AbstractTestCollection<E> {
+
     public TestUnmodifiableCollection(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return new TestSuite(TestUnmodifiableCollection.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestUnmodifiableCollection.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    //-----------------------------------------------------------------------    
-    public Collection<Object> makeCollection() {
-        return UnmodifiableCollection.decorate(new ArrayList<Object>());
+    //-----------------------------------------------------------------------
+    public Collection<E> makeObject() {
+        return UnmodifiableCollection.decorate(new ArrayList<E>());
     }
-    
-    public Collection<Object> makeFullCollection() {
-        List<Object> list = new ArrayList<Object>();
+
+    public Collection<E> makeFullCollection() {
+        List<E> list = new ArrayList<E>();
         list.addAll(Arrays.asList(getFullElements()));
         return UnmodifiableCollection.decorate(list);
     }
-    
-    public Collection<Object> makeConfirmedCollection() {
-        ArrayList<Object> list = new ArrayList<Object>();
-        return list;
+
+    public Collection<E> makeConfirmedCollection() {
+        return new ArrayList<E>();
     }
 
-    public Collection<Object> makeConfirmedFullCollection() {
-        ArrayList<Object> list = new ArrayList<Object>();
+    public Collection<E> makeConfirmedFullCollection() {
+        ArrayList<E> list = new ArrayList<E>();
         list.addAll(Arrays.asList(getFullElements()));
         return list;
     }
@@ -74,7 +73,7 @@ public class TestUnmodifiableCollection extends AbstractTestCollection<Object> {
     public boolean isAddSupported() {
         return false;
     }
-    
+
     public boolean isRemoveSupported() {
         return false;
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java b/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java
index 8164843..3c95033 100644
--- a/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java
+++ b/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java
@@ -34,7 +34,7 @@ import org.apache.commons.collections.AbstractTestObject;
  * 
  * @author Stephen Colebourne
  */
-public abstract class AbstractTestComparator extends AbstractTestObject {
+public abstract class AbstractTestComparator<T> extends AbstractTestObject {
 
     /**
      * JUnit constructor.
@@ -46,19 +46,13 @@ public abstract class AbstractTestComparator extends AbstractTestObject {
     }
 
     //-----------------------------------------------------------------------
-    /**
-     * Implement this method to return the comparator to test.
-     * 
-     * @return the comparator to test
-     */
-    public abstract Comparator makeComparator();
     
     /**
      * Implement this method to return a list of sorted objects.
      * 
      * @return sorted objects
      */
-    public abstract List getComparableObjectsOrdered();
+    public abstract List<T> getComparableObjectsOrdered();
 
     //-----------------------------------------------------------------------
     /**
@@ -66,9 +60,7 @@ public abstract class AbstractTestComparator extends AbstractTestObject {
      * 
      * @return a full iterator
      */
-    public Object makeObject() {
-        return makeComparator();
-    }
+    public abstract Comparator<T> makeObject();
 
     /**
      * Overrides superclass to block tests.
@@ -96,23 +88,22 @@ public abstract class AbstractTestComparator extends AbstractTestObject {
     /**
      * Reverse the list.
      */
-    protected void reverseObjects(List list) {
+    protected void reverseObjects(List<?> list) {
         Collections.reverse(list);
     }
 
     /**
      * Randomize the list.
      */
-    protected void randomizeObjects(List list) {
+    protected void randomizeObjects(List<?> list) {
         Collections.shuffle(list);
     }
 
     /**
      * Sort the list.
      */
-    protected void sortObjects(List list, Comparator comparator) {
-        Collections.sort(list,comparator);
-
+    protected void sortObjects(List<T> list, Comparator<? super T> comparator) {
+        Collections.sort(list, comparator);
     }
 
     //-----------------------------------------------------------------------
@@ -120,43 +111,41 @@ public abstract class AbstractTestComparator extends AbstractTestObject {
      * Test sorting an empty list
      */
     public void testEmptyListSort() {
-        List list = new LinkedList();
-        sortObjects(list, makeComparator());
+        List<T> list = new LinkedList<T>();
+        sortObjects(list, makeObject());
+
+        List<T> list2 = new LinkedList<T>();
 
-        List list2 = new LinkedList();
-        
-        assertTrue("Comparator cannot sort empty lists",
-                   list2.equals(list));
+        assertTrue("Comparator cannot sort empty lists", list2.equals(list));
     }
 
     /**
      * Test sorting a reversed list.
      */
     public void testReverseListSort() {
-        Comparator comparator = makeComparator();
+        Comparator<T> comparator = makeObject();
 
-        List randomList = getComparableObjectsOrdered();
+        List<T> randomList = getComparableObjectsOrdered();
         reverseObjects(randomList);
-        sortObjects(randomList,comparator);
+        sortObjects(randomList, comparator);
 
-        List orderedList = getComparableObjectsOrdered();
+        List<T> orderedList = getComparableObjectsOrdered();
 
         assertTrue("Comparator did not reorder the List correctly",
                    orderedList.equals(randomList));
-
     }
 
     /**
      * Test sorting a random list.
      */
     public void testRandomListSort() {
-        Comparator comparator = makeComparator();
+        Comparator<T> comparator = makeObject();
 
-        List randomList = getComparableObjectsOrdered();
+        List<T> randomList = getComparableObjectsOrdered();
         randomizeObjects(randomList);
         sortObjects(randomList,comparator);
 
-        List orderedList = getComparableObjectsOrdered();
+        List<T> orderedList = getComparableObjectsOrdered();
 
         /* debug 
         Iterator i = randomList.iterator();
@@ -174,7 +163,7 @@ public abstract class AbstractTestComparator extends AbstractTestObject {
      * Nearly all Comparators should be Serializable.
      */
     public void testComparatorIsSerializable() {
-        Comparator comparator = makeComparator();
+        Comparator<T> comparator = makeObject();
         assertTrue("This comparator should be Serializable.",
                    comparator instanceof Serializable);
     }
@@ -195,37 +184,38 @@ public abstract class AbstractTestComparator extends AbstractTestObject {
      * Compare the current serialized form of the Comparator
      * against the canonical version in CVS.
      */
+    @SuppressWarnings("unchecked")
     public void testComparatorCompatibility() throws IOException, ClassNotFoundException {
-        if(!skipSerializedCanonicalTests()) {
-            Comparator comparator = null;
+        if (!skipSerializedCanonicalTests()) {
+            Comparator<T> comparator = null;
     
             // test to make sure the canonical form has been preserved
             try {
-                comparator = (Comparator) readExternalFormFromDisk(getCanonicalComparatorName(makeComparator()));
+                comparator = (Comparator<T>) readExternalFormFromDisk(getCanonicalComparatorName(makeObject()));
         	} catch (FileNotFoundException exception) {
     
                 boolean autoCreateSerialized = false;
     
-        	    if(autoCreateSerialized) {
-    	          	comparator = makeComparator();
+        	    if (autoCreateSerialized) {
+    	          	comparator = makeObject();
             		String fileName = getCanonicalComparatorName(comparator);
             		writeExternalFormToDisk((Serializable) comparator, fileName);
-            		fail("Serialized form could not be found.  A serialized version " +
-            		     "has now been written (and should be added to CVS): " + fileName);
+            		fail("Serialized form could not be found.  A serialized version "
+                            + "has now been written (and should be added to CVS): " + fileName);
                 } else {
-                    fail("The Serialized form could be located to test serialization " +
-                        "compatibility: " + exception.getMessage());
+                    fail("The Serialized form could be located to test serialization "
+                            + "compatibility: " + exception.getMessage());
                 }
             }
     
             
             // make sure the canonical form produces the ordering we currently
             // expect
-            List randomList = getComparableObjectsOrdered();
+            List<T> randomList = getComparableObjectsOrdered();
             reverseObjects(randomList);
-            sortObjects(randomList,comparator);
+            sortObjects(randomList, comparator);
     
-            List orderedList = getComparableObjectsOrdered();
+            List<T> orderedList = getComparableObjectsOrdered();
     
             assertTrue("Comparator did not reorder the List correctly",
                        orderedList.equals(randomList));

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/comparators/TestBooleanComparator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/comparators/TestBooleanComparator.java b/src/test/org/apache/commons/collections/comparators/TestBooleanComparator.java
index 5f28b2d..28eac92 100644
--- a/src/test/org/apache/commons/collections/comparators/TestBooleanComparator.java
+++ b/src/test/org/apache/commons/collections/comparators/TestBooleanComparator.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.
@@ -25,12 +25,12 @@ import junit.framework.TestSuite;
 
 /**
  * Tests for {@link BooleanComparator}.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Rodney Waldhoff
  */
-public class TestBooleanComparator extends AbstractTestComparator {
+public class TestBooleanComparator extends AbstractTestComparator<Boolean> {
 
     // conventional
     // ------------------------------------------------------------------------
@@ -46,21 +46,21 @@ public class TestBooleanComparator extends AbstractTestComparator {
     // collections testing framework
     // ------------------------------------------------------------------------
 
-    public Comparator makeComparator() {
+    public Comparator<Boolean> makeObject() {
         return new BooleanComparator();
     }
 
-    public List getComparableObjectsOrdered() {
-        List list = new ArrayList();
+    public List<Boolean> getComparableObjectsOrdered() {
+        List<Boolean> list = new ArrayList<Boolean>();
         list.add(new Boolean(false));
         list.add(Boolean.FALSE);
         list.add(new Boolean(false));
         list.add(Boolean.TRUE);
         list.add(new Boolean(true));
-        list.add(Boolean.TRUE);
+        list.add(true);
         return list;
     }
-    
+
     public String getCompatibilityVersion() {
         return "3";
     }
@@ -71,16 +71,16 @@ public class TestBooleanComparator extends AbstractTestComparator {
     public void testConstructors() {
         allTests(false,new BooleanComparator());
         allTests(false,new BooleanComparator(false));
-        allTests(true,new BooleanComparator(true));        
+        allTests(true,new BooleanComparator(true));
     }
-    
+
     public void testStaticFactoryMethods() {
         allTests(false,BooleanComparator.getFalseFirstComparator());
         allTests(false,BooleanComparator.getBooleanComparator(false));
         allTests(true,BooleanComparator.getTrueFirstComparator());
         allTests(true,BooleanComparator.getBooleanComparator(true));
     }
-    
+
     public void testEqualsCompatibleInstance() {
         assertEquals(new BooleanComparator(),new BooleanComparator(false));
         assertEquals(new BooleanComparator(false),new BooleanComparator(false));
@@ -94,7 +94,7 @@ public class TestBooleanComparator extends AbstractTestComparator {
         assertTrue(!(new BooleanComparator().equals(new BooleanComparator(true))));
         assertTrue(!(new BooleanComparator(true).equals(new BooleanComparator(false))));
     }
-    
+
     // utilities
     // ------------------------------------------------------------------------
 
@@ -109,36 +109,24 @@ public class TestBooleanComparator extends AbstractTestComparator {
 
     protected void trueFirstTests(BooleanComparator comp) {
         assertNotNull(comp);
-        assertEquals(0,comp.compare(Boolean.TRUE,Boolean.TRUE));
-        assertEquals(0,comp.compare(Boolean.FALSE,Boolean.FALSE));
-        assertTrue(comp.compare(Boolean.FALSE,Boolean.TRUE) > 0);
-        assertTrue(comp.compare(Boolean.TRUE,Boolean.FALSE) < 0);
-
-        assertEquals(0,comp.compare((Object)(Boolean.TRUE),(Object)(Boolean.TRUE)));
-        assertEquals(0,comp.compare((Object)(Boolean.FALSE),(Object)(Boolean.FALSE)));
-        assertTrue(comp.compare((Object)(Boolean.FALSE),(Object)(Boolean.TRUE)) > 0);
-        assertTrue(comp.compare((Object)(Boolean.TRUE),(Object)(Boolean.FALSE)) < 0);
+        assertEquals(0,comp.compare(true, true));
+        assertEquals(0,comp.compare(false, false));
+        assertTrue(comp.compare(false, true) > 0);
+        assertTrue(comp.compare(true, false) < 0);
     }
 
     protected void falseFirstTests(BooleanComparator comp) {
         assertNotNull(comp);
-        assertEquals(0,comp.compare(Boolean.TRUE,Boolean.TRUE));
-        assertEquals(0,comp.compare(Boolean.FALSE,Boolean.FALSE));
-        assertTrue(comp.compare(Boolean.FALSE,Boolean.TRUE) < 0);
-        assertTrue(comp.compare(Boolean.TRUE,Boolean.FALSE) > 0);
-
-        assertEquals(0,comp.compare((Object)(Boolean.TRUE),(Object)(Boolean.TRUE)));
-        assertEquals(0,comp.compare((Object)(Boolean.FALSE),(Object)(Boolean.FALSE)));
-        assertTrue(comp.compare((Object)(Boolean.FALSE),(Object)(Boolean.TRUE)) < 0);
-        assertTrue(comp.compare((Object)(Boolean.TRUE),(Object)(Boolean.FALSE)) > 0);
+        assertEquals(0,comp.compare(true, true));
+        assertEquals(0,comp.compare(false, false));
+        assertTrue(comp.compare(false, true) < 0);
+        assertTrue(comp.compare(true, false) > 0);
     }
 
     protected void orderIndependentTests(BooleanComparator comp) {
         nullArgumentTests(comp);
-        nonBooleanArgumentTests(comp);
-        nullAndNonBooleanArgumentsTests(comp);
     }
-    
+
     protected void nullArgumentTests(BooleanComparator comp) {
         assertNotNull(comp);
         try {
@@ -172,59 +160,5 @@ public class TestBooleanComparator extends AbstractTestComparator {
             // expected
         }
     }
-    
-    protected void nonBooleanArgumentTests(BooleanComparator comp) {
-        assertNotNull(comp);
-        try {
-            comp.compare("string","string");
-            fail("Expected ClassCastException");
-        } catch(ClassCastException e) {
-            // expected
-        }
-        try {
-            comp.compare(Boolean.TRUE,"string");
-            fail("Expected ClassCastException");
-        } catch(ClassCastException e) {
-            // expected
-        }
-        try {
-            comp.compare("string",Boolean.TRUE);
-            fail("Expected ClassCastException");
-        } catch(ClassCastException e) {
-            // expected
-        }
-        try {
-            comp.compare("string",new Integer(3));
-            fail("Expected ClassCastException");
-        } catch(ClassCastException e) {
-            // expected
-        }
-        try {
-            comp.compare(new Integer(3),"string");
-            fail("Expected ClassCastException");
-        } catch(ClassCastException e) {
-            // expected
-        }
-    }
-    
-    protected void nullAndNonBooleanArgumentsTests(BooleanComparator comp) {
-        assertNotNull(comp);
-        try {
-            comp.compare(null,"string");
-            fail("Expected ClassCast or NullPointer Exception");
-        } catch(ClassCastException e) {
-            // expected
-        } catch(NullPointerException e) {
-            // expected
-        }
-        try {
-            comp.compare("string",null);
-            fail("Expected ClassCast or NullPointer Exception");
-        } catch(ClassCastException e) {
-            // expected
-        } catch(NullPointerException e) {
-            // expected
-        }
-    }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/comparators/TestComparableComparator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/comparators/TestComparableComparator.java b/src/test/org/apache/commons/collections/comparators/TestComparableComparator.java
index d489749..90d6c8d 100644
--- a/src/test/org/apache/commons/collections/comparators/TestComparableComparator.java
+++ b/src/test/org/apache/commons/collections/comparators/TestComparableComparator.java
@@ -30,7 +30,7 @@ import junit.framework.TestSuite;
  * 
  * @author Unknown
  */
-public class TestComparableComparator extends AbstractTestComparator {
+public class TestComparableComparator extends AbstractTestComparator<Integer> {
 
     public TestComparableComparator(String testName) {
         super(testName);
@@ -40,17 +40,17 @@ public class TestComparableComparator extends AbstractTestComparator {
         return new TestSuite(TestComparableComparator.class);
     }
 
-    public Comparator makeComparator() {
-        return new ComparableComparator();
+    public Comparator<Integer> makeObject() {
+        return new ComparableComparator<Integer>();
     }
 
-    public List getComparableObjectsOrdered() {
-        List list = new LinkedList();
-        list.add(new Integer(1));
-        list.add(new Integer(2));
-        list.add(new Integer(3));
-        list.add(new Integer(4));
-        list.add(new Integer(5));
+    public List<Integer> getComparableObjectsOrdered() {
+        List<Integer> list = new LinkedList<Integer>();
+        list.add(1);
+        list.add(2);
+        list.add(3);
+        list.add(4);
+        list.add(5);
         return list;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/comparators/TestComparatorChain.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/comparators/TestComparatorChain.java b/src/test/org/apache/commons/collections/comparators/TestComparatorChain.java
index d1dda55..1be2041 100644
--- a/src/test/org/apache/commons/collections/comparators/TestComparatorChain.java
+++ b/src/test/org/apache/commons/collections/comparators/TestComparatorChain.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.
@@ -26,12 +26,12 @@ import junit.framework.TestSuite;
 
 /**
  * Tests for ComparatorChain.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Unknown
  */
-public class TestComparatorChain extends AbstractTestComparator {
+public class TestComparatorChain extends AbstractTestComparator<TestComparatorChain.PseudoRow> {
 
     public TestComparatorChain(String testName) {
         super(testName);
@@ -41,97 +41,94 @@ public class TestComparatorChain extends AbstractTestComparator {
         return new TestSuite(TestComparatorChain.class);
     }
 
-    public Comparator makeComparator() {
-        ComparatorChain chain = new ComparatorChain(new ColumnComparator(0));
-        chain.addComparator(new ColumnComparator(1),true); // reverse the second column
-        chain.addComparator(new ColumnComparator(2),false);
+    public Comparator<PseudoRow> makeObject() {
+        ComparatorChain<PseudoRow> chain = new ComparatorChain<PseudoRow>(new ColumnComparator(0));
+        chain.addComparator(new ColumnComparator(1), true); // reverse the second column
+        chain.addComparator(new ColumnComparator(2), false);
         return chain;
     }
 
     public void testNoopComparatorChain() {
-        ComparatorChain chain = new ComparatorChain();
+        ComparatorChain<Integer> chain = new ComparatorChain<Integer>();
         Integer i1 = new Integer(4);
         Integer i2 = new Integer(6);
-        chain.addComparator(new ComparableComparator());
+        chain.addComparator(new ComparableComparator<Integer>());
 
         int correctValue = i1.compareTo(i2);
-        assertTrue("Comparison returns the right order",chain.compare(i1,i2) == correctValue);
+        assertTrue("Comparison returns the right order", chain.compare(i1, i2) == correctValue);
     }
 
     public void testBadNoopComparatorChain() {
-        ComparatorChain chain = new ComparatorChain();
+        ComparatorChain<Integer> chain = new ComparatorChain<Integer>();
         Integer i1 = new Integer(4);
         Integer i2 = new Integer(6);
         try {
             chain.compare(i1,i2);
             fail("An exception should be thrown when a chain contains zero comparators.");
         } catch (UnsupportedOperationException e) {
-
         }
     }
 
     public void testListComparatorChain() {
-        List list = new LinkedList();
-        list.add(new ComparableComparator());
-        ComparatorChain chain = new ComparatorChain(list);
+        List<Comparator<Integer>> list = new LinkedList<Comparator<Integer>>();
+        list.add(new ComparableComparator<Integer>());
+        ComparatorChain<Integer> chain = new ComparatorChain<Integer>(list);
         Integer i1 = new Integer(4);
         Integer i2 = new Integer(6);
 
         int correctValue = i1.compareTo(i2);
-        assertTrue("Comparison returns the right order",chain.compare(i1,i2) == correctValue);
+        assertTrue("Comparison returns the right order", chain.compare(i1, i2) == correctValue);
     }
 
     public void testBadListComparatorChain() {
-        List list = new LinkedList();
-        ComparatorChain chain = new ComparatorChain(list);
+        List<Comparator<Integer>> list = new LinkedList<Comparator<Integer>>();
+        ComparatorChain<Integer> chain = new ComparatorChain<Integer>(list);
         Integer i1 = new Integer(4);
         Integer i2 = new Integer(6);
         try {
-            chain.compare(i1,i2);
+            chain.compare(i1, i2);
             fail("An exception should be thrown when a chain contains zero comparators.");
         } catch (UnsupportedOperationException e) {
-
         }
     }
 
-
     public void testComparatorChainOnMinvaluedCompatator() {
         // -1 * Integer.MIN_VALUE is less than 0,
         // test that ComparatorChain handles this edge case correctly
-        ComparatorChain chain = new ComparatorChain();
-        chain.addComparator(
-            new Comparator() {
-                public int compare(Object a, Object b) {
-                    int result = ((Comparable)a).compareTo(b);
-                    if(result < 0) {
-                        return Integer.MIN_VALUE;
-                    } else if(result > 0) {
-                        return Integer.MAX_VALUE;
-                    } else {
-                        return 0;
-                    }
+        ComparatorChain<Integer> chain = new ComparatorChain<Integer>();
+        chain.addComparator(new Comparator<Integer>() {
+            public int compare(Integer a, Integer b) {
+                int result = a.compareTo(b);
+                if (result < 0) {
+                    return Integer.MIN_VALUE;
                 }
-            }, true);
+                if (result > 0) {
+                    return Integer.MAX_VALUE;
+                }
+                return 0;
+            }
+        }, true);
 
-        assertTrue(chain.compare(new Integer(4), new Integer(5)) > 0);            
-        assertTrue(chain.compare(new Integer(5), new Integer(4)) < 0);            
-        assertTrue(chain.compare(new Integer(4), new Integer(4)) == 0);            
+        assertTrue(chain.compare(new Integer(4), new Integer(5)) > 0);
+        assertTrue(chain.compare(new Integer(5), new Integer(4)) < 0);
+        assertTrue(chain.compare(new Integer(4), new Integer(4)) == 0);
     }
 
-    public List getComparableObjectsOrdered() {
-        List list = new LinkedList();
+    public List<PseudoRow> getComparableObjectsOrdered() {
+        List<PseudoRow> list = new LinkedList<PseudoRow>();
         // this is the correct order assuming a
         // "0th forward, 1st reverse, 2nd forward" sort
-        list.add(new PseudoRow(1,2,3));
-        list.add(new PseudoRow(2,3,5));
-        list.add(new PseudoRow(2,2,4));
-        list.add(new PseudoRow(2,2,8));
-        list.add(new PseudoRow(3,1,0));
-        list.add(new PseudoRow(4,4,4));
-        list.add(new PseudoRow(4,4,7));
+        list.add(new PseudoRow(1, 2, 3));
+        list.add(new PseudoRow(2, 3, 5));
+        list.add(new PseudoRow(2, 2, 4));
+        list.add(new PseudoRow(2, 2, 8));
+        list.add(new PseudoRow(3, 1, 0));
+        list.add(new PseudoRow(4, 4, 4));
+        list.add(new PseudoRow(4, 4, 7));
         return list;
     }
 
+    @SuppressWarnings("serial")
     public static class PseudoRow implements Serializable {
 
         public int cols[] = new int[3];
@@ -170,8 +167,8 @@ public class TestComparatorChain extends AbstractTestComparator {
 
             if (getColumn(1) != row.getColumn(1)) {
                 return false;
-            }            
-            
+            }
+
             if (getColumn(2) != row.getColumn(2)) {
                 return false;
             }
@@ -181,7 +178,8 @@ public class TestComparatorChain extends AbstractTestComparator {
 
     }
 
-    public static class ColumnComparator implements Comparator,Serializable {
+    public static class ColumnComparator implements Comparator<PseudoRow>, Serializable {
+        private static final long serialVersionUID = -2284880866328872105L;
 
         protected int colIndex = 0;
 
@@ -189,32 +187,26 @@ public class TestComparatorChain extends AbstractTestComparator {
             this.colIndex = colIndex;
         }
 
-        public int compare(Object o1, Object o2) {
+        public int compare(PseudoRow o1, PseudoRow o2) {
 
-            int col1 = ( (PseudoRow) o1).getColumn(colIndex);
-            int col2 = ( (PseudoRow) o2).getColumn(colIndex);
+            int col1 = o1.getColumn(colIndex);
+            int col2 = o2.getColumn(colIndex);
 
             if (col1 > col2) {
                 return 1;
-            } else if (col1 < col2) {
+            }
+            if (col1 < col2) {
                 return -1;
             }
-
             return 0;
         }
-        
+
         public int hashCode() {
             return colIndex;
         }
-        
+
         public boolean equals(Object that) {
-            if(that instanceof ColumnComparator) {
-                return colIndex == ((ColumnComparator)that).colIndex;
-            } else {
-                return false;
-            }
+            return that instanceof ColumnComparator && colIndex == ((ColumnComparator) that).colIndex;
         }
-        
-        private static final long serialVersionUID = -2284880866328872105L;
     }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/comparators/TestFixedOrderComparator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/comparators/TestFixedOrderComparator.java b/src/test/org/apache/commons/collections/comparators/TestFixedOrderComparator.java
index ae05760..3174cb3 100644
--- a/src/test/org/apache/commons/collections/comparators/TestFixedOrderComparator.java
+++ b/src/test/org/apache/commons/collections/comparators/TestFixedOrderComparator.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.
@@ -28,15 +28,14 @@ import junit.framework.TestSuite;
 
 /**
  * Test class for FixedOrderComparator.
- * 
+ *
  * @version $Revision$ $Date$
- * 
- * @author David Leppik 
+ *
+ * @author David Leppik
  * @author Stephen Colebourne
  */
 public class TestFixedOrderComparator extends TestCase {
 
-
     /**
      * Top cities of the world, by population including metro areas.
      */
@@ -65,7 +64,7 @@ public class TestFixedOrderComparator extends TestCase {
         return new TestSuite(TestFixedOrderComparator.class);
     }
 
-    public static void main(String args[]) { 
+    public static void main(String args[]) {
         junit.textui.TestRunner.run(suite());
     }
 
@@ -79,11 +78,11 @@ public class TestFixedOrderComparator extends TestCase {
     // The tests
     //
 
-    /** 
-     * Tests that the constructor plus add method compares items properly. 
+    /**
+     * Tests that the constructor plus add method compares items properly.
      */
     public void testConstructorPlusAdd() {
-        FixedOrderComparator comparator = new FixedOrderComparator();
+        FixedOrderComparator<String> comparator = new FixedOrderComparator<String>();
         for (int i = 0; i < topCities.length; i++) {
             comparator.add(topCities[i]);
         }
@@ -91,13 +90,13 @@ public class TestFixedOrderComparator extends TestCase {
         assertComparatorYieldsOrder(keys, comparator);
     }
 
-    /** 
-     * Tests that the array constructor compares items properly. 
+    /**
+     * Tests that the array constructor compares items properly.
      */
     public void testArrayConstructor() {
         String[] keys = (String[]) topCities.clone();
         String[] topCitiesForTest = (String[]) topCities.clone();
-        FixedOrderComparator comparator = new FixedOrderComparator(topCitiesForTest);
+        FixedOrderComparator<String> comparator = new FixedOrderComparator<String>(topCitiesForTest);
         assertComparatorYieldsOrder(keys, comparator);
         // test that changing input after constructor has no effect
         topCitiesForTest[0] = "Brighton";
@@ -105,12 +104,12 @@ public class TestFixedOrderComparator extends TestCase {
     }
 
     /**
-     * Tests the list constructor. 
+     * Tests the list constructor.
      */
     public void testListConstructor() {
         String[] keys = (String[]) topCities.clone();
-        List topCitiesForTest = new LinkedList(Arrays.asList(topCities));
-        FixedOrderComparator comparator = new FixedOrderComparator(topCitiesForTest);
+        List<String> topCitiesForTest = new LinkedList<String>(Arrays.asList(topCities));
+        FixedOrderComparator<String> comparator = new FixedOrderComparator<String>(topCitiesForTest);
         assertComparatorYieldsOrder(keys, comparator);
         // test that changing input after constructor has no effect
         topCitiesForTest.set(0, "Brighton");
@@ -121,18 +120,18 @@ public class TestFixedOrderComparator extends TestCase {
      * Tests addAsEqual method.
      */
     public void testAddAsEqual() {
-        FixedOrderComparator comparator = new FixedOrderComparator(topCities);
+        FixedOrderComparator<String> comparator = new FixedOrderComparator<String>(topCities);
         comparator.addAsEqual("New York", "Minneapolis");
         assertEquals(0, comparator.compare("New York", "Minneapolis"));
         assertEquals(-1, comparator.compare("Tokyo", "Minneapolis"));
         assertEquals(1, comparator.compare("Shanghai", "Minneapolis"));
     }
 
-    /** 
+    /**
      * Tests whether or not updates are disabled after a comparison is made.
      */
     public void testLock() {
-        FixedOrderComparator comparator = new FixedOrderComparator(topCities);
+        FixedOrderComparator<String> comparator = new FixedOrderComparator<String>(topCities);
         assertEquals(false, comparator.isLocked());
         comparator.compare("New York", "Tokyo");
         assertEquals(true, comparator.isLocked());
@@ -152,7 +151,7 @@ public class TestFixedOrderComparator extends TestCase {
     }
 
     public void testUnknownObjectBehavior() {
-        FixedOrderComparator comparator = new FixedOrderComparator(topCities);
+        FixedOrderComparator<String> comparator = new FixedOrderComparator<String>(topCities);
         try {
             comparator.compare("New York", "Minneapolis");
             fail("Should have thrown a IllegalArgumentException");
@@ -165,42 +164,43 @@ public class TestFixedOrderComparator extends TestCase {
         } catch (IllegalArgumentException e) {
             // success-- ignore
         }
-        assertEquals(FixedOrderComparator.UNKNOWN_THROW_EXCEPTION, comparator.getUnknownObjectBehavior());
+        assertEquals(FixedOrderComparator.UnknownObjectBehavior.EXCEPTION, comparator.getUnknownObjectBehavior());
 
-        comparator = new FixedOrderComparator(topCities);
-        comparator.setUnknownObjectBehavior(FixedOrderComparator.UNKNOWN_BEFORE);
-        assertEquals(FixedOrderComparator.UNKNOWN_BEFORE, comparator.getUnknownObjectBehavior());
-        LinkedList keys = new LinkedList(Arrays.asList(topCities));
+        comparator = new FixedOrderComparator<String>(topCities);
+        comparator.setUnknownObjectBehavior(FixedOrderComparator.UnknownObjectBehavior.BEFORE);
+        assertEquals(FixedOrderComparator.UnknownObjectBehavior.BEFORE, comparator.getUnknownObjectBehavior());
+        LinkedList<String> keys = new LinkedList<String>(Arrays.asList(topCities));
         keys.addFirst("Minneapolis");
         assertComparatorYieldsOrder(keys.toArray(new String[0]), comparator);
-        
+
         assertEquals(-1, comparator.compare("Minneapolis", "New York"));
         assertEquals( 1, comparator.compare("New York", "Minneapolis"));
         assertEquals( 0, comparator.compare("Minneapolis", "St Paul"));
 
-        comparator = new FixedOrderComparator(topCities);
-        comparator.setUnknownObjectBehavior(FixedOrderComparator.UNKNOWN_AFTER);
-        keys = new LinkedList(Arrays.asList(topCities));
+        comparator = new FixedOrderComparator<String>(topCities);
+        comparator.setUnknownObjectBehavior(FixedOrderComparator.UnknownObjectBehavior.AFTER);
+        keys = new LinkedList<String>(Arrays.asList(topCities));
         keys.add("Minneapolis");
         assertComparatorYieldsOrder(keys.toArray(new String[0]), comparator);
-        
+
         assertEquals( 1, comparator.compare("Minneapolis", "New York"));
         assertEquals(-1, comparator.compare("New York", "Minneapolis"));
         assertEquals( 0, comparator.compare("Minneapolis", "St Paul"));
-        
+
     }
-    
+
     //
     // Helper methods
     //
-    
+
     /** Shuffles the keys and asserts that the comparator sorts them back to
      * their original order.
      */
-    private void assertComparatorYieldsOrder(Object[] orderedObjects, 
-                                             Comparator comparator) {
-        Object[] keys = (Object[]) orderedObjects.clone();
-        
+    @SuppressWarnings("unused")
+    private void assertComparatorYieldsOrder(String[] orderedObjects,
+                                             Comparator<String> comparator) {
+        String[] keys = orderedObjects.clone();
+
         // shuffle until the order changes.  It's extremely rare that
         // this requires more than one shuffle.
 
@@ -209,13 +209,13 @@ public class TestFixedOrderComparator extends TestCase {
             shuffle: {
                 Random rand = new Random();
                 for (int i = keys.length-1; i > 0; i--) {
-                        Object swap = keys[i];
+                        String swap = keys[i];
                         int j = rand.nextInt(i+1);
                         keys[i] = keys[j];
-                        keys[j] = swap;     
+                        keys[j] = swap;
                     }
             }
-        
+
             testShuffle: {
                 for (int i = 0; i < keys.length && !isInNewOrder; i++) {
                     if( !orderedObjects[i].equals(keys[i])) {
@@ -224,14 +224,14 @@ public class TestFixedOrderComparator extends TestCase {
                 }
             }
         }
-        
+
         // The real test:  sort and make sure they come out right.
-        
+
         Arrays.sort(keys, comparator);
 
         for (int i = 0; i < orderedObjects.length; i++) {
             assertEquals(orderedObjects[i], keys[i]);
         }
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/comparators/TestNullComparator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/comparators/TestNullComparator.java b/src/test/org/apache/commons/collections/comparators/TestNullComparator.java
index 26ae6ba..c57f25d 100644
--- a/src/test/org/apache/commons/collections/comparators/TestNullComparator.java
+++ b/src/test/org/apache/commons/collections/comparators/TestNullComparator.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.
@@ -25,12 +25,12 @@ import junit.framework.TestSuite;
 
 /**
  * Test the NullComparator.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Michael A. Smith
  */
-public abstract class TestNullComparator extends AbstractTestComparator {
+public abstract class TestNullComparator extends AbstractTestComparator<Integer> {
 
     public TestNullComparator(String testName) {
         super(testName);
@@ -48,45 +48,45 @@ public abstract class TestNullComparator extends AbstractTestComparator {
      **/
     public static class TestNullComparator1 extends TestNullComparator {
 
-	public TestNullComparator1(String testName) {
-	    super(testName);
-	}
+    	public TestNullComparator1(String testName) {
+    	    super(testName);
+    	}
 
-    public Comparator makeComparator() {
-	    return new NullComparator();
-	}
-	
-    public List getComparableObjectsOrdered() {
-        List list = new LinkedList();
-	    list.add(new Integer(1));
-	    list.add(new Integer(2));
-	    list.add(new Integer(3));
-	    list.add(new Integer(4));
-	    list.add(new Integer(5));
-	    list.add(null);
-	    return list;
-	}
+        public Comparator<Integer> makeObject() {
+    	    return new NullComparator<Integer>();
+    	}
 
-	public String getCanonicalComparatorName(Object object) {
-	    return super.getCanonicalComparatorName(object) + "1";
-	}
+        public List<Integer> getComparableObjectsOrdered() {
+            List<Integer> list = new LinkedList<Integer>();
+    	    list.add(new Integer(1));
+    	    list.add(new Integer(2));
+    	    list.add(new Integer(3));
+    	    list.add(new Integer(4));
+    	    list.add(new Integer(5));
+    	    list.add(null);
+    	    return list;
+    	}
+
+    	public String getCanonicalComparatorName(Object object) {
+    	    return super.getCanonicalComparatorName(object) + "1";
+    	}
     }
 
     /**
      *  Test the NullComparator with nulls low using the comparable comparator
      **/
     public static class TestNullComparator2 extends TestNullComparator {
-        
+
         public TestNullComparator2(String testName) {
             super(testName);
         }
-        
-        public Comparator makeComparator() {
-            return new NullComparator(false);
+
+        public Comparator<Integer> makeObject() {
+            return new NullComparator<Integer>(false);
         }
-        
-        public List getComparableObjectsOrdered() {
-            List list = new LinkedList();
+
+        public List<Integer> getComparableObjectsOrdered() {
+            List<Integer> list = new LinkedList<Integer>();
             list.add(null);
             list.add(new Integer(1));
             list.add(new Integer(2));
@@ -95,7 +95,7 @@ public abstract class TestNullComparator extends AbstractTestComparator {
             list.add(new Integer(5));
             return list;
         }
-        
+
         public String getCanonicalComparatorName(Object object) {
             return super.getCanonicalComparatorName(object) + "2";
         }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/comparators/TestReverseComparator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/comparators/TestReverseComparator.java b/src/test/org/apache/commons/collections/comparators/TestReverseComparator.java
index 43f168c..f12a073 100644
--- a/src/test/org/apache/commons/collections/comparators/TestReverseComparator.java
+++ b/src/test/org/apache/commons/collections/comparators/TestReverseComparator.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,12 +30,12 @@ import junit.framework.TestSuite;
 
 /**
  * Tests for ReverseComparator.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Unknown
  */
-public class TestReverseComparator extends AbstractTestComparator {
+public class TestReverseComparator extends AbstractTestComparator<Integer> {
 
     public TestReverseComparator(String testName) {
         super(testName);
@@ -46,21 +46,21 @@ public class TestReverseComparator extends AbstractTestComparator {
     }
 
     /**
-     * For the purposes of this test, return a 
+     * For the purposes of this test, return a
      * ReverseComparator that wraps the java.util.Collections.reverseOrder()
      * Comparator.  The resulting comparator should
      * sort according to natural Order.  (Note: we wrap
      * a Comparator taken from the JDK so that we can
      * save a "canonical" form in CVS.
-     * 
+     *
      * @return Comparator that returns "natural" order
      */
-    public Comparator makeComparator() {
-        return new ReverseComparator(Collections.reverseOrder());
+    public Comparator<Integer> makeObject() {
+        return new ReverseComparator<Integer>(Collections.<Integer>reverseOrder());
     }
 
-    public List getComparableObjectsOrdered() {
-        List list = new LinkedList();
+    public List<Integer> getComparableObjectsOrdered() {
+        List<Integer> list = new LinkedList<Integer>();
         list.add(new Integer(1));
         list.add(new Integer(2));
         list.add(new Integer(3));
@@ -69,11 +69,12 @@ public class TestReverseComparator extends AbstractTestComparator {
         return list;
     }
 
-    /** 
+    /**
      * Override this inherited test since Collections.reverseOrder
      * doesn't adhere to the "soft" Comparator contract, and we've
      * already "cannonized" the comparator returned by makeComparator.
      */
+    @SuppressWarnings("unchecked")
     public void testSerializeDeserializeThenCompare() throws Exception {
         Comparator comp = new ReverseComparator(new ComparableComparator());
 
@@ -81,7 +82,7 @@ public class TestReverseComparator extends AbstractTestComparator {
         ObjectOutputStream out = new ObjectOutputStream(buffer);
         out.writeObject(comp);
         out.close();
-            
+
         ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
         Object dest = in.readObject();
         in.close();

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/functors/TestAllPredicate.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/functors/TestAllPredicate.java b/src/test/org/apache/commons/collections/functors/TestAllPredicate.java
index db52bca..50fe7b2 100644
--- a/src/test/org/apache/commons/collections/functors/TestAllPredicate.java
+++ b/src/test/org/apache/commons/collections/functors/TestAllPredicate.java
@@ -49,7 +49,7 @@ public class TestAllPredicate extends TestAnyAllOnePredicate<Integer> {
      * {@inheritDoc}
      */    
     @Override
-    protected final Predicate<Integer> getPredicateInstance(final Collection<Predicate<? super Integer>> predicates) {
+    protected final Predicate<Integer> getPredicateInstance(final Collection<Predicate<Integer>> predicates) {
         return AllPredicate.allPredicate(predicates);
     }
 
@@ -58,8 +58,7 @@ public class TestAllPredicate extends TestAnyAllOnePredicate<Integer> {
      */
     @SuppressWarnings({"unchecked"})
     @Test
-    public void emptyArrayToGetInstance()
-    {
+    public void emptyArrayToGetInstance() {
         assertTrue("empty array not true", getPredicateInstance(new Predicate[] {}).evaluate(null));
     }
 
@@ -67,19 +66,18 @@ public class TestAllPredicate extends TestAnyAllOnePredicate<Integer> {
      * Verifies that providing an empty predicate collection evaluates to true.
      */
     @Test
-    public void emptyCollectionToGetInstance()
-    {
+    public void emptyCollectionToGetInstance() {
         final Predicate<Integer> allPredicate = getPredicateInstance(
-                Collections.<Predicate<? super Integer>>emptyList());
+                Collections.<Predicate<Integer>>emptyList());
         assertTrue("empty collection not true", allPredicate.evaluate(getTestValue()));
     }
 
     /**
      * Tests whether a single true predicate evaluates to true.
      */
+    @SuppressWarnings("unchecked")
     @Test
-    public void oneTruePredicate()
-    {
+    public void oneTruePredicate() {
         // use the constructor directly, as getInstance() returns the original predicate when passed
         // an array of size one.
         final Predicate<Integer> predicate = createMockPredicate(true);
@@ -91,9 +89,9 @@ public class TestAllPredicate extends TestAnyAllOnePredicate<Integer> {
     /**
      * Tests whether a single false predicate evaluates to true.
      */
+    @SuppressWarnings("unchecked")
     @Test
-    public void oneFalsePredicate()
-    {
+    public void oneFalsePredicate() {
         // use the constructor directly, as getInstance() returns the original predicate when passed
         // an array of size one.
         final Predicate<Integer> predicate = createMockPredicate(false);
@@ -105,8 +103,7 @@ public class TestAllPredicate extends TestAnyAllOnePredicate<Integer> {
      * Tests whether multiple true predicates evaluates to true.
      */
     @Test
-    public void allTrue()
-    {
+    public void allTrue() {
         assertTrue("multiple true predicates evaluated to false",
                 getPredicateInstance(true, true).evaluate(getTestValue()));
         assertTrue("multiple true predicates evaluated to false",
@@ -118,8 +115,7 @@ public class TestAllPredicate extends TestAnyAllOnePredicate<Integer> {
      * false predicate is actually evaluated
      */
     @Test
-    public void trueAndFalseCombined()
-    {
+    public void trueAndFalseCombined() {
         assertFalse("false predicate evaluated to true",
                 getPredicateInstance(false, null).evaluate(getTestValue()));
         assertFalse("false predicate evaluated to true",

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/functors/TestAnyAllOnePredicate.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/functors/TestAnyAllOnePredicate.java b/src/test/org/apache/commons/collections/functors/TestAnyAllOnePredicate.java
index c55cdf0..8870a92 100644
--- a/src/test/org/apache/commons/collections/functors/TestAnyAllOnePredicate.java
+++ b/src/test/org/apache/commons/collections/functors/TestAnyAllOnePredicate.java
@@ -1,3 +1,19 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  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.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
 package org.apache.commons.collections.functors;
 
 import org.apache.commons.collections.Predicate;
@@ -27,13 +43,12 @@ public abstract class TestAnyAllOnePredicate<T> extends TestCompositePredicate<T
         super(testValue);
     }
 
-
     /**
      * Tests whether <code>getInstance</code> with a one element array returns the first element in the array.
      */
+    @SuppressWarnings("unchecked")
     @Test
-    public final void singleElementArrayToGetInstance()
-    {
+    public final void singleElementArrayToGetInstance() {
         final Predicate<T> predicate = createMockPredicate(null);
         final Predicate<T> allPredicate = getPredicateInstance(predicate);
         assertSame("expected argument to be returned by getInstance()", predicate, allPredicate);
@@ -44,11 +59,10 @@ public abstract class TestAnyAllOnePredicate<T> extends TestCompositePredicate<T
      * collection.
      */
     @Test
-    public final void singletonCollectionToGetInstance()
-    {
+    public final void singletonCollectionToGetInstance() {
         final Predicate<T> predicate = createMockPredicate(null);
         final Predicate<T> allPredicate = getPredicateInstance(
-                Collections.<Predicate<? super T>>singleton(predicate));
+                Collections.<Predicate<T>>singleton(predicate));
         assertSame("expected singleton collection member to be returned by getInstance()",
                 predicate, allPredicate);
     }
@@ -57,8 +71,7 @@ public abstract class TestAnyAllOnePredicate<T> extends TestCompositePredicate<T
      * Tests creating composite predicate instances with single predicates and verifies that the composite returns
      * the same value as the single predicate does. 
      */
-    public final void singleValues()
-    {
+    public final void singleValues() {
         assertTrue(getPredicateInstance(true).evaluate(null));
         assertFalse(getPredicateInstance(false).evaluate(null));
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/functors/TestCompositePredicate.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/functors/TestCompositePredicate.java b/src/test/org/apache/commons/collections/functors/TestCompositePredicate.java
index 981a1d9..65b4e29 100644
--- a/src/test/org/apache/commons/collections/functors/TestCompositePredicate.java
+++ b/src/test/org/apache/commons/collections/functors/TestCompositePredicate.java
@@ -45,7 +45,7 @@ public abstract class TestCompositePredicate<T> extends MockPredicateTestBase<T>
      *
      * @return a predicate to test.
      */
-    protected abstract Predicate<T> getPredicateInstance(final Collection<Predicate<? super T>> predicates);
+    protected abstract Predicate<T> getPredicateInstance(final Collection<Predicate<T>> predicates);
 
     /**
      * Creates an instance of the predicate to test.
@@ -55,20 +55,19 @@ public abstract class TestCompositePredicate<T> extends MockPredicateTestBase<T>
      *
      * @return a predicate to test.
      */
-    protected final Predicate<T> getPredicateInstance(final Boolean ... mockReturnValues)
-    {
-        final List<Predicate<? super T>> predicates = new ArrayList<Predicate<? super T>>();
+    protected final Predicate<T> getPredicateInstance(final Boolean... mockReturnValues) {
+        final List<Predicate<T>> predicates = new ArrayList<Predicate<T>>();
         for (Boolean returnValue : mockReturnValues) {
             predicates.add(createMockPredicate(returnValue));
-        }        
+        }
         return getPredicateInstance(predicates);
     }
 
     /**
      * Tests whether <code>getInstance</code> with a one element array returns the first element in the array.
      */
-    public void singleElementArrayToGetInstance()
-    {
+    @SuppressWarnings("unchecked")
+    public void singleElementArrayToGetInstance() {
         final Predicate<T> predicate = createMockPredicate(null);
         final Predicate<T> allPredicate = getPredicateInstance(predicate);
         Assert.assertSame("expected argument to be returned by getInstance()", predicate, allPredicate);
@@ -78,18 +77,16 @@ public abstract class TestCompositePredicate<T> extends MockPredicateTestBase<T>
      * Tests that passing a singleton collection to <code>getInstance</code> returns the single element in the
      * collection.
      */
-    public void singletonCollectionToGetInstance()
-    {
+    public void singletonCollectionToGetInstance() {
         final Predicate<T> predicate = createMockPredicate(null);
         final Predicate<T> allPredicate = getPredicateInstance(
-                Collections.<Predicate<? super T>>singleton(predicate));
+                Collections.<Predicate<T>>singleton(predicate));
         Assert.assertSame("expected argument to be returned by getInstance()", predicate, allPredicate);
     }
 
     /**
      * Tests <code>getInstance</code> with a null predicate array.
      */
-    @SuppressWarnings({"unchecked"})
     @Test(expected = IllegalArgumentException.class)
     public final void nullArrayToGetInstance() {
         getPredicateInstance((Predicate<T>[]) null);
@@ -119,7 +116,7 @@ public abstract class TestCompositePredicate<T> extends MockPredicateTestBase<T>
      */
     @Test(expected = IllegalArgumentException.class)
     public final void nullCollectionToGetInstance() {
-        getPredicateInstance((Collection<Predicate<? super T>>) null);
+        getPredicateInstance((Collection<Predicate<T>>) null);
     }
 
     /**
@@ -127,7 +124,7 @@ public abstract class TestCompositePredicate<T> extends MockPredicateTestBase<T>
      */
     @Test(expected = IllegalArgumentException.class)
     public final void nullElementsInCollectionToGetInstance() {
-        final Collection<Predicate<? super T>> coll = new ArrayList<Predicate<? super T>>();
+        final Collection<Predicate<T>> coll = new ArrayList<Predicate<T>>();
         coll.add(null);
         coll.add(null);
         getPredicateInstance(coll);

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/AbstractTestIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/AbstractTestIterator.java b/src/test/org/apache/commons/collections/iterators/AbstractTestIterator.java
index ce3f52b..695aee8 100644
--- a/src/test/org/apache/commons/collections/iterators/AbstractTestIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/AbstractTestIterator.java
@@ -35,7 +35,7 @@ import org.apache.commons.collections.AbstractTestObject;
  * @author Morgan Delagrange
  * @author Stephen Colebourne
  */
-public abstract class AbstractTestIterator extends AbstractTestObject {
+public abstract class AbstractTestIterator<E> extends AbstractTestObject {
 
     /**
      * JUnit constructor.
@@ -52,23 +52,14 @@ public abstract class AbstractTestIterator extends AbstractTestObject {
      * 
      * @return an empty iterator
      */
-    public abstract Iterator makeEmptyIterator();
-
-    /**
-     * Implement this method to return an iterator over a collection with elements.
-     * 
-     * @return a full iterator
-     */
-    public abstract Iterator makeFullIterator();
+    public abstract Iterator<E> makeEmptyIterator();
 
     /**
      * Implements the abstract superclass method to return the full iterator.
      * 
      * @return a full iterator
      */
-    public Object makeObject() {
-        return makeFullIterator();
-    }
+    public abstract Iterator<E> makeObject();
 
     /**
      * Whether or not we are testing an iterator that can be empty.
@@ -116,7 +107,7 @@ public abstract class AbstractTestIterator extends AbstractTestObject {
             return;
         }
 
-        Iterator it = makeEmptyIterator();
+        Iterator<E> it = makeEmptyIterator();
         
         // hasNext() should return false
         assertEquals("hasNext() should return false for empty iterators", false, it.hasNext());
@@ -140,7 +131,7 @@ public abstract class AbstractTestIterator extends AbstractTestObject {
             return;
         }
 
-        Iterator it = makeFullIterator();
+        Iterator<E> it = makeObject();
 
         // hasNext() must be true (ensure makeFullIterator is correct!)
         assertEquals("hasNext() should return true for at least one element", true, it.hasNext());
@@ -172,7 +163,7 @@ public abstract class AbstractTestIterator extends AbstractTestObject {
      * Test remove behaviour.
      */
     public void testRemove() {
-        Iterator it = makeFullIterator();
+        Iterator<E> it = makeObject();
         
         if (supportsRemove() == false) {
             // check for UnsupportedOperationException if not supported

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/AbstractTestListIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/AbstractTestListIterator.java b/src/test/org/apache/commons/collections/iterators/AbstractTestListIterator.java
index 631952c..8ca9e3d 100644
--- a/src/test/org/apache/commons/collections/iterators/AbstractTestListIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/AbstractTestListIterator.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.
@@ -17,7 +17,6 @@
 package org.apache.commons.collections.iterators;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.ListIterator;
 import java.util.NoSuchElementException;
 
@@ -28,18 +27,18 @@ import java.util.NoSuchElementException;
  * 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 Rodney Waldhoff
  * @author Stephen Colebourne
  */
-public abstract class AbstractTestListIterator extends AbstractTestIterator {
+public abstract class AbstractTestListIterator<E> extends AbstractTestIterator<E> {
 
     /**
      * JUnit constructor.
-     * 
+     *
      * @param testName  the test class name
      */
     public AbstractTestListIterator(String testName) {
@@ -48,41 +47,23 @@ public abstract class AbstractTestListIterator extends AbstractTestIterator {
 
     //-----------------------------------------------------------------------
     /**
-     * Implement this method to return a list iterator over an empty collection.
-     * 
-     * @return an empty iterator
-     */
-    public abstract ListIterator makeEmptyListIterator();
-
-    /**
-     * Implement this method to return a list iterator over a collection with elements.
-     * 
-     * @return a full iterator
-     */
-    public abstract ListIterator makeFullListIterator();
-
-    /**
      * Implements the abstract superclass method to return the list iterator.
-     * 
+     *
      * @return an empty iterator
      */
-    public Iterator makeEmptyIterator() {
-        return makeEmptyListIterator();
-    }
+    public abstract ListIterator<E> makeEmptyIterator();
 
     /**
      * Implements the abstract superclass method to return the list iterator.
-     * 
+     *
      * @return a full iterator
      */
-    public Iterator makeFullIterator() {
-        return makeFullListIterator();
-    }
+    public abstract ListIterator<E> makeObject();
 
     /**
      * Whether or not we are testing an iterator that supports add().
      * Default is true.
-     * 
+     *
      * @return true if Iterator supports add
      */
     public boolean supportsAdd() {
@@ -92,7 +73,7 @@ public abstract class AbstractTestListIterator extends AbstractTestIterator {
     /**
      * Whether or not we are testing an iterator that supports set().
      * Default is true.
-     * 
+     *
      * @return true if Iterator supports set
      */
     public boolean supportsSet() {
@@ -103,7 +84,7 @@ public abstract class AbstractTestListIterator extends AbstractTestIterator {
      * The value to be used in the add and set tests.
      * Default is null.
      */
-    public Object addSetValue() {
+    public E addSetValue() {
         return null;
     }
 
@@ -116,20 +97,20 @@ public abstract class AbstractTestListIterator extends AbstractTestIterator {
             return;
         }
 
-        ListIterator it = makeEmptyListIterator();
-        
+        ListIterator<E> it = makeEmptyIterator();
+
         assertEquals(false, it.hasNext());
         assertEquals(0, it.nextIndex());
         assertEquals(false, it.hasPrevious());
         assertEquals(-1, it.previousIndex());
-        
+
         // 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();
@@ -137,17 +118,17 @@ public abstract class AbstractTestListIterator extends AbstractTestIterator {
         } catch (NoSuchElementException e) {
         }
     }
-    
+
     /**
      * Test navigation through the iterator.
      */
     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());
@@ -156,16 +137,16 @@ public abstract class AbstractTestListIterator extends AbstractTestIterator {
             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 + 1, it.nextIndex());
             assertEquals(i, it.previousIndex());
-        
+
             Object obj = list.get(i);
             assertEquals(obj, it.previous());
         }
-        
+
         // check state at start
         assertEquals(true, it.hasNext());
         assertEquals(false, it.hasPrevious());
@@ -175,14 +156,14 @@ public abstract class AbstractTestListIterator extends AbstractTestIterator {
         } catch (NoSuchElementException e) {
         }
     }
-    
+
     /**
      * Test add behaviour.
      */
     public void testAdd() {
-        ListIterator it = makeFullListIterator();
-        
-        Object addValue = addSetValue();
+        ListIterator<E> it = makeObject();
+
+        E addValue = addSetValue();
         if (supportsAdd() == false) {
             // check for UnsupportedOperationException if not supported
             try {
@@ -190,34 +171,34 @@ public abstract class AbstractTestListIterator extends AbstractTestIterator {
             } catch (UnsupportedOperationException ex) {}
             return;
         }
-        
+
         // add at start should be OK, added should be previous
-        it = makeFullListIterator();
+        it = makeObject();
         it.add(addValue);
         assertEquals(addValue, it.previous());
 
         // add at start should be OK, added should not be next
-        it = makeFullListIterator();
+        it = makeObject();
         it.add(addValue);
         assertTrue(addValue != it.next());
 
         // add in middle and at end should be OK
-        it = makeFullListIterator();
+        it = makeObject();
         while (it.hasNext()) {
             it.next();
             it.add(addValue);
             // check add OK
             assertEquals(addValue, it.previous());
             it.next();
-        }        
+        }
     }
-    
+
     /**
      * Test set behaviour.
      */
     public void testSet() {
-        ListIterator it = makeFullListIterator();
-        
+        ListIterator<E> it = makeObject();
+
         if (supportsSet() == false) {
             // check for UnsupportedOperationException if not supported
             try {
@@ -225,24 +206,24 @@ public abstract class AbstractTestListIterator extends AbstractTestIterator {
             } catch (UnsupportedOperationException ex) {}
             return;
         }
-        
+
         // should throw IllegalStateException before next() called
         try {
             it.set(addSetValue());
             fail();
         } catch (IllegalStateException ex) {}
-        
+
         // set after next should be fine
         it.next();
         it.set(addSetValue());
-        
+
         // repeated set calls should be fine
         it.set(addSetValue());
 
     }
-    
+
     public void testRemoveThenSet() {
-        ListIterator it = makeFullListIterator();
+        ListIterator<E> it = makeObject();
         if (supportsRemove() && supportsSet()) {
             it.next();
             it.remove();
@@ -255,7 +236,7 @@ public abstract class AbstractTestListIterator extends AbstractTestIterator {
     }
 
     public void testAddThenSet() {
-        ListIterator it = makeFullListIterator();        
+        ListIterator<E> it = makeObject();
         // add then set
         if (supportsAdd() && supportsSet()) {
             it.next();
@@ -267,13 +248,13 @@ public abstract class AbstractTestListIterator extends AbstractTestIterator {
             }
         }
     }
-    
+
     /**
      * Test remove after add behaviour.
      */
     public void testAddThenRemove() {
-        ListIterator it = makeFullListIterator();
-        
+        ListIterator<E> it = makeObject();
+
         // add then remove
         if (supportsAdd() && supportsRemove()) {
             it.next();
@@ -285,5 +266,5 @@ public abstract class AbstractTestListIterator extends AbstractTestIterator {
             }
         }
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/iterators/AbstractTestMapIterator.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/iterators/AbstractTestMapIterator.java b/src/test/org/apache/commons/collections/iterators/AbstractTestMapIterator.java
index 7d3752a..445cf7b 100644
--- a/src/test/org/apache/commons/collections/iterators/AbstractTestMapIterator.java
+++ b/src/test/org/apache/commons/collections/iterators/AbstractTestMapIterator.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.
@@ -17,7 +17,6 @@
 package org.apache.commons.collections.iterators;
 
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.NoSuchElementException;
 import java.util.Set;
@@ -31,17 +30,17 @@ import org.apache.commons.collections.MapIterator;
  * 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 AbstractTestMapIterator extends AbstractTestIterator {
+public abstract class AbstractTestMapIterator<K, V> extends AbstractTestIterator<K> {
 
     /**
      * JUnit constructor.
-     * 
+     *
      * @param testName  the test class name
      */
     public AbstractTestMapIterator(String testName) {
@@ -51,56 +50,38 @@ public abstract class AbstractTestMapIterator extends AbstractTestIterator {
     //-----------------------------------------------------------------------
     /**
      * Implement this method to return a map iterator over an empty map.
-     * 
+     *
      * @return an empty iterator
      */
-    public abstract MapIterator makeEmptyMapIterator();
+    public abstract MapIterator<K, V> makeEmptyIterator();
 
     /**
      * Implement this method to return a map iterator over a map with elements.
-     * 
+     *
      * @return a full iterator
      */
-    public abstract MapIterator makeFullMapIterator();
+    public abstract MapIterator<K, V> makeObject();
 
     /**
      * Implement this method to return the map which contains the same data as the
      * iterator.
-     * 
+     *
      * @return a full map which can be updated
      */
-    public abstract Map getMap();
-    
+    public abstract Map<K, V> getMap();
+
     /**
      * Implement this method to return the confirmed map which contains the same
      * data as the iterator.
-     * 
+     *
      * @return a full map which can be updated
      */
-    public abstract Map getConfirmedMap();
-    
-    /**
-     * Implements the abstract superclass method to return the list iterator.
-     * 
-     * @return an empty iterator
-     */
-    public final Iterator makeEmptyIterator() {
-        return makeEmptyMapIterator();
-    }
-
-    /**
-     * Implements the abstract superclass method to return the list iterator.
-     * 
-     * @return a full iterator
-     */
-    public final Iterator makeFullIterator() {
-        return makeFullMapIterator();
-    }
+    public abstract Map<K, V> getConfirmedMap();
 
     /**
      * Whether or not we are testing an iterator that supports setValue().
      * Default is true.
-     * 
+     *
      * @return true if Iterator supports set
      */
     public boolean supportsSetValue() {
@@ -110,19 +91,20 @@ public abstract class AbstractTestMapIterator extends AbstractTestIterator {
     /**
      * Whether the get operation on the map structurally modifies the map,
      * such as with LRUMap. Default is false.
-     * 
+     *
      * @return true if the get method structurally modifies the map
      */
     public boolean isGetStructuralModify() {
         return false;
     }
-    
+
     /**
      * The values to be used in the add and set tests.
      * Default is two strings.
      */
-    public Object[] addSetValues() {
-        return new Object[] {"A", "B"};
+    @SuppressWarnings("unchecked")
+    public V[] addSetValues() {
+        return (V[]) new Object[] { "A", "B" };
     }
 
     //-----------------------------------------------------------------------
@@ -134,28 +116,27 @@ public abstract class AbstractTestMapIterator extends AbstractTestIterator {
             return;
         }
 
-        MapIterator it = makeEmptyMapIterator();
-        Map map = getMap();
+        MapIterator<K, V> it = makeEmptyIterator();
         assertEquals(false, it.hasNext());
-        
+
         // next() should throw a NoSuchElementException
         try {
             it.next();
             fail();
         } catch (NoSuchElementException ex) {}
-        
+
         // getKey() should throw an IllegalStateException
         try {
             it.getKey();
             fail();
         } catch (IllegalStateException ex) {}
-        
+
         // getValue() should throw an IllegalStateException
         try {
             it.getValue();
             fail();
         } catch (IllegalStateException ex) {}
-        
+
         if (supportsSetValue() == false) {
             // setValue() should throw an UnsupportedOperationException/IllegalStateException
             try {
@@ -181,21 +162,21 @@ public abstract class AbstractTestMapIterator extends AbstractTestIterator {
             return;
         }
 
-        MapIterator it = makeFullMapIterator();
-        Map map = getMap();
+        MapIterator<K, V> it = makeObject();
+        Map<K, V> map = getMap();
         assertEquals(true, it.hasNext());
-        
+
         assertEquals(true, it.hasNext());
-        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);
             }
@@ -204,22 +185,22 @@ public abstract class AbstractTestMapIterator extends AbstractTestIterator {
             verify();
         }
     }
-    
+
     //-----------------------------------------------------------------------
     public void testMapIteratorSet() {
         if (supportsFullIterator() == false) {
             return;
         }
 
-        Object newValue = addSetValues()[0];
-        Object newValue2 = (addSetValues().length == 1 ? addSetValues()[0] : addSetValues()[1]);
-        MapIterator it = makeFullMapIterator();
-        Map map = getMap();
-        Map confirmed = getConfirmedMap();
+        V newValue = addSetValues()[0];
+        V newValue2 = (addSetValues().length == 1 ? addSetValues()[0] : addSetValues()[1]);
+        MapIterator<K, V> it = makeObject();
+        Map<K, V> map = getMap();
+        Map<K, V> confirmed = getConfirmedMap();
         assertEquals(true, it.hasNext());
-        Object key = it.next();
-        Object value = it.getValue();
-        
+        K key = it.next();
+        V value = it.getValue();
+
         if (supportsSetValue() == false) {
             try {
                 it.setValue(newValue);
@@ -227,24 +208,24 @@ public abstract class AbstractTestMapIterator extends AbstractTestIterator {
             } catch (UnsupportedOperationException ex) {}
             return;
         }
-        Object old = it.setValue(newValue);
+        V old = it.setValue(newValue);
         confirmed.put(key, newValue);
         assertSame("Key must not change after setValue", key, it.getKey());
         assertSame("Value must be changed after setValue", newValue, it.getValue());
         assertSame("setValue must return old value", value, old);
         assertEquals("Map must contain key", true, map.containsKey(key));
         // test against confirmed, as map may contain value twice
-        assertEquals("Map must not contain old value", 
+        assertEquals("Map must not contain old value",
             confirmed.containsValue(old), map.containsValue(old));
         assertEquals("Map must contain new value", true, map.containsValue(newValue));
         verify();
-        
+
         it.setValue(newValue);  // same value - should be OK
         confirmed.put(key, newValue);
         assertSame("Key must not change after setValue", key, it.getKey());
         assertSame("Value must be changed after setValue", newValue, it.getValue());
         verify();
-        
+
         it.setValue(newValue2);  // new value
         confirmed.put(key, newValue2);
         assertSame("Key must not change after setValue", key, it.getKey());
@@ -254,12 +235,12 @@ public abstract class AbstractTestMapIterator extends AbstractTestIterator {
 
     //-----------------------------------------------------------------------
     public void testRemove() { // override
-        MapIterator it = makeFullMapIterator();
-        Map map = getMap();
-        Map confirmed = getConfirmedMap();
+        MapIterator<K, V> it = makeObject();
+        Map<K, V> map = getMap();
+        Map<K, V> confirmed = getConfirmedMap();
         assertEquals(true, it.hasNext());
-        Object key = it.next();
-        
+        K key = it.next();
+
         if (supportsRemove() == false) {
             try {
                 it.remove();
@@ -268,12 +249,12 @@ public abstract class AbstractTestMapIterator extends AbstractTestIterator {
             }
             return;
         }
-        
+
         it.remove();
         confirmed.remove(key);
         assertEquals(false, map.containsKey(key));
         verify();
-        
+
         try {
             it.remove();  // second remove fails
         } catch (IllegalStateException ex) {
@@ -286,19 +267,18 @@ public abstract class AbstractTestMapIterator extends AbstractTestIterator {
         if (supportsSetValue() == false || supportsRemove() == false) {
             return;
         }
-        Object newValue = addSetValues()[0];
-        MapIterator it = makeFullMapIterator();
-        Map map = getMap();
-        Map confirmed = getConfirmedMap();
-        
+        V newValue = addSetValues()[0];
+        MapIterator<K, V> it = makeObject();
+        Map<K, V> confirmed = getConfirmedMap();
+
         assertEquals(true, it.hasNext());
-        Object key = it.next();
-        
+        K key = it.next();
+
         it.setValue(newValue);
         it.remove();
         confirmed.remove(key);
         verify();
-        
+
         try {
             it.setValue(newValue);
             fail();
@@ -311,17 +291,16 @@ public abstract class AbstractTestMapIterator extends AbstractTestIterator {
         if (supportsRemove() == false) {
             return;
         }
-        MapIterator it = makeFullMapIterator();
-        Map map = getMap();
-        Map confirmed = getConfirmedMap();
-        
+        MapIterator<K, V> it = makeObject();
+        Map<K, V> confirmed = getConfirmedMap();
+
         assertEquals(true, it.hasNext());
-        Object key = it.next();
-        
+        K key = it.next();
+
         it.remove();
         confirmed.remove(key);
         verify();
-        
+
         try {
             it.getKey();
             fail();
@@ -334,17 +313,16 @@ public abstract class AbstractTestMapIterator extends AbstractTestIterator {
         if (supportsRemove() == false) {
             return;
         }
-        MapIterator it = makeFullMapIterator();
-        Map map = getMap();
-        Map confirmed = getConfirmedMap();
-        
+        MapIterator<K, V> it = makeObject();
+        Map<K, V> confirmed = getConfirmedMap();
+
         assertEquals(true, it.hasNext());
-        Object key = it.next();
-        
+        K key = it.next();
+
         it.remove();
         confirmed.remove(key);
         verify();
-        
+
         try {
             it.getValue();
             fail();


[63/77] [abbrv] commons-collections git commit: [COLLECTIONS-286] CollectionsUtils.extractSingleton

Posted by ch...@apache.org.
[COLLECTIONS-286] CollectionsUtils.extractSingleton

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@813951 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/0a52bf59
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/0a52bf59
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/0a52bf59

Branch: refs/heads/collections_jdk5_branch
Commit: 0a52bf59a788abfd5cc64c3cbe0cc73cbbfb4cfd
Parents: dabd240
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Fri Sep 11 17:48:55 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Fri Sep 11 17:48:55 2009 +0000

----------------------------------------------------------------------
 .../commons/collections/CollectionUtils.java    | 13 +++++++++++
 .../collections/TestCollectionUtils.java        | 23 ++++++++++++++++++++
 2 files changed, 36 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/0a52bf59/src/java/org/apache/commons/collections/CollectionUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/CollectionUtils.java b/src/java/org/apache/commons/collections/CollectionUtils.java
index cf34edc..89b06e4 100644
--- a/src/java/org/apache/commons/collections/CollectionUtils.java
+++ b/src/java/org/apache/commons/collections/CollectionUtils.java
@@ -1291,4 +1291,17 @@ public class CollectionUtils {
         return TransformedCollection.decorate(collection, transformer);
     }
 
+    /**
+     * Extract the lone element of the specified Collection.
+     * @param <E> collection type
+     * @param collection to read
+     * @return sole member of collection
+     * @throws IllegalArgumentException if collection is null/empty or contains more than one element
+     */
+    public static <E> E extractSingleton(Collection<E> collection) {
+        if (collection == null || collection.size() != 1) {
+            throw new IllegalArgumentException("Can extract singleton only when collection size == 1");
+        }
+        return collection.iterator().next();
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/0a52bf59/src/test/org/apache/commons/collections/TestCollectionUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestCollectionUtils.java b/src/test/org/apache/commons/collections/TestCollectionUtils.java
index 7b613e6..6d102fb 100644
--- a/src/test/org/apache/commons/collections/TestCollectionUtils.java
+++ b/src/test/org/apache/commons/collections/TestCollectionUtils.java
@@ -1414,6 +1414,29 @@ public class TestCollectionUtils extends MockTestCase {
         assertEquals(collectionA, Arrays.asList(a));
     }
 
+    @Test
+    public void extractSingleton() {
+        ArrayList<String> coll = null;
+        try {
+            CollectionUtils.extractSingleton(coll);
+            fail("expected IllegalArgumentException from extractSingleton(null)");
+        } catch (IllegalArgumentException e) {
+        }
+        coll = new ArrayList<String>();
+        try {
+            CollectionUtils.extractSingleton(coll);
+            fail("expected IllegalArgumentException from extractSingleton(empty)");
+        } catch (IllegalArgumentException e) {
+        }
+        coll.add("foo");
+        assertEquals("foo", CollectionUtils.extractSingleton(coll));
+        coll.add("bar");
+        try {
+            CollectionUtils.extractSingleton(coll);
+            fail("expected IllegalArgumentException from extractSingleton(size == 2)");
+        } catch (IllegalArgumentException e) {
+        }
+    }
 
     /**
      * Records the next object returned for a mock iterator


[09/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
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) {


[59/77] [abbrv] commons-collections git commit: Fix DOAP tags

Posted by ch...@apache.org.
Fix DOAP tags

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@779518 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/4da4d2fd
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/4da4d2fd
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/4da4d2fd

Branch: refs/heads/collections_jdk5_branch
Commit: 4da4d2fd1503d9855fbc2df24579dca6c2baa90b
Parents: 91796da
Author: Sebastian Bazley <se...@apache.org>
Authored: Thu May 28 10:00:55 2009 +0000
Committer: Sebastian Bazley <se...@apache.org>
Committed: Thu May 28 10:00:55 2009 +0000

----------------------------------------------------------------------
 doap_collections.rdf | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/4da4d2fd/doap_collections.rdf
----------------------------------------------------------------------
diff --git a/doap_collections.rdf b/doap_collections.rdf
index ca5ceb3..f02a3a0 100644
--- a/doap_collections.rdf
+++ b/doap_collections.rdf
@@ -34,21 +34,21 @@ limitations under the License.
       </SVNRepository>
     </repository>
     <release>
-      <revision>
+      <Version>
         <name>commons-collections</name>
         <created>2006-05-14</created>
-        <version>3.2</version>
-      </revision>
-      <revision>
+        <revision>3.2</version>
+      </Version>
+      <Version>
         <name>commons-collections</name>
         <created>2004-06-23</created>
-        <version>3.1</version>
-      </revision>
-      <revision>
+        <revision>3.1</version>
+      </Version>
+      <Version>
         <name>commons-collections</name>
         <created>2004-06-23</created>
-        <version>2.1.1</version>
-      </revision>
+        <revision>2.1.1</version>
+      </Version>
     </release>
     <mailing-list rdf:resource="http://commons.apache.org/mail-lists.html"/>
   </Project>


[67/77] [abbrv] commons-collections git commit: Get does not clear()

Posted by ch...@apache.org.
Get does not clear()

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@814060 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/bb91d002
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/bb91d002
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/bb91d002

Branch: refs/heads/collections_jdk5_branch
Commit: bb91d002c26389b8d1a025e019b3746e995a6b01
Parents: 06cccbc
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Fri Sep 11 22:21:50 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Fri Sep 11 22:21:50 2009 +0000

----------------------------------------------------------------------
 .../collections/splitmap/AbstractIterableGetMapDecorator.java    | 4 ----
 1 file changed, 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bb91d002/src/java/org/apache/commons/collections/splitmap/AbstractIterableGetMapDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/splitmap/AbstractIterableGetMapDecorator.java b/src/java/org/apache/commons/collections/splitmap/AbstractIterableGetMapDecorator.java
index 2b06bfd..14390ba 100644
--- a/src/java/org/apache/commons/collections/splitmap/AbstractIterableGetMapDecorator.java
+++ b/src/java/org/apache/commons/collections/splitmap/AbstractIterableGetMapDecorator.java
@@ -56,10 +56,6 @@ public class AbstractIterableGetMapDecorator<K, V> implements IterableGet<K, V>
         return map;
     }
 
-    public void clear() {
-        decorated().clear();
-    }
-
     /**
      * {@inheritDoc}
      */


[02/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestPredicatedSortedMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestPredicatedSortedMap.java b/src/test/org/apache/commons/collections/map/TestPredicatedSortedMap.java
index b59367f..1fa8164 100644
--- a/src/test/org/apache/commons/collections/map/TestPredicatedSortedMap.java
+++ b/src/test/org/apache/commons/collections/map/TestPredicatedSortedMap.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.
@@ -27,57 +27,54 @@ import junit.framework.Test;
 import junit.framework.TestSuite;
 
 import org.apache.commons.collections.Predicate;
-import org.apache.commons.collections.PredicateUtils;
+import org.apache.commons.collections.functors.TruePredicate;
 
 /**
- * Extension of {@link TestPredicatedMap} for exercising the 
+ * Extension of {@link TestPredicatedMap} for exercising the
  * {@link PredicatedSortedMap} implementation.
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  */
-public class TestPredicatedSortedMap extends AbstractTestSortedMap{
-    
-    protected static final Predicate truePredicate = PredicateUtils.truePredicate();
-    protected static final Predicate testPredicate = new Predicate() {
+public class TestPredicatedSortedMap<K, V> extends AbstractTestSortedMap<K, V> {
+
+    protected static final Predicate<Object> truePredicate = TruePredicate.truePredicate();
+
+    protected static final Predicate<Object> testPredicate = new Predicate<Object>() {
         public boolean evaluate(Object o) {
             return (o instanceof String);
         }
     };
-    
+
     public TestPredicatedSortedMap(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return new TestSuite(TestPredicatedSortedMap.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestPredicatedSortedMap.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
 
     //-----------------------------------------------------------------------
-    protected SortedMap decorateMap(SortedMap map, Predicate keyPredicate, 
-        Predicate valuePredicate) {
+    protected SortedMap<K, V> decorateMap(SortedMap<K, V> map, Predicate<? super K> keyPredicate,
+        Predicate<? super V> valuePredicate) {
         return PredicatedSortedMap.decorate(map, keyPredicate, valuePredicate);
     }
-    
-    public Map makeEmptyMap() {
-        return decorateMap(new TreeMap(), truePredicate, truePredicate);
+
+    public SortedMap<K, V> makeObject() {
+        return decorateMap(new TreeMap<K, V>(), truePredicate, truePredicate);
     }
-   
-    public Map makeTestMap() {
-        return decorateMap(new TreeMap(), testPredicate, testPredicate);
-    } 
-    
-    public SortedMap makeTestSortedMap() {
-        return decorateMap(new TreeMap(), testPredicate, testPredicate);
+
+    public SortedMap<K, V> makeTestMap() {
+        return decorateMap(new TreeMap<K, V>(), testPredicate, testPredicate);
     }
-    
+
     public boolean isSubMapViewsSerializable() {
         // TreeMap sub map views have a bug in deserialization.
         return false;
@@ -89,28 +86,30 @@ public class TestPredicatedSortedMap extends AbstractTestSortedMap{
 
     // from TestPredicatedMap
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testEntrySet() {
-        SortedMap map = makeTestSortedMap();
+        SortedMap<K, V> map = makeTestMap();
         assertTrue("returned entryset should not be null",
             map.entrySet() != null);
-        map = decorateMap(new TreeMap(), null, null);
-        map.put("oneKey", "oneValue");
+        map = decorateMap(new TreeMap<K, V>(), null, null);
+        map.put((K) "oneKey", (V) "oneValue");
         assertTrue("returned entryset should contain one entry",
-            map.entrySet().size() == 1); 
+            map.entrySet().size() == 1);
         map = decorateMap(map, null, null);
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testPut() {
-        Map map = makeTestMap();
+        Map<K, V> map = makeTestMap();
         try {
-            map.put("Hi", new Integer(3));
+            map.put((K) "Hi", (V) new Integer(3));
             fail("Illegal value should raise IllegalArgument");
         } catch (IllegalArgumentException e) {
             // expected
         }
 
         try {
-            map.put(new Integer(3), "Hi");
+            map.put((K) new Integer(3), (V) "Hi");
             fail("Illegal key should raise IllegalArgument");
         } catch (IllegalArgumentException e) {
             // expected
@@ -119,11 +118,11 @@ public class TestPredicatedSortedMap extends AbstractTestSortedMap{
         assertTrue(!map.containsKey(new Integer(3)));
         assertTrue(!map.containsValue(new Integer(3)));
 
-        Map map2 = new HashMap();
-        map2.put("A", "a");
-        map2.put("B", "b");
-        map2.put("C", "c");
-        map2.put("c", new Integer(3));
+        Map<K, V> map2 = new HashMap<K, V>();
+        map2.put((K) "A", (V) "a");
+        map2.put((K) "B", (V) "b");
+        map2.put((K) "C", (V) "c");
+        map2.put((K) "c", (V) new Integer(3));
 
         try {
             map.putAll(map2);
@@ -132,52 +131,53 @@ public class TestPredicatedSortedMap extends AbstractTestSortedMap{
             // expected
         }
 
-        map.put("E", "e");
-        Iterator iterator = map.entrySet().iterator();
+        map.put((K) "E", (V) "e");
+        Iterator<Map.Entry<K, V>> iterator = map.entrySet().iterator();
         try {
-            Map.Entry entry = (Map.Entry)iterator.next();
-            entry.setValue(new Integer(3));
+            Map.Entry<K, V> entry = iterator.next();
+            entry.setValue((V) new Integer(3));
             fail("Illegal value should raise IllegalArgument");
         } catch (IllegalArgumentException e) {
             // expected
         }
-        
-        map.put("F", "f");
+
+        map.put((K) "F", (V) "f");
         iterator = map.entrySet().iterator();
-        Map.Entry entry = (Map.Entry)iterator.next();
-        entry.setValue("x");
-        
+        Map.Entry<K, V> entry = iterator.next();
+        entry.setValue((V) "x");
+
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testSortOrder() {
-        SortedMap map = makeTestSortedMap();
-        map.put("A",  "a");
-        map.put("B", "b");
+        SortedMap<K, V> map = makeTestMap();
+        map.put((K) "A",  (V) "a");
+        map.put((K) "B", (V) "b");
         try {
-            map.put(null, "c");
+            map.put(null, (V) "c");
             fail("Null key should raise IllegalArgument");
         } catch (IllegalArgumentException e) {
             // expected
         }
-        map.put("C", "c");
+        map.put((K) "C", (V) "c");
         try {
-            map.put("D", null);
+            map.put((K) "D", null);
             fail("Null value should raise IllegalArgument");
         } catch (IllegalArgumentException e) {
             // expected
         }
         assertEquals("First key should be A", map.firstKey(), "A");
         assertEquals("Last key should be C", map.lastKey(), "C");
-        assertEquals("First key in tail map should be B", 
-            map.tailMap("B").firstKey(), "B");
-        assertEquals("Last key in head map should be B", 
-            map.headMap("C").lastKey(), "B");
+        assertEquals("First key in tail map should be B",
+            map.tailMap((K) "B").firstKey(), "B");
+        assertEquals("Last key in head map should be B",
+            map.headMap((K) "C").lastKey(), "B");
         assertEquals("Last key in submap should be B",
-           map.subMap("A","C").lastKey(), "B");
-        
-        Comparator c = map.comparator();
-        assertTrue("natural order, so comparator should be null", 
+           map.subMap((K) "A",(K) "C").lastKey(), "B");
+
+        Comparator<? super K> c = map.comparator();
+        assertTrue("natural order, so comparator should be null",
             c == null);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestReferenceIdentityMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestReferenceIdentityMap.java b/src/test/org/apache/commons/collections/map/TestReferenceIdentityMap.java
index 6bb4432..421950a 100644
--- a/src/test/org/apache/commons/collections/map/TestReferenceIdentityMap.java
+++ b/src/test/org/apache/commons/collections/map/TestReferenceIdentityMap.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,17 +24,18 @@ import junit.framework.Test;
 
 import org.apache.commons.collections.BulkTest;
 import org.apache.commons.collections.IterableMap;
+import org.apache.commons.collections.map.AbstractReferenceMap.ReferenceStrength;
 
 /**
- * Tests for ReferenceIdentityMap. 
- * 
+ * Tests for ReferenceIdentityMap.
+ *
  * @version $Revision$
  *
  * @author Paul Jack
  * @author Stephen Colebourne
  * @author Guilhem Lavaux
  */
-public class TestReferenceIdentityMap extends AbstractTestIterableMap {
+public class TestReferenceIdentityMap<K, V> extends AbstractTestIterableMap<K, V> {
 
     private static final Integer I1A = new Integer(1);
     private static final Integer I1B = new Integer(1);
@@ -54,15 +55,15 @@ public class TestReferenceIdentityMap extends AbstractTestIterableMap {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Map makeEmptyMap() {
-        ReferenceIdentityMap map = new ReferenceIdentityMap(ReferenceIdentityMap.WEAK, ReferenceIdentityMap.WEAK);
-        return map;
+    public ReferenceIdentityMap<K, V> makeObject() {
+        return new ReferenceIdentityMap<K, V>(ReferenceStrength.WEAK, ReferenceStrength.WEAK);
     }
-    
-    public Map makeConfirmedMap() {
+
+    public Map<K, V> makeConfirmedMap() {
         // Testing against another [collections] class generally isn't a good idea,
-        // but the alternative is a JDK1.4 dependency in the tests
-        return new IdentityMap();
+        // but the closest alternative is IdentityHashMap, which propagates reference-equality down to keySet and values.
+        // arguably ReferenceIdentityMap should do the same but that's a later discussion.
+        return new IdentityMap<K, V>();
     }
 
     public boolean isAllowNullKey() {
@@ -78,11 +79,12 @@ public class TestReferenceIdentityMap extends AbstractTestIterableMap {
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testBasics() {
-        IterableMap map = new ReferenceIdentityMap(ReferenceIdentityMap.HARD, ReferenceIdentityMap.HARD);
+        IterableMap<K, V> map = new ReferenceIdentityMap<K, V>(ReferenceStrength.HARD, ReferenceStrength.HARD);
         assertEquals(0, map.size());
-        
-        map.put(I1A, I2A);
+
+        map.put((K) I1A, (V) I2A);
         assertEquals(1, map.size());
         assertSame(I2A, map.get(I1A));
         assertSame(null, map.get(I1B));
@@ -90,8 +92,8 @@ public class TestReferenceIdentityMap extends AbstractTestIterableMap {
         assertEquals(false, map.containsKey(I1B));
         assertEquals(true, map.containsValue(I2A));
         assertEquals(false, map.containsValue(I2B));
-        
-        map.put(I1A, I2B);
+
+        map.put((K) I1A, (V) I2B);
         assertEquals(1, map.size());
         assertSame(I2B, map.get(I1A));
         assertSame(null, map.get(I1B));
@@ -99,8 +101,8 @@ public class TestReferenceIdentityMap extends AbstractTestIterableMap {
         assertEquals(false, map.containsKey(I1B));
         assertEquals(false, map.containsValue(I2A));
         assertEquals(true, map.containsValue(I2B));
-        
-        map.put(I1B, I2B);
+
+        map.put((K) I1B, (V) I2B);
         assertEquals(2, map.size());
         assertSame(I2B, map.get(I1A));
         assertSame(I2B, map.get(I1B));
@@ -109,45 +111,46 @@ public class TestReferenceIdentityMap extends AbstractTestIterableMap {
         assertEquals(false, map.containsValue(I2A));
         assertEquals(true, map.containsValue(I2B));
     }
-    
+
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testHashEntry() {
-        IterableMap map = new ReferenceIdentityMap(ReferenceIdentityMap.HARD, ReferenceIdentityMap.HARD);
-        
-        map.put(I1A, I2A);
-        map.put(I1B, I2A);
-        
-        Map.Entry entry1 = (Map.Entry) map.entrySet().iterator().next();
-        Iterator it = map.entrySet().iterator();
-        Map.Entry entry2 = (Map.Entry) it.next();
-        Map.Entry entry3 = (Map.Entry) it.next();
-        
+        IterableMap<K, V> map = new ReferenceIdentityMap<K, V>(ReferenceStrength.HARD, ReferenceStrength.HARD);
+
+        map.put((K) I1A, (V) I2A);
+        map.put((K) I1B, (V) I2A);
+
+        Map.Entry<K, V> entry1 = map.entrySet().iterator().next();
+        Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
+        Map.Entry<K, V> entry2 = it.next();
+        Map.Entry<K, V> entry3 = it.next();
+
         assertEquals(true, entry1.equals(entry2));
         assertEquals(true, entry2.equals(entry1));
         assertEquals(false, entry1.equals(entry3));
     }
-    
-    
+
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testNullHandling() {
         resetFull();
-        assertEquals(null, map.get(null));
-        assertEquals(false, map.containsKey(null));
-        assertEquals(false, map.containsValue(null));
-        assertEquals(null, map.remove(null));
-        assertEquals(false, map.entrySet().contains(null));
-        assertEquals(false, map.keySet().contains(null));
-        assertEquals(false, map.values().contains(null));
+        assertEquals(null, getMap().get(null));
+        assertEquals(false, getMap().containsKey(null));
+        assertEquals(false, getMap().containsValue(null));
+        assertEquals(null, getMap().remove(null));
+        assertEquals(false, getMap().entrySet().contains(null));
+        assertEquals(false, getMap().keySet().contains(null));
+        assertEquals(false, getMap().values().contains(null));
         try {
-            map.put(null, null);
+            getMap().put(null, null);
             fail();
         } catch (NullPointerException ex) {}
         try {
-            map.put(new Object(), null);
+            getMap().put((K) new Object(), null);
             fail();
         } catch (NullPointerException ex) {}
         try {
-            map.put(null, new Object());
+            getMap().put(null, (V) new Object());
             fail();
         } catch (NullPointerException ex) {}
     }
@@ -263,19 +266,20 @@ public class TestReferenceIdentityMap extends AbstractTestIterableMap {
     }
 */
 
-    WeakReference keyReference;
-    WeakReference valueReference;
-
-    public Map buildRefMap() {
-        Object key = new Object();
-        Object value = new Object();
-        
-        keyReference = new WeakReference(key);
-        valueReference = new WeakReference(value);
-        
-        Map testMap = new ReferenceIdentityMap(ReferenceMap.WEAK, ReferenceMap.HARD, true);
+    WeakReference<K> keyReference;
+    WeakReference<V> valueReference;
+
+    @SuppressWarnings("unchecked")
+    private Map<K, V> buildRefMap() {
+        K key = (K) new Object();
+        V value = (V) new Object();
+
+        keyReference = new WeakReference<K>(key);
+        valueReference = new WeakReference<V>(value);
+
+        Map<K, V> testMap = new ReferenceIdentityMap<K, V>(ReferenceStrength.WEAK, ReferenceStrength.HARD, true);
         testMap.put(key, value);
- 
+
         assertEquals("In map", value, testMap.get(key));
         assertNotNull("Weak reference released early (1)", keyReference.get());
         assertNotNull("Weak reference released early (2)", valueReference.get());
@@ -285,29 +289,31 @@ public class TestReferenceIdentityMap extends AbstractTestIterableMap {
     /** Tests whether purge values setting works */
     public void testPurgeValues() throws Exception {
         // many thanks to Juozas Baliuka for suggesting this method
-        Map testMap = buildRefMap();
-        
+        Map<K, V> testMap = buildRefMap();
+
         int iterations = 0;
         int bytz = 2;
-        while(true) {
+        while (true) {
             System.gc();
-            if(iterations++ > 50){
+            if (iterations++ > 50) {
                 fail("Max iterations reached before resource released.");
             }
             testMap.isEmpty();
-            if( 
+            if (
                 keyReference.get() == null &&
                 valueReference.get() == null) {
                 break;
-                
+
             } else {
                 // create garbage:
+                @SuppressWarnings("unused")
                 byte[] b =  new byte[bytz];
                 bytz = bytz * 2;
             }
         }
     }
 
+    @SuppressWarnings("unused")
     private static void gc() {
         try {
             // trigger GC

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestReferenceMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestReferenceMap.java b/src/test/org/apache/commons/collections/map/TestReferenceMap.java
index fbdae7b..d4c05d2 100644
--- a/src/test/org/apache/commons/collections/map/TestReferenceMap.java
+++ b/src/test/org/apache/commons/collections/map/TestReferenceMap.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.
@@ -22,16 +22,17 @@ import java.util.Map;
 import junit.framework.Test;
 
 import org.apache.commons.collections.BulkTest;
+import org.apache.commons.collections.map.AbstractReferenceMap.ReferenceStrength;
 
 /**
- * Tests for ReferenceMap. 
- * 
+ * Tests for ReferenceMap.
+ *
  * @version $Revision$ $Date$
  *
  * @author Paul Jack
  * @author Guilhem Lavaux
  */
-public class TestReferenceMap extends AbstractTestIterableMap {
+public class TestReferenceMap<K, V> extends AbstractTestIterableMap<K, V> {
 
     public TestReferenceMap(String testName) {
         super(testName);
@@ -46,9 +47,8 @@ public class TestReferenceMap extends AbstractTestIterableMap {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Map makeEmptyMap() {
-        ReferenceMap map = new ReferenceMap(ReferenceMap.WEAK, ReferenceMap.WEAK);
-        return map;
+    public ReferenceMap<K, V> makeObject() {
+        return new ReferenceMap<K, V>(ReferenceStrength.WEAK, ReferenceStrength.WEAK);
     }
 
     public boolean isAllowNullKey() {
@@ -64,6 +64,7 @@ public class TestReferenceMap extends AbstractTestIterableMap {
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testNullHandling() {
         resetFull();
         assertEquals(null, map.get(null));
@@ -78,11 +79,11 @@ public class TestReferenceMap extends AbstractTestIterableMap {
             fail();
         } catch (NullPointerException ex) {}
         try {
-            map.put(new Object(), null);
+            map.put((K) new Object(), null);
             fail();
         } catch (NullPointerException ex) {}
         try {
-            map.put(null, new Object());
+            map.put(null, (V) new Object());
             fail();
         } catch (NullPointerException ex) {}
     }
@@ -198,19 +199,20 @@ public class TestReferenceMap extends AbstractTestIterableMap {
     }
 */
 
-    WeakReference keyReference;
-    WeakReference valueReference;
-
-    public Map buildRefMap() {
-        Object key = new Object();
-        Object value = new Object();
-        
-        keyReference = new WeakReference(key);
-        valueReference = new WeakReference(value);
-        
-        Map testMap = new ReferenceMap(ReferenceMap.WEAK, ReferenceMap.HARD, true);
+    WeakReference<K> keyReference;
+    WeakReference<V> valueReference;
+
+    @SuppressWarnings("unchecked")
+    public Map<K, V> buildRefMap() {
+        K key = (K) new Object();
+        V value = (V) new Object();
+
+        keyReference = new WeakReference<K>(key);
+        valueReference = new WeakReference<V>(value);
+
+        Map<K, V> testMap = new ReferenceMap<K, V>(ReferenceStrength.WEAK, ReferenceStrength.HARD, true);
         testMap.put(key, value);
- 
+
         assertEquals("In map", value, testMap.get(key));
         assertNotNull("Weak reference released early (1)", keyReference.get());
         assertNotNull("Weak reference released early (2)", valueReference.get());
@@ -220,29 +222,29 @@ public class TestReferenceMap extends AbstractTestIterableMap {
     /** Tests whether purge values setting works */
     public void testPurgeValues() throws Exception {
         // many thanks to Juozas Baliuka for suggesting this method
-        Map testMap = buildRefMap();
+        Map<K, V> testMap = buildRefMap();
 
         int iterations = 0;
         int bytz = 2;
-        while(true) {
+        while (true) {
             System.gc();
-            if(iterations++ > 50){
+            if (iterations++ > 50) {
                 fail("Max iterations reached before resource released.");
             }
             testMap.isEmpty();
-            if( 
-                keyReference.get() == null &&
-                valueReference.get() == null) {
+            if (keyReference.get() == null && valueReference.get() == null) {
                 break;
-                
+
             } else {
                 // create garbage:
-                byte[] b =  new byte[bytz];
+                @SuppressWarnings("unused")
+                byte[] b = new byte[bytz];
                 bytz = bytz * 2;
             }
         }
     }
 
+    @SuppressWarnings("unused")
     private static void gc() {
         try {
             // trigger GC

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestSingletonMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestSingletonMap.java b/src/test/org/apache/commons/collections/map/TestSingletonMap.java
index 26134a8..575f1bc 100644
--- a/src/test/org/apache/commons/collections/map/TestSingletonMap.java
+++ b/src/test/org/apache/commons/collections/map/TestSingletonMap.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.
@@ -17,7 +17,6 @@
 package org.apache.commons.collections.map;
 
 import java.util.HashMap;
-import java.util.Map;
 
 import junit.framework.Test;
 import junit.textui.TestRunner;
@@ -25,21 +24,21 @@ import junit.textui.TestRunner;
 import org.apache.commons.collections.BoundedMap;
 import org.apache.commons.collections.BulkTest;
 import org.apache.commons.collections.KeyValue;
+import org.apache.commons.collections.OrderedMap;
 
 /**
  * JUnit tests.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestSingletonMap extends AbstractTestOrderedMap {
+public class TestSingletonMap<K, V> extends AbstractTestOrderedMap<K, V> {
 
     private static final Integer ONE = new Integer(1);
     private static final Integer TWO = new Integer(2);
     private static final String TEN = "10";
-    private static final String TWENTY = "20";
-        
+
     public TestSingletonMap(String testName) {
         super(testName);
     }
@@ -47,18 +46,18 @@ public class TestSingletonMap extends AbstractTestOrderedMap {
     public static void main(String[] args) {
         TestRunner.run(suite());
     }
-    
+
     public static Test suite() {
         return BulkTest.makeSuite(TestSingletonMap.class);
     }
 
     //-----------------------------------------------------------------------
-    public Map makeEmptyMap() {
+    public OrderedMap<K, V> makeObject() {
         // need an empty singleton map, but thats not possible
         // use a ridiculous fake instead to make the tests pass
-        return UnmodifiableOrderedMap.decorate(ListOrderedMap.decorate(new HashMap()));
+        return UnmodifiableOrderedMap.decorate(ListOrderedMap.decorate(new HashMap<K, V>()));
     }
-    
+
     public String[] ignoredTests() {
         // the ridiculous map above still doesn't pass these tests
         // but its not relevant, so we ignore them
@@ -68,9 +67,9 @@ public class TestSingletonMap extends AbstractTestOrderedMap {
         };
     }
 
-
-    public Map makeFullMap() {
-        return new SingletonMap(ONE, TWO);
+    @SuppressWarnings("unchecked")
+    public SingletonMap<K, V> makeFullMap() {
+        return new SingletonMap<K, V>((K) ONE, (V) TWO);
     }
 
     public boolean isPutAddSupported() {
@@ -81,30 +80,33 @@ public class TestSingletonMap extends AbstractTestOrderedMap {
         return false;
     }
 
-    public Object[] getSampleKeys() {
-        return new Object[] {ONE};
+    @SuppressWarnings("unchecked")
+    public K[] getSampleKeys() {
+        return (K[]) new Object[] { ONE };
     }
 
-    public Object[] getSampleValues() {
-        return new Object[] {TWO};
+    @SuppressWarnings("unchecked")
+    public V[] getSampleValues() {
+        return (V[]) new Object[] { TWO };
     }
 
-    public Object[] getNewSampleValues() {
-        return new Object[] {TEN};
+    @SuppressWarnings("unchecked")
+    public V[] getNewSampleValues() {
+        return (V[]) new Object[] { TEN };
     }
 
     //-----------------------------------------------------------------------
     public void testClone() {
-        SingletonMap map = new SingletonMap(ONE, TWO);
+        SingletonMap<K, V> map = makeFullMap();
         assertEquals(1, map.size());
-        SingletonMap cloned = (SingletonMap) map.clone();
+        SingletonMap<K, V> cloned = map.clone();
         assertEquals(1, cloned.size());
         assertEquals(true, cloned.containsKey(ONE));
         assertEquals(true, cloned.containsValue(TWO));
     }
 
     public void testKeyValue() {
-        SingletonMap map = new SingletonMap(ONE, TWO);
+        SingletonMap<K, V> map = makeFullMap();
         assertEquals(1, map.size());
         assertEquals(ONE, map.getKey());
         assertEquals(TWO, map.getValue());
@@ -112,7 +114,7 @@ public class TestSingletonMap extends AbstractTestOrderedMap {
     }
 
     public void testBoundedMap() {
-        SingletonMap map = new SingletonMap(ONE, TWO);
+        SingletonMap<K, V> map = makeFullMap();
         assertEquals(1, map.size());
         assertEquals(true, map.isFull());
         assertEquals(1, map.maxSize());
@@ -123,16 +125,16 @@ public class TestSingletonMap extends AbstractTestOrderedMap {
 //    public BulkTest bulkTestMapIterator() {
 //        return new TestFlatMapIterator();
 //    }
-//    
+//
 //    public class TestFlatMapIterator extends AbstractTestOrderedMapIterator {
 //        public TestFlatMapIterator() {
 //            super("TestFlatMapIterator");
 //        }
-//        
+//
 //        public Object[] addSetValues() {
 //            return TestSingletonMap.this.getNewSampleValues();
 //        }
-//        
+//
 //        public boolean supportsRemove() {
 //            return TestSingletonMap.this.isRemoveSupported();
 //        }
@@ -150,23 +152,23 @@ public class TestSingletonMap extends AbstractTestOrderedMap {
 //            resetFull();
 //            return ((Flat3Map) TestSingletonMap.this.map).mapIterator();
 //        }
-//        
+//
 //        public Map getMap() {
 //            // assumes makeFullMapIterator() called first
 //            return TestSingletonMap.this.map;
 //        }
-//        
+//
 //        public Map getConfirmedMap() {
 //            // assumes makeFullMapIterator() called first
 //            return TestSingletonMap.this.confirmed;
 //        }
-//        
+//
 //        public void verify() {
 //            super.verify();
 //            TestSingletonMap.this.verify();
 //        }
 //    }
-    
+
     public String getCompatibilityVersion() {
         return "3.1";
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestStaticBucketMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestStaticBucketMap.java b/src/test/org/apache/commons/collections/map/TestStaticBucketMap.java
index ac96d87..a9c1c70 100644
--- a/src/test/org/apache/commons/collections/map/TestStaticBucketMap.java
+++ b/src/test/org/apache/commons/collections/map/TestStaticBucketMap.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,8 +16,6 @@
  */
 package org.apache.commons.collections.map;
 
-import java.util.Map;
-
 import junit.framework.Test;
 
 import org.apache.commons.collections.BulkTest;
@@ -25,12 +23,12 @@ import org.apache.commons.collections.BulkTest;
 /**
  * Unit tests.
  * {@link StaticBucketMap}.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Michael A. Smith
  */
-public class TestStaticBucketMap extends AbstractTestMap {
+public class TestStaticBucketMap<K, V> extends AbstractTestMap<K, V> {
 
     public TestStaticBucketMap(String name) {
         super(name);
@@ -45,8 +43,8 @@ public class TestStaticBucketMap extends AbstractTestMap {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Map makeEmptyMap() {
-        return new StaticBucketMap(30);
+    public StaticBucketMap<K, V> makeObject() {
+        return new StaticBucketMap<K, V>(30);
     }
 
     public String[] ignoredTests() {
@@ -60,9 +58,10 @@ public class TestStaticBucketMap extends AbstractTestMap {
     }
 
     // Bugzilla 37567
+    @SuppressWarnings("unchecked")
     public void test_get_nullMatchesIncorrectly() {
-        StaticBucketMap map = new StaticBucketMap(17);
-        map.put(null, "A");
+        StaticBucketMap<K, V> map = new StaticBucketMap<K, V>(17);
+        map.put(null, (V) "A");
         assertEquals("A", map.get(null));
         // loop so we find a string that is in the same bucket as the null
         for (int i = 'A'; i <= 'Z'; i++) {
@@ -71,9 +70,10 @@ public class TestStaticBucketMap extends AbstractTestMap {
         }
     }
 
+    @SuppressWarnings("unchecked")
     public void test_containsKey_nullMatchesIncorrectly() {
-        StaticBucketMap map = new StaticBucketMap(17);
-        map.put(null, "A");
+        StaticBucketMap<K, V> map = new StaticBucketMap<K, V>(17);
+        map.put(null, (V) "A");
         assertEquals(true, map.containsKey(null));
         // loop so we find a string that is in the same bucket as the null
         for (int i = 'A'; i <= 'Z'; i++) {
@@ -82,9 +82,10 @@ public class TestStaticBucketMap extends AbstractTestMap {
         }
     }
 
+    @SuppressWarnings("unchecked")
     public void test_containsValue_nullMatchesIncorrectly() {
-        StaticBucketMap map = new StaticBucketMap(17);
-        map.put("A", null);
+        StaticBucketMap<K, V> map = new StaticBucketMap<K, V>(17);
+        map.put((K) "A", null);
         assertEquals(true, map.containsValue(null));
         // loop so we find a string that is in the same bucket as the null
         for (int i = 'A'; i <= 'Z'; i++) {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestTransformedMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestTransformedMap.java b/src/test/org/apache/commons/collections/map/TestTransformedMap.java
index 59e93ea..15f8a18 100644
--- a/src/test/org/apache/commons/collections/map/TestTransformedMap.java
+++ b/src/test/org/apache/commons/collections/map/TestTransformedMap.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,6 +23,7 @@ import java.util.Set;
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
+import org.apache.commons.collections.Transformer;
 import org.apache.commons.collections.TransformerUtils;
 import org.apache.commons.collections.collection.TestTransformedCollection;
 
@@ -32,11 +33,11 @@ import org.apache.commons.collections.collection.TestTransformedCollection;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestTransformedMap extends AbstractTestMap {
-    
+public class TestTransformedMap<K, V> extends AbstractTestMap<K, V> {
+
     public TestTransformedMap(String testName) {
         super(testName);
     }
@@ -51,32 +52,38 @@ public class TestTransformedMap extends AbstractTestMap {
     }
 
     //-----------------------------------------------------------------------
-    public Map makeEmptyMap() {
-        return TransformedMap.decorate(new HashMap(), TransformerUtils.nopTransformer(), TransformerUtils.nopTransformer());
+    public Map<K, V> makeObject() {
+        return TransformedMap.decorate(new HashMap<K, V>(), TransformerUtils.<K> nopTransformer(),
+                TransformerUtils.<V> nopTransformer());
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testTransformedMap() {
-        Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
+        Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" };
 
-        Map map = TransformedMap.decorate(new HashMap(), TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER, null);
+        Map<K, V> map = TransformedMap
+                .decorate(
+                        new HashMap<K, V>(),
+                        (Transformer<? super K, ? extends K>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER,
+                        null);
         assertEquals(0, map.size());
         for (int i = 0; i < els.length; i++) {
-            map.put(els[i], els[i]);
+            map.put((K) els[i], (V) els[i]);
             assertEquals(i + 1, map.size());
             assertEquals(true, map.containsKey(new Integer((String) els[i])));
             assertEquals(false, map.containsKey(els[i]));
             assertEquals(true, map.containsValue(els[i]));
             assertEquals(els[i], map.get(new Integer((String) els[i])));
         }
-        
+
         assertEquals(null, map.remove(els[0]));
         assertEquals(els[0], map.remove(new Integer((String) els[0])));
-        
+
         map = TransformedMap.decorate(new HashMap(), null, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(0, map.size());
         for (int i = 0; i < els.length; i++) {
-            map.put(els[i], els[i]);
+            map.put((K) els[i], (V) els[i]);
             assertEquals(i + 1, map.size());
             assertEquals(true, map.containsValue(new Integer((String) els[i])));
             assertEquals(false, map.containsValue(els[i]));
@@ -85,13 +92,13 @@ public class TestTransformedMap extends AbstractTestMap {
         }
 
         assertEquals(new Integer((String) els[0]), map.remove(els[0]));
-        
+
         Set entrySet = map.entrySet();
         Map.Entry[] array = (Map.Entry[]) entrySet.toArray(new Map.Entry[0]);
         array[0].setValue("66");
         assertEquals(new Integer(66), array[0].getValue());
         assertEquals(new Integer(66), map.get(array[0].getKey()));
-        
+
         Map.Entry entry = (Map.Entry) entrySet.iterator().next();
         entry.setValue("88");
         assertEquals(new Integer(88), entry.getValue());
@@ -99,33 +106,43 @@ public class TestTransformedMap extends AbstractTestMap {
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testFactory_Decorate() {
-        Map base = new HashMap();
-        base.put("A", "1");
-        base.put("B", "2");
-        base.put("C", "3");
-        
-        Map trans = TransformedMap.decorate(base, null, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
+        Map<K, V> base = new HashMap<K, V>();
+        base.put((K) "A", (V) "1");
+        base.put((K) "B", (V) "2");
+        base.put((K) "C", (V) "3");
+
+        Map<K, V> trans = TransformedMap
+                .decorate(
+                        base,
+                        null,
+                        (Transformer<? super V, ? extends V>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(3, trans.size());
         assertEquals("1", trans.get("A"));
         assertEquals("2", trans.get("B"));
         assertEquals("3", trans.get("C"));
-        trans.put("D", "4");
+        trans.put((K) "D", (V) "4");
         assertEquals(new Integer(4), trans.get("D"));
     }
 
+    @SuppressWarnings("unchecked")
     public void testFactory_decorateTransform() {
-        Map base = new HashMap();
-        base.put("A", "1");
-        base.put("B", "2");
-        base.put("C", "3");
-        
-        Map trans = TransformedMap.decorateTransform(base, null, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
+        Map<K, V> base = new HashMap<K, V>();
+        base.put((K) "A", (V) "1");
+        base.put((K) "B", (V) "2");
+        base.put((K) "C", (V) "3");
+
+        Map<K, V> trans = TransformedMap
+                .decorateTransform(
+                        base,
+                        null,
+                        (Transformer<? super V, ? extends V>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(3, trans.size());
         assertEquals(new Integer(1), trans.get("A"));
         assertEquals(new Integer(2), trans.get("B"));
         assertEquals(new Integer(3), trans.get("C"));
-        trans.put("D", "4");
+        trans.put((K) "D", (V) "4");
         assertEquals(new Integer(4), trans.get("D"));
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestTransformedSortedMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestTransformedSortedMap.java b/src/test/org/apache/commons/collections/map/TestTransformedSortedMap.java
index 4749c3c..0d52348 100644
--- a/src/test/org/apache/commons/collections/map/TestTransformedSortedMap.java
+++ b/src/test/org/apache/commons/collections/map/TestTransformedSortedMap.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,6 +24,7 @@ import java.util.TreeMap;
 import junit.framework.Test;
 
 import org.apache.commons.collections.BulkTest;
+import org.apache.commons.collections.Transformer;
 import org.apache.commons.collections.TransformerUtils;
 import org.apache.commons.collections.collection.TestTransformedCollection;
 
@@ -33,11 +34,11 @@ import org.apache.commons.collections.collection.TestTransformedCollection;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestTransformedSortedMap extends AbstractTestSortedMap {
-    
+public class TestTransformedSortedMap<K, V> extends AbstractTestSortedMap<K, V> {
+
     public TestTransformedSortedMap(String testName) {
         super(testName);
     }
@@ -52,8 +53,11 @@ public class TestTransformedSortedMap extends AbstractTestSortedMap {
     }
 
     //-----------------------------------------------------------------------
-    public Map makeEmptyMap() {
-        return TransformedSortedMap.decorate(new TreeMap(), TransformerUtils.nopTransformer(), TransformerUtils.nopTransformer());
+    @SuppressWarnings("unchecked")
+    public SortedMap<K, V> makeObject() {
+        return TransformedSortedMap.decorate(new TreeMap<K, V>(),
+                (Transformer<? super K, ? extends K>) TransformerUtils.nopTransformer(),
+                (Transformer<? super V, ? extends V>) TransformerUtils.nopTransformer());
     }
 
     public boolean isSubMapViewsSerializable() {
@@ -61,14 +65,19 @@ public class TestTransformedSortedMap extends AbstractTestSortedMap {
         return false;
     }
 
-    //-----------------------------------------------------------------------    
+    //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testTransformedMap() {
-        Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
+        Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" };
 
-        Map map = TransformedSortedMap.decorate(new TreeMap(), TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER, null);
+        SortedMap<K, V> map = TransformedSortedMap
+                .decorate(
+                        new TreeMap<K, V>(),
+                        (Transformer<? super K, ? extends K>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER,
+                        null);
         assertEquals(0, map.size());
         for (int i = 0; i < els.length; i++) {
-            map.put(els[i], els[i]);
+            map.put((K) els[i], (V) els[i]);
             assertEquals(i + 1, map.size());
             assertEquals(true, map.containsKey(new Integer((String) els[i])));
             try {
@@ -78,17 +87,21 @@ public class TestTransformedSortedMap extends AbstractTestSortedMap {
             assertEquals(true, map.containsValue(els[i]));
             assertEquals(els[i], map.get(new Integer((String) els[i])));
         }
-        
+
         try {
             map.remove(els[0]);
             fail();
         } catch (ClassCastException ex) {}
         assertEquals(els[0], map.remove(new Integer((String) els[0])));
-        
-        map = TransformedSortedMap.decorate(new TreeMap(), null, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
+
+        map = TransformedSortedMap
+                .decorate(
+                        new TreeMap<K, V>(),
+                        null,
+                        (Transformer<? super V, ? extends V>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(0, map.size());
         for (int i = 0; i < els.length; i++) {
-            map.put(els[i], els[i]);
+            map.put((K) els[i], (V) els[i]);
             assertEquals(i + 1, map.size());
             assertEquals(true, map.containsValue(new Integer((String) els[i])));
             assertEquals(false, map.containsValue(els[i]));
@@ -97,47 +110,57 @@ public class TestTransformedSortedMap extends AbstractTestSortedMap {
         }
 
         assertEquals(new Integer((String) els[0]), map.remove(els[0]));
-        
-        Set entrySet = map.entrySet();
-        Map.Entry[] array = (Map.Entry[]) entrySet.toArray(new Map.Entry[0]);
-        array[0].setValue("66");
+
+        Set<Map.Entry<K, V>> entrySet = map.entrySet();
+        Map.Entry<K, V>[] array = (Map.Entry<K, V>[]) entrySet.toArray(new Map.Entry[0]);
+        array[0].setValue((V) "66");
         assertEquals(new Integer(66), array[0].getValue());
         assertEquals(new Integer(66), map.get(array[0].getKey()));
-        
-        Map.Entry entry = (Map.Entry) entrySet.iterator().next();
-        entry.setValue("88");
+
+        Map.Entry<K, V> entry = entrySet.iterator().next();
+        entry.setValue((V) "88");
         assertEquals(new Integer(88), entry.getValue());
         assertEquals(new Integer(88), map.get(entry.getKey()));
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testFactory_Decorate() {
-        SortedMap base = new TreeMap();
-        base.put("A", "1");
-        base.put("B", "2");
-        base.put("C", "3");
-        
-        SortedMap trans = TransformedSortedMap.decorate(base, null, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
+        SortedMap<K, V> base = new TreeMap<K, V>();
+        base.put((K) "A", (V) "1");
+        base.put((K) "B", (V) "2");
+        base.put((K) "C", (V) "3");
+
+        SortedMap<K, V> trans = TransformedSortedMap
+                .decorate(
+                        base,
+                        null,
+                        (Transformer<? super V, ? extends V>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(3, trans.size());
         assertEquals("1", trans.get("A"));
         assertEquals("2", trans.get("B"));
         assertEquals("3", trans.get("C"));
-        trans.put("D", "4");
+        trans.put((K) "D", (V) "4");
         assertEquals(new Integer(4), trans.get("D"));
     }
 
+    @SuppressWarnings("unchecked")
     public void testFactory_decorateTransform() {
-        SortedMap base = new TreeMap();
-        base.put("A", "1");
-        base.put("B", "2");
-        base.put("C", "3");
-        
-        SortedMap trans = TransformedSortedMap.decorateTransform(base, null, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
+        SortedMap<K, V> base = new TreeMap<K, V>();
+        base.put((K) "A", (V) "1");
+        base.put((K) "B", (V) "2");
+        base.put((K) "C", (V) "3");
+
+        SortedMap<K, V> trans = TransformedSortedMap
+                .decorateTransform(
+                        base,
+                        null,
+                        (Transformer<? super V, ? extends V>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(3, trans.size());
         assertEquals(new Integer(1), trans.get("A"));
         assertEquals(new Integer(2), trans.get("B"));
         assertEquals(new Integer(3), trans.get("C"));
-        trans.put("D", "4");
+        trans.put((K) "D", (V) "4");
         assertEquals(new Integer(4), trans.get("D"));
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestUnmodifiableMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestUnmodifiableMap.java b/src/test/org/apache/commons/collections/map/TestUnmodifiableMap.java
index 949a079..9eb2b8c 100644
--- a/src/test/org/apache/commons/collections/map/TestUnmodifiableMap.java
+++ b/src/test/org/apache/commons/collections/map/TestUnmodifiableMap.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.
@@ -22,66 +22,67 @@ import java.util.Map;
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
+import org.apache.commons.collections.IterableMap;
 import org.apache.commons.collections.Unmodifiable;
 
 /**
- * Extension of {@link AbstractTestMap} for exercising the 
+ * Extension of {@link AbstractTestMap} for exercising the
  * {@link UnmodifiableMap} implementation.
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Phil Steitz
  */
-public class TestUnmodifiableMap extends AbstractTestIterableMap{
-    
+public class TestUnmodifiableMap<K, V> extends AbstractTestIterableMap<K, V> {
+
     public TestUnmodifiableMap(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return new TestSuite(TestUnmodifiableMap.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestUnmodifiableMap.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
-    
+
     //-------------------------------------------------------------------
-    
-    public Map makeEmptyMap() {
-        return UnmodifiableMap.decorate(new HashMap());
+
+    public IterableMap<K, V> makeObject() {
+        return (IterableMap<K, V>) UnmodifiableMap.decorate(new HashMap<K, V>());
     }
-    
+
     public boolean isPutChangeSupported() {
         return false;
     }
-    
+
     public boolean isPutAddSupported() {
         return false;
     }
-    
+
     public boolean isRemoveSupported() {
         return false;
     }
-    
-    public Map makeFullMap() {
-        Map m = new HashMap();
+
+    public IterableMap<K, V> makeFullMap() {
+        Map<K, V> m = new HashMap<K, V>();
         addSampleMappings(m);
-        return UnmodifiableMap.decorate(m);
+        return (IterableMap<K, V>) UnmodifiableMap.decorate(m);
     }
-    
+
     //-----------------------------------------------------------------------
     public void testUnmodifiable() {
-        assertTrue(makeEmptyMap() instanceof Unmodifiable);
+        assertTrue(makeObject() instanceof Unmodifiable);
         assertTrue(makeFullMap() instanceof Unmodifiable);
     }
-    
+
     public void testDecorateFactory() {
-        Map map = makeFullMap();
+        Map<K, V> map = makeFullMap();
         assertSame(map, UnmodifiableMap.decorate(map));
-        
+
         try {
             UnmodifiableMap.decorate(null);
             fail();

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestUnmodifiableOrderedMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestUnmodifiableOrderedMap.java b/src/test/org/apache/commons/collections/map/TestUnmodifiableOrderedMap.java
index 9b831fe..74f4a9e 100644
--- a/src/test/org/apache/commons/collections/map/TestUnmodifiableOrderedMap.java
+++ b/src/test/org/apache/commons/collections/map/TestUnmodifiableOrderedMap.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.
@@ -17,7 +17,6 @@
 package org.apache.commons.collections.map;
 
 import java.util.HashMap;
-import java.util.Map;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -26,63 +25,63 @@ import org.apache.commons.collections.OrderedMap;
 import org.apache.commons.collections.Unmodifiable;
 
 /**
- * Extension of {@link AbstractTestOrderedMap} for exercising the 
+ * Extension of {@link AbstractTestOrderedMap} for exercising the
  * {@link UnmodifiableOrderedMap} implementation.
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestUnmodifiableOrderedMap extends AbstractTestOrderedMap {
-    
+public class TestUnmodifiableOrderedMap<K, V> extends AbstractTestOrderedMap<K, V> {
+
     public TestUnmodifiableOrderedMap(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return new TestSuite(TestUnmodifiableOrderedMap.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestUnmodifiableOrderedMap.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
-    
+
     //-------------------------------------------------------------------
-    
-    public Map makeEmptyMap() {
-        return UnmodifiableOrderedMap.decorate(ListOrderedMap.decorate(new HashMap()));
+
+    public OrderedMap<K, V> makeObject() {
+        return UnmodifiableOrderedMap.decorate(ListOrderedMap.decorate(new HashMap<K, V>()));
     }
-    
+
     public boolean isPutChangeSupported() {
         return false;
     }
-    
+
     public boolean isPutAddSupported() {
         return false;
     }
-    
+
     public boolean isRemoveSupported() {
         return false;
     }
-    
-    public Map makeFullMap() {
-        OrderedMap m = ListOrderedMap.decorate(new HashMap());
+
+    public OrderedMap<K, V> makeFullMap() {
+        OrderedMap<K, V> m = ListOrderedMap.decorate(new HashMap<K, V>());
         addSampleMappings(m);
         return UnmodifiableOrderedMap.decorate(m);
     }
-    
+
     //-----------------------------------------------------------------------
     public void testUnmodifiable() {
-        assertTrue(makeEmptyMap() instanceof Unmodifiable);
+        assertTrue(makeObject() instanceof Unmodifiable);
         assertTrue(makeFullMap() instanceof Unmodifiable);
     }
-    
+
     public void testDecorateFactory() {
-        Map map = makeFullMap();
-        assertSame(map, UnmodifiableOrderedMap.decorate((OrderedMap) map));
-        
+        OrderedMap<K, V> map = makeFullMap();
+        assertSame(map, UnmodifiableOrderedMap.decorate(map));
+
         try {
             UnmodifiableOrderedMap.decorate(null);
             fail();

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestUnmodifiableSortedMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestUnmodifiableSortedMap.java b/src/test/org/apache/commons/collections/map/TestUnmodifiableSortedMap.java
index 3922b1b..eb155e9 100644
--- a/src/test/org/apache/commons/collections/map/TestUnmodifiableSortedMap.java
+++ b/src/test/org/apache/commons/collections/map/TestUnmodifiableSortedMap.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,7 +16,6 @@
  */
 package org.apache.commons.collections.map;
 
-import java.util.Map;
 import java.util.SortedMap;
 import java.util.TreeMap;
 
@@ -26,63 +25,63 @@ import junit.framework.TestSuite;
 import org.apache.commons.collections.Unmodifiable;
 
 /**
- * Extension of {@link AbstractTestSortedMap} for exercising the 
+ * Extension of {@link AbstractTestSortedMap} for exercising the
  * {@link UnmodifiableSortedMap} implementation.
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestUnmodifiableSortedMap extends AbstractTestSortedMap {
-    
+public class TestUnmodifiableSortedMap<K, V> extends AbstractTestSortedMap<K, V> {
+
     public TestUnmodifiableSortedMap(String testName) {
         super(testName);
     }
-    
+
     public static Test suite() {
         return new TestSuite(TestUnmodifiableSortedMap.class);
     }
-    
+
     public static void main(String args[]) {
         String[] testCaseName = { TestUnmodifiableSortedMap.class.getName()};
         junit.textui.TestRunner.main(testCaseName);
     }
-    
+
     //-------------------------------------------------------------------
-    
-    public Map makeEmptyMap() {
-        return UnmodifiableSortedMap.decorate(new TreeMap());
+
+    public SortedMap<K, V> makeObject() {
+        return UnmodifiableSortedMap.decorate(new TreeMap<K, V>());
     }
-    
+
     public boolean isPutChangeSupported() {
         return false;
     }
-    
+
     public boolean isPutAddSupported() {
         return false;
     }
-    
+
     public boolean isRemoveSupported() {
         return false;
     }
-    
-    public Map makeFullMap() {
-        SortedMap m = new TreeMap();
+
+    public SortedMap<K, V> makeFullMap() {
+        SortedMap<K, V> m = new TreeMap<K, V>();
         addSampleMappings(m);
         return UnmodifiableSortedMap.decorate(m);
     }
-    
+
     //-----------------------------------------------------------------------
     public void testUnmodifiable() {
-        assertTrue(makeEmptyMap() instanceof Unmodifiable);
+        assertTrue(makeObject() instanceof Unmodifiable);
         assertTrue(makeFullMap() instanceof Unmodifiable);
     }
-    
+
     public void testDecorateFactory() {
-        Map map = makeFullMap();
-        assertSame(map, UnmodifiableSortedMap.decorate((SortedMap) map));
-        
+        SortedMap<K, V> map = makeFullMap();
+        assertSame(map, UnmodifiableSortedMap.decorate(map));
+
         try {
             UnmodifiableSortedMap.decorate(null);
             fail();

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/AbstractTestSet.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/AbstractTestSet.java b/src/test/org/apache/commons/collections/set/AbstractTestSet.java
index 77b37a8..46f1649 100644
--- a/src/test/org/apache/commons/collections/set/AbstractTestSet.java
+++ b/src/test/org/apache/commons/collections/set/AbstractTestSet.java
@@ -43,7 +43,7 @@ import org.apache.commons.collections.collection.AbstractTestCollection;
  * 
  * @author Paul Jack
  */
-public abstract class AbstractTestSet extends AbstractTestCollection {
+public abstract class AbstractTestSet<E> extends AbstractTestCollection<E> {
 
     /**
      * JUnit constructor.
@@ -61,14 +61,13 @@ public abstract class AbstractTestSet extends AbstractTestCollection {
     public void verify() {
         super.verify();
         
-        assertEquals("Sets should be equal", confirmed, collection);
+        assertEquals("Sets should be equal", getConfirmed(), getCollection());
         assertEquals("Sets should have equal hashCodes", 
-                     confirmed.hashCode(), collection.hashCode());
-        Collection set = makeConfirmedCollection();
-        Iterator iterator = collection.iterator();
+                     getConfirmed().hashCode(), getCollection().hashCode());
+        Collection<E> set = makeConfirmedCollection();
+        Iterator<E> iterator = getCollection().iterator();
         while (iterator.hasNext()) {
-            assertTrue("Set.iterator should only return unique elements", 
-                       set.add(iterator.next()));
+            assertTrue("Set.iterator should only return unique elements", set.add(iterator.next()));
         }
     }
 
@@ -85,8 +84,8 @@ public abstract class AbstractTestSet extends AbstractTestCollection {
      *
      * @return a confirmed empty collection
      */
-    public Collection makeConfirmedCollection() {
-        return new HashSet();
+    public Collection<E> makeConfirmedCollection() {
+        return new HashSet<E>();
     }
 
     /**
@@ -94,8 +93,8 @@ public abstract class AbstractTestSet extends AbstractTestCollection {
      *
      * @return a confirmed full collection
      */
-    public Collection makeConfirmedFullCollection() {
-        Collection set = makeConfirmedCollection();
+    public Collection<E> makeConfirmedFullCollection() {
+        Collection<E> set = makeConfirmedCollection();
         set.addAll(Arrays.asList(getFullElements()));
         return set;
     }
@@ -105,7 +104,7 @@ public abstract class AbstractTestSet extends AbstractTestCollection {
      *
      * @return an empty set
      */
-    public abstract Set makeEmptySet();
+    public abstract Set<E> makeObject();
 
     /**
      * Makes a full set by first creating an empty set and then adding
@@ -115,68 +114,48 @@ public abstract class AbstractTestSet extends AbstractTestCollection {
      *
      * @return a full set
      */
-    public Set makeFullSet() {
-        Set set = makeEmptySet();
+    public Set<E> makeFullCollection() {
+        Set<E> set = makeObject();
         set.addAll(Arrays.asList(getFullElements()));
         return set;
     }
 
-    /**
-     * Makes an empty collection by invoking {@link #makeEmptySet()}.  
-     *
-     * @return an empty collection
-     */
-    public final Collection makeCollection() {
-        return makeEmptySet();
-    }
-
-    /**
-     * Makes a full collection by invoking {@link #makeFullSet()}.
-     *
-     * @return a full collection
-     */
-    public final Collection makeFullCollection() {
-        return makeFullSet();
-    }
-
     //-----------------------------------------------------------------------
     /**
      * Return the {@link AbstractTestCollection#collection} fixture, but cast as a Set.  
      */
-    public Set getSet() {
-        return (Set)collection;
+    public Set<E> getCollection() {
+        return (Set<E>) super.getCollection();
     }
 
     /**
      * Return the {@link AbstractTestCollection#confirmed} fixture, but cast as a Set.
      */
-    public Set getConfirmedSet() {
-        return (Set)confirmed;
+    public Set<E> getConfirmed() {
+        return (Set<E>) super.getConfirmed();
     }
 
     //-----------------------------------------------------------------------
     /**
      * Tests {@link Set#equals(Object)}.
      */
+    @SuppressWarnings("unchecked")
     public void testSetEquals() {
         resetEmpty();
-        assertEquals("Empty sets should be equal", 
-                     getSet(), getConfirmedSet());
+        assertEquals("Empty sets should be equal", getCollection(), getConfirmed());
         verify();
 
-        Collection set2 = makeConfirmedCollection();
-        set2.add("foo");
-        assertTrue("Empty set shouldn't equal nonempty set", 
-                   !getSet().equals(set2));
+        Collection<E> set2 = makeConfirmedCollection();
+        set2.add((E) "foo");
+        assertTrue("Empty set shouldn't equal nonempty set", !getCollection().equals(set2));
 
         resetFull();
-        assertEquals("Full sets should be equal", getSet(), getConfirmedSet());
+        assertEquals("Full sets should be equal", getCollection(), getConfirmed());
         verify();
 
         set2.clear();
         set2.addAll(Arrays.asList(getOtherElements()));
-        assertTrue("Sets with different contents shouldn't be equal", 
-                   !getSet().equals(set2));
+        assertTrue("Sets with different contents shouldn't be equal", !getCollection().equals(set2));
     }
 
     /**
@@ -185,11 +164,11 @@ public abstract class AbstractTestSet extends AbstractTestCollection {
     public void testSetHashCode() {
         resetEmpty();
         assertEquals("Empty sets have equal hashCodes", 
-                     getSet().hashCode(), getConfirmedSet().hashCode());
+                getCollection().hashCode(), getConfirmed().hashCode());
 
         resetFull();
         assertEquals("Equal sets have equal hashCodes", 
-                     getSet().hashCode(), getConfirmedSet().hashCode());
+                getCollection().hashCode(), getConfirmed().hashCode());
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java b/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java
index 08ec512..0006d18 100644
--- a/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java
+++ b/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java
@@ -16,9 +16,7 @@
  */
 package org.apache.commons.collections.set;
 
-import java.util.Collection;
 import java.util.Iterator;
-import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
@@ -38,7 +36,7 @@ import org.apache.commons.collections.BulkTest;
  * @author Stephen Colebourne
  * @author Dieter Wimberger
  */
-public abstract class AbstractTestSortedSet extends AbstractTestSet {
+public abstract class AbstractTestSortedSet<E> extends AbstractTestSet<E> {
 
     /**
      * JUnit constructor.
@@ -59,10 +57,10 @@ public abstract class AbstractTestSortedSet extends AbstractTestSet {
         
         // Check that iterator returns elements in order and first() and last()
         // are consistent
-        Iterator colliter = collection.iterator();
-        Iterator confiter = confirmed.iterator();
-        Object first = null;
-        Object last = null;
+        Iterator<E> colliter = getCollection().iterator();
+        Iterator<E> confiter = getConfirmed().iterator();
+        E first = null;
+        E last = null;
         while (colliter.hasNext()) {
             if (first == null) {
                 first = colliter.next();
@@ -72,11 +70,11 @@ public abstract class AbstractTestSortedSet extends AbstractTestSet {
             }  
             assertEquals("Element appears to be out of order.", last, confiter.next());
         }
-        if (collection.size() > 0) {
+        if (getCollection().size() > 0) {
             assertEquals("Incorrect element returned by first().", first,
-                ((SortedSet) collection).first());
+                getCollection().first());
             assertEquals("Incorrect element returned by last().", last,
-                ((SortedSet) collection).last());
+                getCollection().last());
         }
     }
 
@@ -89,47 +87,56 @@ public abstract class AbstractTestSortedSet extends AbstractTestSet {
         return false;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public abstract SortedSet<E> makeObject();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public SortedSet<E> makeFullCollection() {
+        return (SortedSet<E>) super.makeFullCollection();
+    }
+
     //-----------------------------------------------------------------------
     /**
      * Returns an empty {@link TreeSet} for use in modification testing.
      *
      * @return a confirmed empty collection
      */
-    public Collection makeConfirmedCollection() {
-        return new TreeSet();
+    public SortedSet<E> makeConfirmedCollection() {
+        return new TreeSet<E>();
     }
 
     //-----------------------------------------------------------------------
-    /**
-     * Return the {@link AbstractTestCollection#confirmed} fixture, but cast as a
-     * SortedSet.
-     */
-    public SortedSet getConfirmedSortedSet() {
-        return (SortedSet) confirmed;
-    }
 
     //-----------------------------------------------------------------------
     /**
      * Override to return comparable objects.
      */
-    public Object[] getFullNonNullElements() {
+    @SuppressWarnings("unchecked")
+    public E[] getFullNonNullElements() {
         Object[] elements = new Object[30];
 
         for (int i = 0; i < 30; i++) {
             elements[i] = new Integer(i + i + 1);
         }
-        return elements;
+        return (E[]) elements;
     }
 
     /**
      * Override to return comparable objects.
      */
-    public Object[] getOtherNonNullElements() {
+    @SuppressWarnings("unchecked")
+    public E[] getOtherNonNullElements() {
         Object[] elements = new Object[30];
         for (int i = 0; i < 30; i++) {
             elements[i] = new Integer(i + i + 2);
         }
-        return elements;
+        return (E[]) elements;
     }
 
     //-----------------------------------------------------------------------
@@ -181,23 +188,24 @@ public abstract class AbstractTestSortedSet extends AbstractTestSet {
         return new TestSortedSetSubSet(lobound, false);
     }
 
-    public class TestSortedSetSubSet extends AbstractTestSortedSet {
+    public class TestSortedSetSubSet extends AbstractTestSortedSet<E> {
 
         private int m_Type;
         private int m_LowBound;
         private int m_HighBound;
-        private Object[] m_FullElements;
-        private Object[] m_OtherElements;
+        private E[] m_FullElements;
+        private E[] m_OtherElements;
 
+        @SuppressWarnings("unchecked")
         public TestSortedSetSubSet(int bound, boolean head) {
             super("TestSortedSetSubSet");
             if (head) {
                 //System.out.println("HEADSET");
                 m_Type = TYPE_HEADSET;
                 m_HighBound = bound;
-                m_FullElements = new Object[bound];
+                m_FullElements = (E[]) new Object[bound];
                 System.arraycopy(AbstractTestSortedSet.this.getFullElements(), 0, m_FullElements, 0, bound);
-                m_OtherElements = new Object[bound - 1];
+                m_OtherElements = (E[]) new Object[bound - 1];
                 System.arraycopy(//src src_pos dst dst_pos length
                 AbstractTestSortedSet.this.getOtherElements(), 0, m_OtherElements, 0, bound - 1);
                 //System.out.println(new TreeSet(Arrays.asList(m_FullElements)));
@@ -208,9 +216,9 @@ public abstract class AbstractTestSortedSet extends AbstractTestSet {
                 m_LowBound = bound;
                 Object[] allelements = AbstractTestSortedSet.this.getFullElements();
                 //System.out.println("bound = "+bound +"::length="+allelements.length);
-                m_FullElements = new Object[allelements.length - bound];
+                m_FullElements = (E[]) new Object[allelements.length - bound];
                 System.arraycopy(allelements, bound, m_FullElements, 0, allelements.length - bound);
-                m_OtherElements = new Object[allelements.length - bound - 1];
+                m_OtherElements = (E[]) new Object[allelements.length - bound - 1];
                 System.arraycopy(//src src_pos dst dst_pos length
                 AbstractTestSortedSet.this.getOtherElements(), bound, m_OtherElements, 0, allelements.length - bound - 1);
                 //System.out.println(new TreeSet(Arrays.asList(m_FullElements)));
@@ -223,6 +231,7 @@ public abstract class AbstractTestSortedSet extends AbstractTestSet {
 
         } //type
 
+        @SuppressWarnings("unchecked")
         public TestSortedSetSubSet(int lobound, int hibound) {
             super("TestSortedSetSubSet");
             //System.out.println("SUBSET");
@@ -231,9 +240,9 @@ public abstract class AbstractTestSortedSet extends AbstractTestSet {
             m_HighBound = hibound;
             int length = hibound - lobound;
             //System.out.println("Low=" + lobound + "::High=" + hibound + "::Length=" + length);
-            m_FullElements = new Object[length];
+            m_FullElements = (E[]) new Object[length];
             System.arraycopy(AbstractTestSortedSet.this.getFullElements(), lobound, m_FullElements, 0, length);
-            m_OtherElements = new Object[length - 1];
+            m_OtherElements = (E[]) new Object[length - 1];
             System.arraycopy(//src src_pos dst dst_pos length
             AbstractTestSortedSet.this.getOtherElements(), lobound, m_OtherElements, 0, length - 1);
 
@@ -255,15 +264,15 @@ public abstract class AbstractTestSortedSet extends AbstractTestSet {
             return AbstractTestSortedSet.this.isFailFastSupported();
         }
 
-        public Object[] getFullElements() {
+        public E[] getFullElements() {
             return m_FullElements;
         }
-        public Object[] getOtherElements() {
+        public E[] getOtherElements() {
             return m_OtherElements;
         }
 
-        private SortedSet getSubSet(SortedSet set) {
-            Object[] elements = AbstractTestSortedSet.this.getFullElements();
+        private SortedSet<E> getSubSet(SortedSet<E> set) {
+            E[] elements = AbstractTestSortedSet.this.getFullElements();
             switch (m_Type) {
                 case TYPE_SUBSET :
                     return set.subSet(elements[m_LowBound], elements[m_HighBound]);
@@ -276,14 +285,12 @@ public abstract class AbstractTestSortedSet extends AbstractTestSet {
             }
         }
 
-        public Set makeEmptySet() {
-            SortedSet s = (SortedSet) AbstractTestSortedSet.this.makeEmptySet();
-            return getSubSet(s);
+        public SortedSet<E> makeObject() {
+            return getSubSet(AbstractTestSortedSet.this.makeObject());
         }
 
-        public Set makeFullSet() {
-            SortedSet s = (SortedSet) AbstractTestSortedSet.this.makeFullCollection();
-            return getSubSet(s);
+        public SortedSet<E> makeFullCollection() {
+            return getSubSet(AbstractTestSortedSet.this.makeFullCollection());
         }
         
         public boolean isTestSerialization() {
@@ -306,4 +313,19 @@ public abstract class AbstractTestSortedSet extends AbstractTestSet {
 
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public SortedSet<E> getCollection() {
+        return (SortedSet<E>) super.getCollection();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public SortedSet<E> getConfirmed() {
+        return (SortedSet<E>) super.getConfirmed();
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/set/TestCompositeSet.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/TestCompositeSet.java b/src/test/org/apache/commons/collections/set/TestCompositeSet.java
index 9ae926c..680f7df 100644
--- a/src/test/org/apache/commons/collections/set/TestCompositeSet.java
+++ b/src/test/org/apache/commons/collections/set/TestCompositeSet.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.
@@ -27,7 +27,7 @@ import junit.framework.TestSuite;
 import org.apache.commons.collections.collection.CompositeCollection;
 
 /**
- * Extension of {@link AbstractTestSet} for exercising the 
+ * Extension of {@link AbstractTestSet} for exercising the
  * {@link CompositeSet} implementation.
  *
  * @since Commons Collections 3.0
@@ -37,110 +37,117 @@ import org.apache.commons.collections.collection.CompositeCollection;
  * @author Phil Steitz
  */
 
-public class TestCompositeSet extends AbstractTestSet {
+public class TestCompositeSet<E> extends AbstractTestSet<E> {
     public TestCompositeSet(String name) {
         super(name);
     }
-    
+
     public static Test suite() {
         return new TestSuite(TestCompositeSet.class);
     }
-    
-    public Set makeEmptySet() {
-        final HashSet contained = new HashSet();
-        CompositeSet set = new CompositeSet(contained);
-        set.setMutator(new CompositeSet.SetMutator() {
-            public void resolveCollision(CompositeSet comp, Set existing, 
-                Set added, Collection intersects) {
+
+    public CompositeSet<E> makeObject() {
+        final HashSet<E> contained = new HashSet<E>();
+        CompositeSet<E> set = new CompositeSet<E>(contained);
+        set.setMutator(new CompositeSet.SetMutator<E>() {
+            public void resolveCollision(CompositeSet<E> comp, Set<E> existing,
+                Set<E> added, Collection<E> intersects) {
                 throw new IllegalArgumentException();
             }
-            
-            public boolean add(CompositeCollection composite, 
-                    List collections, Object obj) {
+
+            public boolean add(CompositeCollection<E> composite,
+                    List<Collection<E>> collections, E obj) {
                 return contained.add(obj);
             }
-            
-            public boolean addAll(CompositeCollection composite, 
-                    List collections, Collection coll) {
+
+            public boolean addAll(CompositeCollection<E> composite,
+                    List<Collection<E>> collections, Collection<? extends E> coll) {
                 return contained.addAll(coll);
             }
-            
-            public boolean remove(CompositeCollection composite, 
-                    List collections, Object obj) {
+
+            public boolean remove(CompositeCollection<E> composite,
+                    List<Collection<E>> collections, Object obj) {
                 return contained.remove(obj);
             }
         });
         return set;
     }
-    
-    public Set buildOne() {
-        HashSet set = new HashSet();
-        set.add("1");
-        set.add("2");
+
+    @SuppressWarnings("unchecked")
+    public Set<E> buildOne() {
+        HashSet<E> set = new HashSet<E>();
+        set.add((E) "1");
+        set.add((E) "2");
         return set;
     }
-    
-    public Set buildTwo() {
-        HashSet set = new HashSet();
-        set.add("3");
-        set.add("4");
+
+    @SuppressWarnings("unchecked")
+    public Set<E> buildTwo() {
+        HashSet<E> set = new HashSet<E>();
+        set.add((E) "3");
+        set.add((E) "4");
         return set;
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testContains() {
-        CompositeSet set = new CompositeSet(new Set[]{buildOne(), buildTwo()});
+        CompositeSet<E> set = new CompositeSet<E>(new Set[]{ buildOne(), buildTwo() });
         assertTrue(set.contains("1"));
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testRemoveUnderlying() {
-        Set one = buildOne();
-        Set two = buildTwo();
-        CompositeSet set = new CompositeSet(new Set[]{one, two});
+        Set<E> one = buildOne();
+        Set<E> two = buildTwo();
+        CompositeSet<E> set = new CompositeSet<E>(new Set[] { one, two });
         one.remove("1");
         assertFalse(set.contains("1"));
-        
+
         two.remove("3");
         assertFalse(set.contains("3"));
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testRemoveComposited() {
-        Set one = buildOne();
-        Set two = buildTwo();
-        CompositeSet set = new CompositeSet(new Set[]{one, two});
+        Set<E> one = buildOne();
+        Set<E> two = buildTwo();
+        CompositeSet<E> set = new CompositeSet<E>(new Set[] { one, two });
         set.remove("1");
         assertFalse(one.contains("1"));
-        
+
         set.remove("3");
         assertFalse(one.contains("3"));
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testFailedCollisionResolution() {
-        Set one = buildOne();
-        Set two = buildTwo();
-        CompositeSet set = new CompositeSet(new Set[]{one, two});
-        set.setMutator(new CompositeSet.SetMutator() {
-            public void resolveCollision(CompositeSet comp, Set existing, 
-                Set added, Collection intersects) {
+        Set<E> one = buildOne();
+        Set<E> two = buildTwo();
+        CompositeSet<E> set = new CompositeSet<E>(new Set[] { one, two });
+        set.setMutator(new CompositeSet.SetMutator<E>() {
+            public void resolveCollision(CompositeSet<E> comp, Set<E> existing,
+                Set<E> added, Collection<E> intersects) {
+                //noop
             }
-            
-            public boolean add(CompositeCollection composite, 
-                    List collections, Object obj) {
+
+            public boolean add(CompositeCollection<E> composite,
+                    List<Collection<E>> collections, E obj) {
                 throw new UnsupportedOperationException();
             }
-            
-            public boolean addAll(CompositeCollection composite, 
-                    List collections, Collection coll) {
+
+            public boolean addAll(CompositeCollection<E> composite,
+                    List<Collection<E>> collections, Collection<? extends E> coll) {
                 throw new UnsupportedOperationException();
             }
-            
-            public boolean remove(CompositeCollection composite, 
-                    List collections, Object obj) {
+
+            public boolean remove(CompositeCollection<E> composite,
+                    List<Collection<E>> collections, Object obj) {
                 throw new UnsupportedOperationException();
             }
         });
-        
-        HashSet three = new HashSet();
-        three.add("1");
+
+        HashSet<E> three = new HashSet<E>();
+        three.add((E) "1");
         try {
             set.addComposited(three);
             fail("IllegalArgumentException should have been thrown");
@@ -149,22 +156,23 @@ public class TestCompositeSet extends AbstractTestSet {
             // expected
         }
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testAddComposited() {
-        Set one = buildOne();
-        Set two = buildTwo();
-        CompositeSet set = new CompositeSet();
+        Set<E> one = buildOne();
+        Set<E> two = buildTwo();
+        CompositeSet<E> set = new CompositeSet<E>();
         set.addComposited(one, two);
-        CompositeSet set2 = new CompositeSet(buildOne());
+        CompositeSet<E> set2 = new CompositeSet<E>(buildOne());
         set2.addComposited(buildTwo());
         assertTrue(set.equals(set2));
-        HashSet set3 = new HashSet();
-        set3.add("1");
-        set3.add("2");
-        set3.add("3");
-        HashSet set4 = new HashSet();
-        set4.add("4");
-        CompositeSet set5 = new CompositeSet(set3);
+        HashSet<E> set3 = new HashSet<E>();
+        set3.add((E) "1");
+        set3.add((E) "2");
+        set3.add((E) "3");
+        HashSet<E> set4 = new HashSet<E>();
+        set4.add((E) "4");
+        CompositeSet<E> set5 = new CompositeSet<E>(set3);
         set5.addComposited(set4);
         assertTrue(set.equals(set5));
         try {


[04/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/AbstractTestSortedMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/AbstractTestSortedMap.java b/src/test/org/apache/commons/collections/map/AbstractTestSortedMap.java
index 135bb1f..b56e372 100644
--- a/src/test/org/apache/commons/collections/map/AbstractTestSortedMap.java
+++ b/src/test/org/apache/commons/collections/map/AbstractTestSortedMap.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,24 +30,24 @@ import org.apache.commons.collections.BulkTest;
  * Abstract test class for {@link java.util.SortedMap} methods and contracts.
  *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public abstract class AbstractTestSortedMap extends AbstractTestMap {
+public abstract class AbstractTestSortedMap<K, V> extends AbstractTestMap<K, V> {
 
     /**
      * JUnit constructor.
-     * 
+     *
      * @param testName  the test name
      */
     public AbstractTestSortedMap(String testName) {
         super(testName);
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Can't sort null keys.
-     * 
+     *
      * @return false
      */
     public boolean isAllowNullKey() {
@@ -56,53 +56,67 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap {
 
     /**
      * SortedMap uses TreeMap as its known comparison.
-     * 
+     *
      * @return a map that is known to be valid
      */
-    public Map makeConfirmedMap() {
-        return new TreeMap();
+    public SortedMap<K, V> makeConfirmedMap() {
+        return new TreeMap<K, V>();
     }
 
     //-----------------------------------------------------------------------
     public void testComparator() {
-        SortedMap sm = (SortedMap) makeFullMap();
+//        SortedMap<K, V> sm = makeFullMap();
         // no tests I can think of
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public abstract SortedMap<K, V> makeObject();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public SortedMap<K, V> makeFullMap() {
+        return (SortedMap<K, V>) super.makeFullMap();
+    }
+
     public void testFirstKey() {
-        SortedMap sm = (SortedMap) makeFullMap();
+        SortedMap<K, V> sm = makeFullMap();
         assertSame(sm.keySet().iterator().next(), sm.firstKey());
     }
-    
+
     public void testLastKey() {
-        SortedMap sm = (SortedMap) makeFullMap();
-        Object obj = null;
-        for (Iterator it = sm.keySet().iterator(); it.hasNext();) {
-            obj = (Object) it.next();
+        SortedMap<K, V> sm = makeFullMap();
+        K obj = null;
+        for (Iterator<K> it = sm.keySet().iterator(); it.hasNext();) {
+            obj = it.next();
         }
         assertSame(obj, sm.lastKey());
     }
-    
-    //-----------------------------------------------------------------------    
+
+    //-----------------------------------------------------------------------
     public BulkTest bulkTestHeadMap() {
-        return new TestHeadMap(this);
+        return new TestHeadMap<K, V>(this);
     }
 
     public BulkTest bulkTestTailMap() {
-        return new TestTailMap(this);
+        return new TestTailMap<K, V>(this);
     }
 
     public BulkTest bulkTestSubMap() {
-        return new TestSubMap(this);
+        return new TestSubMap<K, V>(this);
     }
 
-    public static abstract class TestViewMap extends AbstractTestSortedMap {
-        protected final AbstractTestMap main;
-        protected final List subSortedKeys = new ArrayList();
-        protected final List subSortedValues = new ArrayList();
-        protected final List subSortedNewValues = new ArrayList();
-        
-        public TestViewMap(String name, AbstractTestMap main) {
+    public static abstract class TestViewMap <K, V> extends AbstractTestSortedMap<K, V> {
+        protected final AbstractTestMap<K, V> main;
+        protected final List<K> subSortedKeys = new ArrayList<K>();
+        protected final List<V> subSortedValues = new ArrayList<V>();
+        protected final List<V> subSortedNewValues = new ArrayList<V>();
+
+        public TestViewMap(String name, AbstractTestMap<K, V> main) {
             super(name);
             this.main = main;
         }
@@ -130,17 +144,20 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap {
         public BulkTest bulkTestSubMap() {
             return null;  // block infinite recursion
         }
-        
-        public Object[] getSampleKeys() {
-            return subSortedKeys.toArray();
+
+        @SuppressWarnings("unchecked")
+        public K[] getSampleKeys() {
+            return (K[]) subSortedKeys.toArray();
         }
-        public Object[] getSampleValues() {
-            return subSortedValues.toArray();
+        @SuppressWarnings("unchecked")
+        public V[] getSampleValues() {
+            return (V[]) subSortedValues.toArray();
         }
-        public Object[] getNewSampleValues() {
-            return subSortedNewValues.toArray();
+        @SuppressWarnings("unchecked")
+        public V[] getNewSampleValues() {
+            return (V[]) subSortedNewValues.toArray();
         }
-        
+
         public boolean isAllowNullKey() {
             return main.isAllowNullKey();
         }
@@ -176,16 +193,16 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap {
 //            super.testFullMapCompatibility();
 //        }
     }
-    
-    public static class TestHeadMap extends TestViewMap {
+
+    public static class TestHeadMap<K, V> extends TestViewMap<K, V> {
         static final int SUBSIZE = 6;
-        final Object toKey;
-        
-        public TestHeadMap(AbstractTestMap main) {
+        final K toKey;
+
+        public TestHeadMap(AbstractTestMap<K, V> main) {
             super("SortedMap.HeadMap", main);
-            SortedMap sm = (SortedMap) main.makeFullMap();
-            for (Iterator it = sm.entrySet().iterator(); it.hasNext();) {
-                Map.Entry entry = (Map.Entry) it.next();
+            Map<K, V> sm = main.makeFullMap();
+            for (Iterator<Map.Entry<K, V>> it = sm.entrySet().iterator(); it.hasNext();) {
+                Map.Entry<K, V> entry = it.next();
                 this.subSortedKeys.add(entry.getKey());
                 this.subSortedValues.add(entry.getValue());
             }
@@ -194,18 +211,18 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap {
             this.subSortedValues.subList(SUBSIZE, this.subSortedValues.size()).clear();
             this.subSortedNewValues.addAll(Arrays.asList(main.getNewSampleValues()).subList(0, SUBSIZE));
         }
-        public Map makeEmptyMap() {
+        public SortedMap<K, V> makeObject() {
             // done this way so toKey is correctly set in the returned map
-            return ((SortedMap) main.makeEmptyMap()).headMap(toKey);
+            return ((SortedMap<K, V>) main.makeObject()).headMap(toKey);
         }
-        public Map makeFullMap() {
-            return ((SortedMap) main.makeFullMap()).headMap(toKey);
+        public SortedMap<K, V> makeFullMap() {
+            return ((SortedMap<K, V>) main.makeFullMap()).headMap(toKey);
         }
         public void testHeadMapOutOfRange() {
             if (isPutAddSupported() == false) return;
             resetEmpty();
             try {
-                ((SortedMap) map).put(toKey, subSortedValues.get(0));
+                getMap().put(toKey, subSortedValues.get(0));
                 fail();
             } catch (IllegalArgumentException ex) {}
             verify();
@@ -225,17 +242,17 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap {
 //                "D:/dev/collections/data/test/FixedSizeSortedMap.fullCollection.version3.1.HeadMapView.obj");
 //        }
     }
-    
-    public static class TestTailMap extends TestViewMap {
+
+    public static class TestTailMap <K, V> extends TestViewMap<K, V> {
         static final int SUBSIZE = 6;
-        final Object fromKey;
-        final Object invalidKey;
-        
-        public TestTailMap(AbstractTestMap main) {
+        final K fromKey;
+        final K invalidKey;
+
+        public TestTailMap(AbstractTestMap<K, V> main) {
             super("SortedMap.TailMap", main);
-            SortedMap sm = (SortedMap) main.makeFullMap();
-            for (Iterator it = sm.entrySet().iterator(); it.hasNext();) {
-                Map.Entry entry = (Map.Entry) it.next();
+            Map<K, V> sm = main.makeFullMap();
+            for (Iterator<Map.Entry<K, V>> it = sm.entrySet().iterator(); it.hasNext();) {
+                Map.Entry<K, V> entry = it.next();
                 this.subSortedKeys.add(entry.getKey());
                 this.subSortedValues.add(entry.getValue());
             }
@@ -245,18 +262,18 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap {
             this.subSortedValues.subList(0, this.subSortedValues.size() - SUBSIZE).clear();
             this.subSortedNewValues.addAll(Arrays.asList(main.getNewSampleValues()).subList(0, SUBSIZE));
         }
-        public Map makeEmptyMap() {
+        public SortedMap<K, V> makeObject() {
             // done this way so toKey is correctly set in the returned map
-            return ((SortedMap) main.makeEmptyMap()).tailMap(fromKey);
+            return ((SortedMap<K, V>) main.makeObject()).tailMap(fromKey);
         }
-        public Map makeFullMap() {
-            return ((SortedMap) main.makeFullMap()).tailMap(fromKey);
+        public SortedMap<K, V> makeFullMap() {
+            return ((SortedMap<K, V>) main.makeFullMap()).tailMap(fromKey);
         }
         public void testTailMapOutOfRange() {
             if (isPutAddSupported() == false) return;
             resetEmpty();
             try {
-                ((SortedMap) map).put(invalidKey, subSortedValues.get(0));
+                getMap().put(invalidKey, subSortedValues.get(0));
                 fail();
             } catch (IllegalArgumentException ex) {}
             verify();
@@ -276,45 +293,45 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap {
 //                "D:/dev/collections/data/test/FixedSizeSortedMap.fullCollection.version3.1.TailMapView.obj");
 //        }
     }
-    
-    public static class TestSubMap extends TestViewMap {
+
+    public static class TestSubMap<K, V> extends TestViewMap<K, V> {
         static final int SUBSIZE = 3;
-        final Object fromKey;
-        final Object toKey;
-        
-        public TestSubMap(AbstractTestMap main) {
+        final K fromKey;
+        final K toKey;
+
+        public TestSubMap(AbstractTestMap<K, V> main) {
             super("SortedMap.SubMap", main);
-            SortedMap sm = (SortedMap) main.makeFullMap();
-            for (Iterator it = sm.entrySet().iterator(); it.hasNext();) {
-                Map.Entry entry = (Map.Entry) it.next();
+            Map<K, V> sm = main.makeFullMap();
+            for (Iterator<Map.Entry<K, V>> it = sm.entrySet().iterator(); it.hasNext();) {
+                Map.Entry<K, V> entry = it.next();
                 this.subSortedKeys.add(entry.getKey());
                 this.subSortedValues.add(entry.getValue());
             }
             this.fromKey = this.subSortedKeys.get(SUBSIZE);
             this.toKey = this.subSortedKeys.get(this.subSortedKeys.size() - SUBSIZE);
-            
+
             this.subSortedKeys.subList(0, SUBSIZE).clear();
             this.subSortedKeys.subList(this.subSortedKeys.size() - SUBSIZE, this.subSortedKeys.size()).clear();
-            
+
             this.subSortedValues.subList(0, SUBSIZE).clear();
             this.subSortedValues.subList(this.subSortedValues.size() - SUBSIZE, this.subSortedValues.size()).clear();
-            
+
             this.subSortedNewValues.addAll(Arrays.asList(main.getNewSampleValues()).subList(
                 SUBSIZE, this.main.getNewSampleValues().length - SUBSIZE));
         }
-        
-        public Map makeEmptyMap() {
+
+        public SortedMap<K, V> makeObject() {
             // done this way so toKey is correctly set in the returned map
-            return ((SortedMap) main.makeEmptyMap()).subMap(fromKey, toKey);
+            return ((SortedMap<K, V>) main.makeObject()).subMap(fromKey, toKey);
         }
-        public Map makeFullMap() {
-            return ((SortedMap) main.makeFullMap()).subMap(fromKey, toKey);
+        public SortedMap<K, V> makeFullMap() {
+            return ((SortedMap<K, V>) main.makeFullMap()).subMap(fromKey, toKey);
         }
         public void testSubMapOutOfRange() {
             if (isPutAddSupported() == false) return;
             resetEmpty();
             try {
-                ((SortedMap) map).put(toKey, subSortedValues.get(0));
+                getMap().put(toKey, subSortedValues.get(0));
                 fail();
             } catch (IllegalArgumentException ex) {}
             verify();
@@ -334,5 +351,20 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap {
 //                "D:/dev/collections/data/test/TransformedSortedMap.fullCollection.version3.1.SubMapView.obj");
 //        }
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public SortedMap<K, V> getMap() {
+        return (SortedMap<K, V>) super.getMap();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public SortedMap<K, V> getConfirmed() {
+        return (SortedMap<K, V>) super.getConfirmed();
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java b/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java
index 29fe553..167a183 100644
--- a/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java
+++ b/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.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.
@@ -27,12 +27,12 @@ import org.apache.commons.collections.BulkTest;
 
 /**
  * Tests for the {@link CaseInsensitiveMap} implementation.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Commons-Collections team
  */
-public class TestCaseInsensitiveMap extends AbstractTestIterableMap {
+public class TestCaseInsensitiveMap<K, V> extends AbstractTestIterableMap<K, V> {
 
     public TestCaseInsensitiveMap(String testName) {
         super(testName);
@@ -41,74 +41,77 @@ public class TestCaseInsensitiveMap extends AbstractTestIterableMap {
     public static void main(String[] args) {
         TestRunner.run(suite());
     }
-    
+
     public static Test suite() {
         return BulkTest.makeSuite(TestCaseInsensitiveMap.class);
     }
 
-    public Map makeEmptyMap() {
-        return new CaseInsensitiveMap();
+    public CaseInsensitiveMap<K, V> makeObject() {
+        return new CaseInsensitiveMap<K, V>();
     }
-    
+
     public String getCompatibilityVersion() {
         return "3";
     }
-   
+
     //-------------------------------------------------------------------------
-    
+
+    @SuppressWarnings("unchecked")
     public void testCaseInsensitive() {
-        Map map = new CaseInsensitiveMap();
-        map.put("One", "One");
-        map.put("Two", "Two");
-        assertEquals("One", (String) map.get("one"));
-        assertEquals("One", (String) map.get("oNe"));
-        map.put("two", "Three");
-        assertEquals("Three", (String) map.get("Two"));
-    } 
-    
+        Map<K, V> map = makeObject();
+        map.put((K) "One", (V) "One");
+        map.put((K) "Two", (V) "Two");
+        assertEquals("One", map.get("one"));
+        assertEquals("One", map.get("oNe"));
+        map.put((K) "two", (V) "Three");
+        assertEquals("Three", map.get("Two"));
+    }
+
+    @SuppressWarnings("unchecked")
     public void testNullHandling() {
-        Map map = new CaseInsensitiveMap();
-        map.put("One", "One");
-        map.put("Two", "Two");
-        map.put(null, "Three");
-        assertEquals("Three", (String) map.get(null));
-        map.put(null, "Four");
-        assertEquals("Four", (String) map.get(null));
-        Set keys = map.keySet();
+        Map<K, V> map = makeObject();
+        map.put((K) "One", (V) "One");
+        map.put((K) "Two", (V) "Two");
+        map.put(null, (V) "Three");
+        assertEquals("Three", map.get(null));
+        map.put(null, (V) "Four");
+        assertEquals("Four", map.get(null));
+        Set<K> keys = map.keySet();
         assertTrue(keys.contains("one"));
         assertTrue(keys.contains("two"));
         assertTrue(keys.contains(null));
         assertTrue(keys.size() == 3);
     }
-        
+
     public void testPutAll() {
-        Map map = new HashMap();
+        Map<Object, String> map = new HashMap<Object, String>();
         map.put("One", "One");
         map.put("Two", "Two");
         map.put("one", "Three");
         map.put(null, "Four");
         map.put(new Integer(20), "Five");
-        Map caseInsensitiveMap = new CaseInsensitiveMap(map);
+        Map<Object, String> caseInsensitiveMap = new CaseInsensitiveMap<Object, String>(map);
         assertTrue(caseInsensitiveMap.size() == 4); // ones collapsed
-        Set keys = caseInsensitiveMap.keySet();
+        Set<Object> keys = caseInsensitiveMap.keySet();
         assertTrue(keys.contains("one"));
         assertTrue(keys.contains("two"));
         assertTrue(keys.contains(null));
         assertTrue(keys.contains(Integer.toString(20)));
         assertTrue(keys.size() == 4);
-        assertTrue(!caseInsensitiveMap.containsValue("One") 
+        assertTrue(!caseInsensitiveMap.containsValue("One")
             || !caseInsensitiveMap.containsValue("Three")); // ones collaped
         assertEquals(caseInsensitiveMap.get(null), "Four");
-    } 
+    }
 
+    @SuppressWarnings("unchecked")
     public void testClone() {
-        CaseInsensitiveMap map = new CaseInsensitiveMap(10);
-        map.put("1", "1");
-        Map cloned = (Map) map.clone();
+        CaseInsensitiveMap<K, V> map = new CaseInsensitiveMap<K, V>(10);
+        map.put((K) "1", (V) "1");
+        CaseInsensitiveMap<K, V> cloned = map.clone();
         assertEquals(map.size(), cloned.size());
         assertSame(map.get("1"), cloned.get("1"));
     }
-    
+
     /*
     public void testCreate() throws Exception {
         resetEmpty();

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestCompositeMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestCompositeMap.java b/src/test/org/apache/commons/collections/map/TestCompositeMap.java
index 076b58a..7fd3e6e 100644
--- a/src/test/org/apache/commons/collections/map/TestCompositeMap.java
+++ b/src/test/org/apache/commons/collections/map/TestCompositeMap.java
@@ -33,7 +33,7 @@ import java.util.Collection;
  *
  * @author Brian McCallister
  */
-public class TestCompositeMap extends AbstractTestMap {
+public class TestCompositeMap<K, V> extends AbstractTestMap<K, V> {
     /** used as a flag in MapMutator tests */
     private boolean pass = false;
     
@@ -55,22 +55,20 @@ public class TestCompositeMap extends AbstractTestMap {
         junit.textui.TestRunner.main(testCaseName);
     }
     
-    public Map makeEmptyMap() {
-        CompositeMap map = new CompositeMap();
-        map.addComposited(new HashMap());
-        map.setMutator(new CompositeMap.MapMutator() {
-            public void resolveCollision(CompositeMap composite,
-            Map existing,
-            Map added,
-            Collection intersect) {
+    public CompositeMap<K, V> makeObject() {
+        CompositeMap<K, V> map = new CompositeMap<K, V>();
+        map.addComposited(new HashMap<K, V>());
+        map.setMutator(new CompositeMap.MapMutator<K, V>() {
+            public void resolveCollision(CompositeMap<K, V> composite, Map<K, V> existing,
+                    Map<K, V> added, Collection<K> intersect) {
                 // Do nothing
             }
             
-            public Object put(CompositeMap map, Map[] composited, Object key, Object value) {
+            public V put(CompositeMap<K, V> map, Map<K, V>[] composited, K key, V value) {
                 return composited[0].put(key, value);
             }
             
-            public void putAll(CompositeMap map, Map[] composited, Map t) {
+            public void putAll(CompositeMap<K, V> map, Map<K, V>[] composited, Map<? extends K, ? extends V> t) {
                 composited[0].putAll(t);
             }
             
@@ -78,30 +76,33 @@ public class TestCompositeMap extends AbstractTestMap {
         return map;
     }
     
-    private Map buildOne() {
-        HashMap map = new HashMap();
-        map.put("1", "one");
-        map.put("2", "two");
+    @SuppressWarnings("unchecked")
+    private Map<K, V> buildOne() {
+        HashMap<K, V> map = new HashMap<K, V>();
+        map.put((K) "1", (V) "one");
+        map.put((K) "2", (V) "two");
         return map;
     }
     
-    public Map buildTwo() {
-        HashMap map = new HashMap();
-        map.put("3", "three");
-        map.put("4", "four");
+    @SuppressWarnings("unchecked")
+    public Map<K, V> buildTwo() {
+        HashMap<K, V> map = new HashMap<K, V>();
+        map.put((K) "3", (V) "three");
+        map.put((K) "4", (V) "four");
         return map;
     }
     
     public void testGet() {
-        CompositeMap map = new CompositeMap(buildOne(), buildTwo());
+        CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo());
         Assert.assertEquals("one", map.get("1"));
         Assert.assertEquals("four", map.get("4"));
     }
     
+    @SuppressWarnings("unchecked")
     public void testAddComposited() {
-        CompositeMap map = new CompositeMap(buildOne(), buildTwo());
-        HashMap three = new HashMap();
-        three.put("5", "five");
+        CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo());
+        HashMap<K, V> three = new HashMap<K, V>();
+        three.put((K) "5", (V) "five");
         map.addComposited(three);
         assertTrue(map.containsKey("5"));
         try {
@@ -112,10 +113,11 @@ public class TestCompositeMap extends AbstractTestMap {
         }
     }
     
+    @SuppressWarnings("unchecked")
     public void testRemoveComposited() {
-        CompositeMap map = new CompositeMap(buildOne(), buildTwo());
-        HashMap three = new HashMap();
-        three.put("5", "five");
+        CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo());
+        HashMap<K, V> three = new HashMap<K, V>();
+        three.put((K) "5", (V) "five");
         map.addComposited(three);
         assertTrue(map.containsKey("5"));
         
@@ -127,10 +129,11 @@ public class TestCompositeMap extends AbstractTestMap {
         
     }
     
+    @SuppressWarnings("unchecked")
     public void testRemoveFromUnderlying() {
-        CompositeMap map = new CompositeMap(buildOne(), buildTwo());
-        HashMap three = new HashMap();
-        three.put("5", "five");
+        CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo());
+        HashMap<K, V> three = new HashMap<K, V>();
+        three.put((K) "5", (V) "five");
         map.addComposited(three);
         assertTrue(map.containsKey("5"));
         
@@ -139,10 +142,11 @@ public class TestCompositeMap extends AbstractTestMap {
         assertFalse(map.containsKey("5"));
     }
     
+    @SuppressWarnings("unchecked")
     public void testRemoveFromComposited() {
-        CompositeMap map = new CompositeMap(buildOne(), buildTwo());
-        HashMap three = new HashMap();
-        three.put("5", "five");
+        CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo());
+        HashMap<K, V> three = new HashMap<K, V>();
+        three.put((K) "5", (V) "five");
         map.addComposited(three);
         assertTrue(map.containsKey("5"));
         
@@ -152,21 +156,21 @@ public class TestCompositeMap extends AbstractTestMap {
     }
     
     public void testResolveCollision() {
-        CompositeMap map = new CompositeMap(buildOne(), buildTwo(), 
-            new CompositeMap.MapMutator() {
-            public void resolveCollision(CompositeMap composite,
-            Map existing,
-            Map added,
-            Collection intersect) {
+        CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo(), 
+            new CompositeMap.MapMutator<K, V>() {
+            public void resolveCollision(CompositeMap<K, V> composite,
+            Map<K, V> existing,
+            Map<K, V> added,
+            Collection<K> intersect) {
                 pass = true;
             }
             
-            public Object put(CompositeMap map, Map[] composited, Object key, 
-                Object value) {
+            public V put(CompositeMap<K, V> map, Map<K, V>[] composited, K key, 
+                V value) {
                 throw new UnsupportedOperationException();
             }
             
-            public void putAll(CompositeMap map, Map[] composited, Map t) {
+            public void putAll(CompositeMap<K, V> map, Map<K, V>[] composited, Map<? extends K, ? extends V> t) {
                 throw new UnsupportedOperationException();
             }
         });
@@ -175,47 +179,48 @@ public class TestCompositeMap extends AbstractTestMap {
         assertTrue(pass);
     }
     
+    @SuppressWarnings("unchecked")
     public void testPut() {
-        CompositeMap map = new CompositeMap(buildOne(), buildTwo(), 
-            new CompositeMap.MapMutator() {
-            public void resolveCollision(CompositeMap composite,
-            Map existing,
-            Map added,
-            Collection intersect) {
+        CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo(), 
+            new CompositeMap.MapMutator<K, V>() {
+            public void resolveCollision(CompositeMap<K, V> composite,
+            Map<K, V> existing,
+            Map<K, V> added,
+            Collection<K> intersect) {
                 throw new UnsupportedOperationException();
             }
             
-            public Object put(CompositeMap map, Map[] composited, Object key, 
-                Object value) {
+            public V put(CompositeMap<K, V> map, Map<K, V>[] composited, K key, 
+                V value) {
                 pass = true;
-                return "foo";
+                return (V) "foo";
             }
             
-            public void putAll(CompositeMap map, Map[] composited, Map t) {
+            public void putAll(CompositeMap<K, V> map, Map<K, V>[] composited, Map<? extends K, ? extends V> t) {
                 throw new UnsupportedOperationException();
             }
         });
         
-        map.put("willy", "wonka");
+        map.put((K) "willy", (V) "wonka");
         assertTrue(pass);
     }
     
     public void testPutAll() {
-        CompositeMap map = new CompositeMap(buildOne(), buildTwo(), 
-            new CompositeMap.MapMutator() {
-            public void resolveCollision(CompositeMap composite,
-            Map existing,
-            Map added,
-            Collection intersect) {
+        CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo(), 
+            new CompositeMap.MapMutator<K, V>() {
+            public void resolveCollision(CompositeMap<K, V> composite,
+            Map<K, V> existing,
+            Map<K, V> added,
+            Collection<K> intersect) {
                 throw new UnsupportedOperationException();
             }
             
-            public Object put(CompositeMap map, Map[] composited, Object key,
-                Object value) {
+            public V put(CompositeMap<K, V> map, Map<K, V>[] composited, K key, 
+                V value) {
                 throw new UnsupportedOperationException();
             }
             
-            public void putAll(CompositeMap map, Map[] composited, Map t) {
+            public void putAll(CompositeMap<K, V> map, Map<K, V>[] composited, Map<? extends K, ? extends V> t) {
                 pass = true;
             }
         });

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestDefaultedMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestDefaultedMap.java b/src/test/org/apache/commons/collections/map/TestDefaultedMap.java
index fc2e1cd..ac0576a 100644
--- a/src/test/org/apache/commons/collections/map/TestDefaultedMap.java
+++ b/src/test/org/apache/commons/collections/map/TestDefaultedMap.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.
@@ -28,17 +28,17 @@ import org.apache.commons.collections.Transformer;
 import org.apache.commons.collections.functors.ConstantFactory;
 
 /**
- * Extension of {@link TestMap} for exercising the 
+ * Extension of {@link TestMap} for exercising the
  * {@link DefaultedMap} implementation.
  *
  * @since Commons Collections 3.2
  * @version $Revision: 155406 $ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestDefaultedMap extends AbstractTestMap {
+public class TestDefaultedMap<K, V> extends AbstractTestMap<K, V> {
 
-    protected static final Factory nullFactory = FactoryUtils.nullFactory();
+    protected final Factory<V> nullFactory = FactoryUtils.<V>nullFactory();
 
     public TestDefaultedMap(String testName) {
         super(testName);
@@ -53,20 +53,21 @@ public class TestDefaultedMap extends AbstractTestMap {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    //-----------------------------------------------------------------------    
-    public Map makeEmptyMap() {
-        return DefaultedMap.decorate(new HashMap(), nullFactory);
+    //-----------------------------------------------------------------------
+    public Map<K, V> makeObject() {
+        return DefaultedMap.decorate(new HashMap<K, V>(), nullFactory);
     }
 
-    //-----------------------------------------------------------------------    
+    //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testMapGet() {
-        Map map = new DefaultedMap("NULL");
-        
+        Map<K, V> map = new DefaultedMap<K, V>((V) "NULL");
+
         assertEquals(0, map.size());
         assertEquals(false, map.containsKey("NotInMap"));
         assertEquals("NULL", map.get("NotInMap"));
-        
-        map.put("Key", "Value");
+
+        map.put((K) "Key", (V) "Value");
         assertEquals(1, map.size());
         assertEquals(true, map.containsKey("Key"));
         assertEquals("Value", map.get("Key"));
@@ -74,16 +75,17 @@ public class TestDefaultedMap extends AbstractTestMap {
         assertEquals("NULL", map.get("NotInMap"));
     }
 
+    @SuppressWarnings("unchecked")
     public void testMapGet2() {
-        HashMap base = new HashMap();
-        Map map = DefaultedMap.decorate(base, "NULL");
-        
+        HashMap<K, V> base = new HashMap<K, V>();
+        Map<K, V> map = DefaultedMap.decorate(base, (V) "NULL");
+
         assertEquals(0, map.size());
         assertEquals(0, base.size());
         assertEquals(false, map.containsKey("NotInMap"));
         assertEquals("NULL", map.get("NotInMap"));
-        
-        map.put("Key", "Value");
+
+        map.put((K) "Key", (V) "Value");
         assertEquals(1, map.size());
         assertEquals(1, base.size());
         assertEquals(true, map.containsKey("Key"));
@@ -92,16 +94,17 @@ public class TestDefaultedMap extends AbstractTestMap {
         assertEquals("NULL", map.get("NotInMap"));
     }
 
+    @SuppressWarnings("unchecked")
     public void testMapGet3() {
-        HashMap base = new HashMap();
-        Map map = DefaultedMap.decorate(base, ConstantFactory.getInstance("NULL"));
-        
+        HashMap<K, V> base = new HashMap<K, V>();
+        Map<K, V> map = DefaultedMap.decorate(base, ConstantFactory.getInstance((V) "NULL"));
+
         assertEquals(0, map.size());
         assertEquals(0, base.size());
         assertEquals(false, map.containsKey("NotInMap"));
         assertEquals("NULL", map.get("NotInMap"));
-        
-        map.put("Key", "Value");
+
+        map.put((K) "Key", (V) "Value");
         assertEquals(1, map.size());
         assertEquals(1, base.size());
         assertEquals(true, map.containsKey("Key"));
@@ -110,24 +113,25 @@ public class TestDefaultedMap extends AbstractTestMap {
         assertEquals("NULL", map.get("NotInMap"));
     }
 
+    @SuppressWarnings("unchecked")
     public void testMapGet4() {
-        HashMap base = new HashMap();
-        Map map = DefaultedMap.decorate(base, new Transformer() {
-            public Object transform(Object input) {
+        HashMap<K, V> base = new HashMap<K, V>();
+        Map<K, V> map = DefaultedMap.decorate(base, new Transformer<K, V>() {
+            public V transform(K input) {
                 if (input instanceof String) {
-                    return "NULL";
+                    return (V) "NULL";
                 }
-                return "NULL_OBJECT";
+                return (V) "NULL_OBJECT";
             }
         });
-        
+
         assertEquals(0, map.size());
         assertEquals(0, base.size());
         assertEquals(false, map.containsKey("NotInMap"));
         assertEquals("NULL", map.get("NotInMap"));
         assertEquals("NULL_OBJECT", map.get(new Integer(0)));
-        
-        map.put("Key", "Value");
+
+        map.put((K) "Key", (V) "Value");
         assertEquals(1, map.size());
         assertEquals(1, base.size());
         assertEquals(true, map.containsKey("Key"));

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java b/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java
index 6d24cc1..e70bd7a 100644
--- a/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java
+++ b/src/test/org/apache/commons/collections/map/TestFixedSizeMap.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.
@@ -28,10 +28,10 @@ import junit.framework.TestSuite;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestFixedSizeMap extends AbstractTestMap {
+public class TestFixedSizeMap<K, V> extends AbstractTestMap<K, V> {
 
     public TestFixedSizeMap(String testName) {
         super(testName);
@@ -46,16 +46,16 @@ public class TestFixedSizeMap extends AbstractTestMap {
         junit.textui.TestRunner.main(testCaseName);
     }
 
-    public Map makeEmptyMap() {
-        return FixedSizeMap.decorate(new HashMap());
+    public Map<K, V> makeObject() {
+        return FixedSizeMap.decorate(new HashMap<K, V>());
     }
 
-    public Map makeFullMap() {
-        Map map = new HashMap();
+    public Map<K, V> makeFullMap() {
+        Map<K, V> map = new HashMap<K, V>();
         addSampleMappings(map);
         return FixedSizeMap.decorate(map);
     }
-    
+
     public boolean isPutAddSupported() {
         return false;
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestFixedSizeSortedMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestFixedSizeSortedMap.java b/src/test/org/apache/commons/collections/map/TestFixedSizeSortedMap.java
index e244684..0d2aff6 100644
--- a/src/test/org/apache/commons/collections/map/TestFixedSizeSortedMap.java
+++ b/src/test/org/apache/commons/collections/map/TestFixedSizeSortedMap.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,7 +16,6 @@
  */
 package org.apache.commons.collections.map;
 
-import java.util.Map;
 import java.util.SortedMap;
 import java.util.TreeMap;
 
@@ -30,10 +29,10 @@ import org.apache.commons.collections.BulkTest;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestFixedSizeSortedMap extends AbstractTestSortedMap {
+public class TestFixedSizeSortedMap<K, V> extends AbstractTestSortedMap<K, V> {
 
     public TestFixedSizeSortedMap(String testName) {
         super(testName);
@@ -49,16 +48,16 @@ public class TestFixedSizeSortedMap extends AbstractTestSortedMap {
     }
 
     //-----------------------------------------------------------------------
-    public Map makeEmptyMap() {
-        return FixedSizeSortedMap.decorate(new TreeMap());
+    public SortedMap<K, V> makeObject() {
+        return FixedSizeSortedMap.decorate(new TreeMap<K, V>());
     }
 
-    public Map makeFullMap() {
-        SortedMap map = new TreeMap();
+    public SortedMap<K, V> makeFullMap() {
+        SortedMap<K, V> map = new TreeMap<K, V>();
         addSampleMappings(map);
         return FixedSizeSortedMap.decorate(map);
     }
-    
+
     public boolean isSubMapViewsSerializable() {
         // TreeMap sub map views have a bug in deserialization.
         return false;
@@ -76,7 +75,7 @@ public class TestFixedSizeSortedMap extends AbstractTestSortedMap {
     public String getCompatibilityVersion() {
         return "3.1";
     }
-    
+
 //    public void testCreate() throws Exception {
 //        resetEmpty();
 //        writeExternalFormToDisk(

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestFlat3Map.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestFlat3Map.java b/src/test/org/apache/commons/collections/map/TestFlat3Map.java
index 53a901e..fdf452e 100644
--- a/src/test/org/apache/commons/collections/map/TestFlat3Map.java
+++ b/src/test/org/apache/commons/collections/map/TestFlat3Map.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.
@@ -27,17 +27,18 @@ import junit.framework.Test;
 import junit.textui.TestRunner;
 
 import org.apache.commons.collections.BulkTest;
+import org.apache.commons.collections.IterableMap;
 import org.apache.commons.collections.MapIterator;
 import org.apache.commons.collections.iterators.AbstractTestMapIterator;
 
 /**
  * JUnit tests.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestFlat3Map extends AbstractTestIterableMap {
+public class TestFlat3Map<K, V> extends AbstractTestIterableMap<K, V> {
 
     private static final Integer ONE = new Integer(1);
     private static final Integer TWO = new Integer(2);
@@ -45,7 +46,7 @@ public class TestFlat3Map extends AbstractTestIterableMap {
     private static final String TEN = "10";
     private static final String TWENTY = "20";
     private static final String THIRTY = "30";
-        
+
     public TestFlat3Map(String testName) {
         super(testName);
     }
@@ -53,75 +54,80 @@ public class TestFlat3Map extends AbstractTestIterableMap {
     public static void main(String[] args) {
         TestRunner.run(suite());
     }
-    
+
     public static Test suite() {
         return BulkTest.makeSuite(TestFlat3Map.class);
     }
 
-    public Map makeEmptyMap() {
-        return new Flat3Map();
+    public Flat3Map<K, V> makeObject() {
+        return new Flat3Map<K, V>();
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testEquals1() {
-        Flat3Map map1 = new Flat3Map();
-        map1.put("a", "testA");
-        map1.put("b", "testB");
-        Flat3Map map2 = new Flat3Map();
-        map2.put("a", "testB");
-        map2.put("b", "testA");
+        Flat3Map<K, V> map1 = makeObject();
+        map1.put((K) "a", (V) "testA");
+        map1.put((K) "b", (V) "testB");
+        Flat3Map<K, V> map2 = makeObject();
+        map2.put((K) "a", (V) "testB");
+        map2.put((K) "b", (V) "testA");
         assertEquals(false, map1.equals(map2));
     }
 
+    @SuppressWarnings("unchecked")
     public void testEquals2() {
-        Flat3Map map1 = new Flat3Map();
-        map1.put("a", "testA");
-        map1.put("b", "testB");
-        Flat3Map map2 = new Flat3Map();
-        map2.put("a", "testB");
-        map2.put("c", "testA");
+        Flat3Map<K, V> map1 = makeObject();
+        map1.put((K) "a", (V) "testA");
+        map1.put((K) "b", (V) "testB");
+        Flat3Map<K, V> map2 = makeObject();
+        map2.put((K) "a", (V) "testB");
+        map2.put((K) "c", (V) "testA");
         assertEquals(false, map1.equals(map2));
     }
 
+    @SuppressWarnings("unchecked")
     public void testClone2() {
-        Flat3Map map = new Flat3Map();
+        Flat3Map<K, V> map = makeObject();
         assertEquals(0, map.size());
-        map.put(ONE, TEN);
-        map.put(TWO, TWENTY);
+        map.put((K) ONE, (V) TEN);
+        map.put((K) TWO, (V) TWENTY);
         assertEquals(2, map.size());
         assertEquals(true, map.containsKey(ONE));
         assertEquals(true, map.containsKey(TWO));
         assertSame(TEN, map.get(ONE));
         assertSame(TWENTY, map.get(TWO));
 
-        // clone works (size = 2)        
-        Flat3Map cloned = (Flat3Map) map.clone();
+        // clone works (size = 2)
+        Flat3Map<K, V> cloned = map.clone();
         assertEquals(2, cloned.size());
         assertEquals(true, cloned.containsKey(ONE));
         assertEquals(true, cloned.containsKey(TWO));
         assertSame(TEN, cloned.get(ONE));
         assertSame(TWENTY, cloned.get(TWO));
-        
+
         // change original doesn't change clone
-        map.put(TEN, ONE);
-        map.put(TWENTY, TWO);
+        map.put((K) TEN, (V) ONE);
+        map.put((K) TWENTY, (V) TWO);
         assertEquals(4, map.size());
         assertEquals(2, cloned.size());
         assertEquals(true, cloned.containsKey(ONE));
         assertEquals(true, cloned.containsKey(TWO));
         assertSame(TEN, cloned.get(ONE));
         assertSame(TWENTY, cloned.get(TWO));
-    }        
+    }
+
+    @SuppressWarnings("unchecked")
     public void testClone4() {
-        Flat3Map map = new Flat3Map();
+        Flat3Map<K, V> map = makeObject();
         assertEquals(0, map.size());
-        map.put(ONE, TEN);
-        map.put(TWO, TWENTY);
-        map.put(TEN, ONE);
-        map.put(TWENTY, TWO);
-        
+        map.put((K) ONE, (V) TEN);
+        map.put((K) TWO, (V) TWENTY);
+        map.put((K) TEN, (V) ONE);
+        map.put((K) TWENTY, (V) TWO);
+
         // clone works (size = 4)
-        Flat3Map cloned = (Flat3Map) map.clone();
+        Flat3Map<K, V> cloned = map.clone();
         assertEquals(4, map.size());
         assertEquals(4, cloned.size());
         assertEquals(true, cloned.containsKey(ONE));
@@ -132,7 +138,7 @@ public class TestFlat3Map extends AbstractTestIterableMap {
         assertSame(TWENTY, cloned.get(TWO));
         assertSame(ONE, cloned.get(TEN));
         assertSame(TWO, cloned.get(TWENTY));
-        
+
         // change original doesn't change clone
         map.clear();
         assertEquals(0, map.size());
@@ -146,9 +152,10 @@ public class TestFlat3Map extends AbstractTestIterableMap {
         assertSame(ONE, cloned.get(TEN));
         assertSame(TWO, cloned.get(TWENTY));
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testSerialisation0() throws Exception {
-        Flat3Map map = new Flat3Map();
+        Flat3Map<K, V> map = makeObject();
         ByteArrayOutputStream bout = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream(bout);
         out.writeObject(map);
@@ -161,12 +168,13 @@ public class TestFlat3Map extends AbstractTestIterableMap {
         assertEquals(0, map.size());
         assertEquals(0, ser.size());
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testSerialisation2() throws Exception {
-        Flat3Map map = new Flat3Map();
-        map.put(ONE, TEN);
-        map.put(TWO, TWENTY);
-        
+        Flat3Map<K, V> map = makeObject();
+        map.put((K) ONE, (V) TEN);
+        map.put((K) TWO, (V) TWENTY);
+
         ByteArrayOutputStream bout = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream(bout);
         out.writeObject(map);
@@ -183,14 +191,15 @@ public class TestFlat3Map extends AbstractTestIterableMap {
         assertEquals(TEN, ser.get(ONE));
         assertEquals(TWENTY, ser.get(TWO));
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testSerialisation4() throws Exception {
-        Flat3Map map = new Flat3Map();
-        map.put(ONE, TEN);
-        map.put(TWO, TWENTY);
-        map.put(TEN, ONE);
-        map.put(TWENTY, TWO);
-        
+        Flat3Map<K, V> map = makeObject();
+        map.put((K) ONE, (V) TEN);
+        map.put((K) TWO, (V) TWENTY);
+        map.put((K) TEN, (V) ONE);
+        map.put((K) TWENTY, (V) TWO);
+
         ByteArrayOutputStream bout = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream(bout);
         out.writeObject(map);
@@ -213,15 +222,16 @@ public class TestFlat3Map extends AbstractTestIterableMap {
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testEntryIteratorSetValue1() throws Exception {
-        Flat3Map map = new Flat3Map();
-        map.put(ONE, TEN);
-        map.put(TWO, TWENTY);
-        map.put(THREE, THIRTY);
-        
-        Iterator it = map.entrySet().iterator();
-        Map.Entry entry = (Map.Entry) it.next();
-        entry.setValue("NewValue");
+        Flat3Map<K, V> map = makeObject();
+        map.put((K) ONE, (V) TEN);
+        map.put((K) TWO, (V) TWENTY);
+        map.put((K) THREE, (V) THIRTY);
+
+        Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
+        Map.Entry<K, V> entry = it.next();
+        entry.setValue((V) "NewValue");
         assertEquals(3, map.size());
         assertEquals(true, map.containsKey(ONE));
         assertEquals(true, map.containsKey(TWO));
@@ -231,16 +241,17 @@ public class TestFlat3Map extends AbstractTestIterableMap {
         assertEquals(THIRTY, map.get(THREE));
     }
 
+    @SuppressWarnings("unchecked")
     public void testEntryIteratorSetValue2() throws Exception {
-        Flat3Map map = new Flat3Map();
-        map.put(ONE, TEN);
-        map.put(TWO, TWENTY);
-        map.put(THREE, THIRTY);
-        
-        Iterator it = map.entrySet().iterator();
+        Flat3Map<K, V> map = makeObject();
+        map.put((K) ONE, (V) TEN);
+        map.put((K) TWO, (V) TWENTY);
+        map.put((K) THREE, (V) THIRTY);
+
+        Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
         it.next();
-        Map.Entry entry = (Map.Entry) it.next();
-        entry.setValue("NewValue");
+        Map.Entry<K, V> entry = it.next();
+        entry.setValue((V) "NewValue");
         assertEquals(3, map.size());
         assertEquals(true, map.containsKey(ONE));
         assertEquals(true, map.containsKey(TWO));
@@ -250,17 +261,18 @@ public class TestFlat3Map extends AbstractTestIterableMap {
         assertEquals(THIRTY, map.get(THREE));
     }
 
+    @SuppressWarnings("unchecked")
     public void testEntryIteratorSetValue3() throws Exception {
-        Flat3Map map = new Flat3Map();
-        map.put(ONE, TEN);
-        map.put(TWO, TWENTY);
-        map.put(THREE, THIRTY);
-        
-        Iterator it = map.entrySet().iterator();
+        Flat3Map<K, V> map = makeObject();
+        map.put((K) ONE, (V) TEN);
+        map.put((K) TWO, (V) TWENTY);
+        map.put((K) THREE, (V) THIRTY);
+
+        Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
         it.next();
         it.next();
-        Map.Entry entry = (Map.Entry) it.next();
-        entry.setValue("NewValue");
+        Map.Entry<K, V> entry = it.next();
+        entry.setValue((V) "NewValue");
         assertEquals(3, map.size());
         assertEquals(true, map.containsKey(ONE));
         assertEquals(true, map.containsKey(TWO));
@@ -271,15 +283,16 @@ public class TestFlat3Map extends AbstractTestIterableMap {
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testMapIteratorSetValue1() throws Exception {
-        Flat3Map map = new Flat3Map();
-        map.put(ONE, TEN);
-        map.put(TWO, TWENTY);
-        map.put(THREE, THIRTY);
-        
-        MapIterator it = map.mapIterator();
+        Flat3Map<K, V> map = makeObject();
+        map.put((K) ONE, (V) TEN);
+        map.put((K) TWO, (V) TWENTY);
+        map.put((K) THREE, (V) THIRTY);
+
+        MapIterator<K, V> it = map.mapIterator();
         it.next();
-        it.setValue("NewValue");
+        it.setValue((V) "NewValue");
         assertEquals(3, map.size());
         assertEquals(true, map.containsKey(ONE));
         assertEquals(true, map.containsKey(TWO));
@@ -289,16 +302,17 @@ public class TestFlat3Map extends AbstractTestIterableMap {
         assertEquals(THIRTY, map.get(THREE));
     }
 
+    @SuppressWarnings("unchecked")
     public void testMapIteratorSetValue2() throws Exception {
-        Flat3Map map = new Flat3Map();
-        map.put(ONE, TEN);
-        map.put(TWO, TWENTY);
-        map.put(THREE, THIRTY);
-        
-        MapIterator it = map.mapIterator();
+        Flat3Map<K, V> map = makeObject();
+        map.put((K) ONE, (V) TEN);
+        map.put((K) TWO, (V) TWENTY);
+        map.put((K) THREE, (V) THIRTY);
+
+        MapIterator<K, V> it = map.mapIterator();
         it.next();
         it.next();
-        it.setValue("NewValue");
+        it.setValue((V) "NewValue");
         assertEquals(3, map.size());
         assertEquals(true, map.containsKey(ONE));
         assertEquals(true, map.containsKey(TWO));
@@ -308,17 +322,18 @@ public class TestFlat3Map extends AbstractTestIterableMap {
         assertEquals(THIRTY, map.get(THREE));
     }
 
+    @SuppressWarnings("unchecked")
     public void testMapIteratorSetValue3() throws Exception {
-        Flat3Map map = new Flat3Map();
-        map.put(ONE, TEN);
-        map.put(TWO, TWENTY);
-        map.put(THREE, THIRTY);
-        
-        MapIterator it = map.mapIterator();
+        Flat3Map<K, V> map = makeObject();
+        map.put((K) ONE, (V) TEN);
+        map.put((K) TWO, (V) TWENTY);
+        map.put((K) THREE, (V) THIRTY);
+
+        MapIterator<K, V> it = map.mapIterator();
         it.next();
         it.next();
         it.next();
-        it.setValue("NewValue");
+        it.setValue((V) "NewValue");
         assertEquals(3, map.size());
         assertEquals(true, map.containsKey(ONE));
         assertEquals(true, map.containsKey(TWO));
@@ -332,16 +347,16 @@ public class TestFlat3Map extends AbstractTestIterableMap {
     public BulkTest bulkTestMapIterator() {
         return new TestFlatMapIterator();
     }
-    
-    public class TestFlatMapIterator extends AbstractTestMapIterator {
+
+    public class TestFlatMapIterator extends AbstractTestMapIterator<K, V> {
         public TestFlatMapIterator() {
             super("TestFlatMapIterator");
         }
-        
-        public Object[] addSetValues() {
+
+        public V[] addSetValues() {
             return TestFlat3Map.this.getNewSampleValues();
         }
-        
+
         public boolean supportsRemove() {
             return TestFlat3Map.this.isRemoveSupported();
         }
@@ -350,32 +365,32 @@ public class TestFlat3Map extends AbstractTestIterableMap {
             return TestFlat3Map.this.isSetValueSupported();
         }
 
-        public MapIterator makeEmptyMapIterator() {
+        public MapIterator<K, V> makeEmptyIterator() {
             resetEmpty();
-            return ((Flat3Map) TestFlat3Map.this.map).mapIterator();
+            return TestFlat3Map.this.getMap().mapIterator();
         }
 
-        public MapIterator makeFullMapIterator() {
+        public MapIterator<K, V> makeObject() {
             resetFull();
-            return ((Flat3Map) TestFlat3Map.this.map).mapIterator();
+            return TestFlat3Map.this.getMap().mapIterator();
         }
-        
-        public Map getMap() {
+
+        public IterableMap<K, V> getMap() {
             // assumes makeFullMapIterator() called first
-            return TestFlat3Map.this.map;
+            return TestFlat3Map.this.getMap();
         }
-        
-        public Map getConfirmedMap() {
+
+        public Map<K, V> getConfirmedMap() {
             // assumes makeFullMapIterator() called first
-            return TestFlat3Map.this.confirmed;
+            return TestFlat3Map.this.getConfirmed();
         }
-        
+
         public void verify() {
             super.verify();
             TestFlat3Map.this.verify();
         }
     }
-    
+
     public String getCompatibilityVersion() {
         return "3.1";
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestHashedMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestHashedMap.java b/src/test/org/apache/commons/collections/map/TestHashedMap.java
index 2f2e091..f22220f 100644
--- a/src/test/org/apache/commons/collections/map/TestHashedMap.java
+++ b/src/test/org/apache/commons/collections/map/TestHashedMap.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,8 +16,6 @@
  */
 package org.apache.commons.collections.map;
 
-import java.util.Map;
-
 import junit.framework.Test;
 import junit.textui.TestRunner;
 
@@ -25,12 +23,12 @@ import org.apache.commons.collections.BulkTest;
 
 /**
  * JUnit tests.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestHashedMap extends AbstractTestIterableMap {
+public class TestHashedMap<K, V> extends AbstractTestIterableMap<K, V> {
 
     public TestHashedMap(String testName) {
         super(testName);
@@ -39,29 +37,30 @@ public class TestHashedMap extends AbstractTestIterableMap {
     public static void main(String[] args) {
         TestRunner.run(suite());
     }
-    
+
     public static Test suite() {
         return BulkTest.makeSuite(TestHashedMap.class);
     }
 
-    public Map makeEmptyMap() {
-        return new HashedMap();
+    public HashedMap<K, V> makeObject() {
+        return new HashedMap<K, V>();
     }
-    
+
     public String getCompatibilityVersion() {
         return "3";
     }
 
+    @SuppressWarnings("unchecked")
     public void testClone() {
-        HashedMap map = new HashedMap(10);
-        map.put("1", "1");
-        Map cloned = (Map) map.clone();
+        HashedMap<K, V> map = new HashedMap<K, V>(10);
+        map.put((K) "1", (V) "1");
+        HashedMap<K, V> cloned = map.clone();
         assertEquals(map.size(), cloned.size());
         assertSame(map.get("1"), cloned.get("1"));
     }
 
     public void testInternalState() {
-        HashedMap map = new HashedMap(42, 0.75f);
+        HashedMap<K, V> map = new HashedMap<K, V>(42, 0.75f);
         assertEquals(0.75f, map.loadFactor, 0.1f);
         assertEquals(0, map.size);
         assertEquals(64, map.data.length);

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestIdentityMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestIdentityMap.java b/src/test/org/apache/commons/collections/map/TestIdentityMap.java
index 6b2df6e..b5b964f 100644
--- a/src/test/org/apache/commons/collections/map/TestIdentityMap.java
+++ b/src/test/org/apache/commons/collections/map/TestIdentityMap.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,13 +30,13 @@ import org.apache.commons.collections.IterableMap;
 
 /**
  * JUnit tests.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestIdentityMap extends AbstractTestObject {
-    
+public class TestIdentityMap<K, V> extends AbstractTestObject {
+
     private static final Integer I1A = new Integer(1);
     private static final Integer I1B = new Integer(1);
     private static final Integer I2A = new Integer(2);
@@ -49,26 +49,27 @@ public class TestIdentityMap extends AbstractTestObject {
     public static void main(String[] args) {
         TestRunner.run(suite());
     }
-    
+
     public static Test suite() {
         return new TestSuite(TestIdentityMap.class);
 //        return BulkTest.makeSuite(TestIdentityMap.class);  // causes race condition!
     }
-    
-    public Object makeObject() {
-        return new IdentityMap();
+
+    public IdentityMap<K, V> makeObject() {
+        return new IdentityMap<K, V>();
     }
-    
+
     public String getCompatibilityVersion() {
         return "3";
     }
-    
+
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testBasics() {
-        IterableMap map = new IdentityMap();
+        IterableMap<K, V> map = new IdentityMap<K, V>();
         assertEquals(0, map.size());
-        
-        map.put(I1A, I2A);
+
+        map.put((K) I1A, (V) I2A);
         assertEquals(1, map.size());
         assertSame(I2A, map.get(I1A));
         assertSame(null, map.get(I1B));
@@ -76,8 +77,8 @@ public class TestIdentityMap extends AbstractTestObject {
         assertEquals(false, map.containsKey(I1B));
         assertEquals(true, map.containsValue(I2A));
         assertEquals(false, map.containsValue(I2B));
-        
-        map.put(I1A, I2B);
+
+        map.put((K) I1A, (V) I2B);
         assertEquals(1, map.size());
         assertSame(I2B, map.get(I1A));
         assertSame(null, map.get(I1B));
@@ -85,8 +86,8 @@ public class TestIdentityMap extends AbstractTestObject {
         assertEquals(false, map.containsKey(I1B));
         assertEquals(false, map.containsValue(I2A));
         assertEquals(true, map.containsValue(I2B));
-        
-        map.put(I1B, I2B);
+
+        map.put((K) I1B, (V) I2B);
         assertEquals(2, map.size());
         assertSame(I2B, map.get(I1A));
         assertSame(I2B, map.get(I1B));
@@ -95,45 +96,48 @@ public class TestIdentityMap extends AbstractTestObject {
         assertEquals(false, map.containsValue(I2A));
         assertEquals(true, map.containsValue(I2B));
     }
-    
+
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testHashEntry() {
-        IterableMap map = new IdentityMap();
-        
-        map.put(I1A, I2A);
-        map.put(I1B, I2A);
-        
-        Map.Entry entry1 = (Map.Entry) map.entrySet().iterator().next();
-        Iterator it = map.entrySet().iterator();
-        Map.Entry entry2 = (Map.Entry) it.next();
-        Map.Entry entry3 = (Map.Entry) it.next();
-        
+        IterableMap<K, V> map = new IdentityMap<K, V>();
+
+        map.put((K) I1A, (V) I2A);
+        map.put((K) I1B, (V) I2A);
+
+        Map.Entry<K, V> entry1 = map.entrySet().iterator().next();
+        Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
+        Map.Entry<K, V> entry2 = it.next();
+        Map.Entry<K, V> entry3 = it.next();
+
         assertEquals(true, entry1.equals(entry2));
         assertEquals(true, entry2.equals(entry1));
         assertEquals(false, entry1.equals(entry3));
     }
-    
+
     /**
      * Compare the current serialized form of the Map
      * against the canonical version in CVS.
      */
+    @SuppressWarnings("unchecked")
     public void testEmptyMapCompatibility() throws IOException, ClassNotFoundException {
         // test to make sure the canonical form has been preserved
-        Map map = (Map) makeObject();
+        Map<K, V> map = makeObject();
         if (map instanceof Serializable && !skipSerializedCanonicalTests()) {
             Map map2 = (Map) readExternalFormFromDisk(getCanonicalEmptyCollectionName(map));
             assertEquals("Map is empty", 0, map2.size());
         }
     }
 
+    @SuppressWarnings("unchecked")
     public void testClone() {
-        IdentityMap map = new IdentityMap(10);
-        map.put("1", "1");
-        Map cloned = (Map) map.clone();
+        IdentityMap<K, V> map = new IdentityMap<K, V>(10);
+        map.put((K) "1", (V) "1");
+        Map<K, V> cloned = map.clone();
         assertEquals(map.size(), cloned.size());
         assertSame(map.get("1"), cloned.get("1"));
     }
-    
+
 //    public void testCreate() throws Exception {
 //        Map map = new IdentityMap();
 //        writeExternalFormToDisk((java.io.Serializable) map, "D:/dev/collections/data/test/IdentityMap.emptyCollection.version3.obj");

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/map/TestLRUMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestLRUMap.java b/src/test/org/apache/commons/collections/map/TestLRUMap.java
index bee6678..22c3e67 100644
--- a/src/test/org/apache/commons/collections/map/TestLRUMap.java
+++ b/src/test/org/apache/commons/collections/map/TestLRUMap.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,12 +30,12 @@ import org.apache.commons.collections.ResettableIterator;
 
 /**
  * JUnit tests.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public class TestLRUMap extends AbstractTestOrderedMap {
+public class TestLRUMap<K, V> extends AbstractTestOrderedMap<K, V> {
 
     public TestLRUMap(String testName) {
         super(testName);
@@ -44,19 +44,27 @@ public class TestLRUMap extends AbstractTestOrderedMap {
     public static void main(String[] args) {
         TestRunner.run(suite());
     }
-    
+
     public static Test suite() {
         return BulkTest.makeSuite(TestLRUMap.class);
     }
 
-    public Map makeEmptyMap() {
-        return new LRUMap();
+    public LRUMap<K, V> makeObject() {
+        return new LRUMap<K, V>();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public LRUMap<K, V> makeFullMap() {
+        return (LRUMap<K, V>) super.makeFullMap();
     }
 
     public boolean isGetStructuralModify() {
         return true;
     }
-    
+
     public String getCompatibilityVersion() {
         return "3";
     }
@@ -64,169 +72,174 @@ public class TestLRUMap extends AbstractTestOrderedMap {
     //-----------------------------------------------------------------------
     public void testLRU() {
         if (isPutAddSupported() == false || isPutChangeSupported() == false) return;
-        Object[] keys = getSampleKeys();
-        Object[] values = getSampleValues();
-        Iterator it = null;
-        
-        LRUMap map = new LRUMap(2);
+        K[] keys = getSampleKeys();
+        V[] values = getSampleValues();
+        Iterator<K> kit;
+        Iterator<V> vit;
+
+        LRUMap<K, V> map = new LRUMap<K, V>(2);
         assertEquals(0, map.size());
         assertEquals(false, map.isFull());
         assertEquals(2, map.maxSize());
-        
+
         map.put(keys[0], values[0]);
         assertEquals(1, map.size());
         assertEquals(false, map.isFull());
         assertEquals(2, map.maxSize());
-        
+
         map.put(keys[1], values[1]);
         assertEquals(2, map.size());
         assertEquals(true, map.isFull());
         assertEquals(2, map.maxSize());
-        it = map.keySet().iterator();
-        assertSame(keys[0], it.next());
-        assertSame(keys[1], it.next());
-        it = map.values().iterator();
-        assertSame(values[0], it.next());
-        assertSame(values[1], it.next());
+        kit = map.keySet().iterator();
+        assertSame(keys[0], kit.next());
+        assertSame(keys[1], kit.next());
+        vit = map.values().iterator();
+        assertSame(values[0], vit.next());
+        assertSame(values[1], vit.next());
 
         map.put(keys[2], values[2]);
         assertEquals(2, map.size());
         assertEquals(true, map.isFull());
         assertEquals(2, map.maxSize());
-        it = map.keySet().iterator();
-        assertSame(keys[1], it.next());
-        assertSame(keys[2], it.next());
-        it = map.values().iterator();
-        assertSame(values[1], it.next());
-        assertSame(values[2], it.next());
+        kit = map.keySet().iterator();
+        assertSame(keys[1], kit.next());
+        assertSame(keys[2], kit.next());
+        vit = map.values().iterator();
+        assertSame(values[1], vit.next());
+        assertSame(values[2], vit.next());
 
         map.put(keys[2], values[0]);
         assertEquals(2, map.size());
         assertEquals(true, map.isFull());
         assertEquals(2, map.maxSize());
-        it = map.keySet().iterator();
-        assertSame(keys[1], it.next());
-        assertSame(keys[2], it.next());
-        it = map.values().iterator();
-        assertSame(values[1], it.next());
-        assertSame(values[0], it.next());
+        kit = map.keySet().iterator();
+        assertSame(keys[1], kit.next());
+        assertSame(keys[2], kit.next());
+        vit = map.values().iterator();
+        assertSame(values[1], vit.next());
+        assertSame(values[0], vit.next());
 
         map.put(keys[1], values[3]);
         assertEquals(2, map.size());
         assertEquals(true, map.isFull());
         assertEquals(2, map.maxSize());
-        it = map.keySet().iterator();
-        assertSame(keys[2], it.next());
-        assertSame(keys[1], it.next());
-        it = map.values().iterator();
-        assertSame(values[0], it.next());
-        assertSame(values[3], it.next());
+        kit = map.keySet().iterator();
+        assertSame(keys[2], kit.next());
+        assertSame(keys[1], kit.next());
+        vit = map.values().iterator();
+        assertSame(values[0], vit.next());
+        assertSame(values[3], vit.next());
     }
-    
-    //-----------------------------------------------------------------------    
+
+    //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public void testReset() {
         resetEmpty();
-        OrderedMap ordered = (OrderedMap) map;
-        ((ResettableIterator) ordered.mapIterator()).reset();
-        
+        OrderedMap<K, V> ordered = getMap();
+        ((ResettableIterator<K>) ordered.mapIterator()).reset();
+
         resetFull();
-        ordered = (OrderedMap) map;
-        List list = new ArrayList(ordered.keySet());
-        ResettableIterator it = (ResettableIterator) ordered.mapIterator();
+        ordered = getMap();
+        List<K> list = new ArrayList<K>(ordered.keySet());
+        ResettableIterator<K> it = (ResettableIterator<K>) ordered.mapIterator();
         assertSame(list.get(0), it.next());
         assertSame(list.get(1), it.next());
         it.reset();
         assertSame(list.get(0), it.next());
     }
-    
+
     //-----------------------------------------------------------------------
     public void testAccessOrder() {
         if (isPutAddSupported() == false || isPutChangeSupported() == false) return;
-        Object[] keys = getSampleKeys();
-        Object[] values = getSampleValues();
-        Iterator it = null;
-        
+        K[] keys = getSampleKeys();
+        V[] values = getSampleValues();
+        Iterator<K> kit = null;
+        Iterator<V> vit = null;
+
         resetEmpty();
         map.put(keys[0], values[0]);
         map.put(keys[1], values[1]);
-        it = map.keySet().iterator();
-        assertSame(keys[0], it.next());
-        assertSame(keys[1], it.next());
-        it = map.values().iterator();
-        assertSame(values[0], it.next());
-        assertSame(values[1], it.next());
+        kit = map.keySet().iterator();
+        assertSame(keys[0], kit.next());
+        assertSame(keys[1], kit.next());
+        vit = map.values().iterator();
+        assertSame(values[0], vit.next());
+        assertSame(values[1], vit.next());
 
         // no change to order
         map.put(keys[1], values[1]);
-        it = map.keySet().iterator();
-        assertSame(keys[0], it.next());
-        assertSame(keys[1], it.next());
-        it = map.values().iterator();
-        assertSame(values[0], it.next());
-        assertSame(values[1], it.next());
+        kit = map.keySet().iterator();
+        assertSame(keys[0], kit.next());
+        assertSame(keys[1], kit.next());
+        vit = map.values().iterator();
+        assertSame(values[0], vit.next());
+        assertSame(values[1], vit.next());
 
         // no change to order
         map.put(keys[1], values[2]);
-        it = map.keySet().iterator();
-        assertSame(keys[0], it.next());
-        assertSame(keys[1], it.next());
-        it = map.values().iterator();
-        assertSame(values[0], it.next());
-        assertSame(values[2], it.next());
+        kit = map.keySet().iterator();
+        assertSame(keys[0], kit.next());
+        assertSame(keys[1], kit.next());
+        vit = map.values().iterator();
+        assertSame(values[0], vit.next());
+        assertSame(values[2], vit.next());
 
         // change to order
         map.put(keys[0], values[3]);
-        it = map.keySet().iterator();
-        assertSame(keys[1], it.next());
-        assertSame(keys[0], it.next());
-        it = map.values().iterator();
-        assertSame(values[2], it.next());
-        assertSame(values[3], it.next());
+        kit = map.keySet().iterator();
+        assertSame(keys[1], kit.next());
+        assertSame(keys[0], kit.next());
+        vit = map.values().iterator();
+        assertSame(values[2], vit.next());
+        assertSame(values[3], vit.next());
 
         // change to order
         map.get(keys[1]);
-        it = map.keySet().iterator();
-        assertSame(keys[0], it.next());
-        assertSame(keys[1], it.next());
-        it = map.values().iterator();
-        assertSame(values[3], it.next());
-        assertSame(values[2], it.next());
+        kit = map.keySet().iterator();
+        assertSame(keys[0], kit.next());
+        assertSame(keys[1], kit.next());
+        vit = map.values().iterator();
+        assertSame(values[3], vit.next());
+        assertSame(values[2], vit.next());
 
         // change to order
         map.get(keys[0]);
-        it = map.keySet().iterator();
-        assertSame(keys[1], it.next());
-        assertSame(keys[0], it.next());
-        it = map.values().iterator();
-        assertSame(values[2], it.next());
-        assertSame(values[3], it.next());
+        kit = map.keySet().iterator();
+        assertSame(keys[1], kit.next());
+        assertSame(keys[0], kit.next());
+        vit = map.values().iterator();
+        assertSame(values[2], vit.next());
+        assertSame(values[3], vit.next());
 
         // no change to order
         map.get(keys[0]);
-        it = map.keySet().iterator();
-        assertSame(keys[1], it.next());
-        assertSame(keys[0], it.next());
-        it = map.values().iterator();
-        assertSame(values[2], it.next());
-        assertSame(values[3], it.next());
+        kit = map.keySet().iterator();
+        assertSame(keys[1], kit.next());
+        assertSame(keys[0], kit.next());
+        vit = map.values().iterator();
+        assertSame(values[2], vit.next());
+        assertSame(values[3], vit.next());
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testClone() {
-        LRUMap map = new LRUMap(10);
-        map.put("1", "1");
-        Map cloned = (Map) map.clone();
+        LRUMap<K, V> map = new LRUMap<K, V>(10);
+        map.put((K) "1", (V) "1");
+        Map<K, V> cloned = map.clone();
         assertEquals(map.size(), cloned.size());
         assertSame(map.get("1"), cloned.get("1"));
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testRemoveLRU() {
         MockLRUMapSubclass map = new MockLRUMapSubclass(2);
         assertNull(map.entry);
-        map.put("A", "a");
+        map.put((K) "A", "a");
         assertNull(map.entry);
-        map.put("B", "b");
+        map.put((K) "B", "b");
         assertNull(map.entry);
-        map.put("C", "c");  // removes oldest, which is A=a
+        map.put((K) "C", "c");  // removes oldest, which is A=a
         assertNotNull(map.entry);
         assertEquals("A", map.key);
         assertEquals("a", map.value);
@@ -236,32 +249,34 @@ public class TestLRUMap extends AbstractTestOrderedMap {
         assertEquals(true, map.containsKey("B"));
         assertEquals(true, map.containsKey("C"));
     }
-    
-    static class MockLRUMapSubclass extends LRUMap {
-        LinkEntry entry;
-        Object key;
-        Object value;
+
+    @SuppressWarnings("serial")
+    static class MockLRUMapSubclass<K, V> extends LRUMap<K, V> {
+        LinkEntry<K, V> entry;
+        K key;
+        V value;
 
         MockLRUMapSubclass(int size) {
             super(size);
         }
 
-        protected boolean removeLRU(LinkEntry entry) {
+        protected boolean removeLRU(LinkEntry<K, V> entry) {
             this.entry = entry;
             this.key = entry.getKey();
             this.value = entry.getValue();
             return true;
         }
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testRemoveLRUBlocksRemove() {
-        MockLRUMapSubclassBlocksRemove map = new MockLRUMapSubclassBlocksRemove(2, false);
+        MockLRUMapSubclassBlocksRemove<K, V> map = new MockLRUMapSubclassBlocksRemove<K, V>(2, false);
         assertEquals(0, map.size());
-        map.put("A", "a");
+        map.put((K) "A", (V) "a");
         assertEquals(1, map.size());
-        map.put("B", "b");
+        map.put((K) "B", (V) "b");
         assertEquals(2, map.size());
-        map.put("C", "c");  // should remove oldest, which is A=a, but this is blocked
+        map.put((K) "C", (V) "c");  // should remove oldest, which is A=a, but this is blocked
         assertEquals(3, map.size());
         assertEquals(2, map.maxSize());
         assertEquals(true, map.containsKey("A"));
@@ -269,39 +284,42 @@ public class TestLRUMap extends AbstractTestOrderedMap {
         assertEquals(true, map.containsKey("C"));
     }
 
+    @SuppressWarnings("unchecked")
     public void testRemoveLRUBlocksRemoveScan() {
-        MockLRUMapSubclassBlocksRemove map = new MockLRUMapSubclassBlocksRemove(2, true);
+        MockLRUMapSubclassBlocksRemove<K, V> map = new MockLRUMapSubclassBlocksRemove<K, V>(2, true);
         assertEquals(0, map.size());
-        map.put("A", "a");
+        map.put((K) "A", (V) "a");
         assertEquals(1, map.size());
-        map.put("B", "b");
+        map.put((K) "B", (V) "b");
         assertEquals(2, map.size());
-        map.put("C", "c");  // should remove oldest, which is A=a, but this is blocked
+        map.put((K) "C", (V) "c");  // should remove oldest, which is A=a, but this is blocked
         assertEquals(3, map.size());
         assertEquals(2, map.maxSize());
         assertEquals(true, map.containsKey("A"));
         assertEquals(true, map.containsKey("B"));
         assertEquals(true, map.containsKey("C"));
     }
-    
-    static class MockLRUMapSubclassBlocksRemove extends LRUMap {
+
+    @SuppressWarnings("serial")
+    static class MockLRUMapSubclassBlocksRemove<K, V> extends LRUMap<K, V> {
         MockLRUMapSubclassBlocksRemove(int size, boolean scanUntilRemove) {
             super(size, scanUntilRemove);
         }
 
-        protected boolean removeLRU(LinkEntry entry) {
+        protected boolean removeLRU(LinkEntry<K, V> entry) {
             return false;
         }
     }
-    
+
+    @SuppressWarnings("unchecked")
     public void testRemoveLRUFirstBlocksRemove() {
-        MockLRUMapSubclassFirstBlocksRemove map = new MockLRUMapSubclassFirstBlocksRemove(2);
+        MockLRUMapSubclassFirstBlocksRemove<K, V> map = new MockLRUMapSubclassFirstBlocksRemove<K, V>(2);
         assertEquals(0, map.size());
-        map.put("A", "a");
+        map.put((K) "A", (V) "a");
         assertEquals(1, map.size());
-        map.put("B", "b");
+        map.put((K) "B", (V) "b");
         assertEquals(2, map.size());
-        map.put("C", "c");  // should remove oldest, which is A=a  but this is blocked - so advance to B=b
+        map.put((K) "C", (V) "c");  // should remove oldest, which is A=a  but this is blocked - so advance to B=b
         assertEquals(2, map.size());
         assertEquals(2, map.maxSize());
         assertEquals(true, map.containsKey("A"));
@@ -309,12 +327,13 @@ public class TestLRUMap extends AbstractTestOrderedMap {
         assertEquals(true, map.containsKey("C"));
     }
 
-    static class MockLRUMapSubclassFirstBlocksRemove extends LRUMap {
+    @SuppressWarnings("serial")
+    static class MockLRUMapSubclassFirstBlocksRemove<K, V> extends LRUMap<K, V> {
         MockLRUMapSubclassFirstBlocksRemove(int size) {
             super(size, true);
         }
 
-        protected boolean removeLRU(LinkEntry entry) {
+        protected boolean removeLRU(LinkEntry<K, V> entry) {
             if ("a".equals(entry.getValue())) {
                 return false;
             } else {
@@ -339,6 +358,7 @@ public class TestLRUMap extends AbstractTestOrderedMap {
         }
     }
 
+    @SuppressWarnings("unchecked")
     public void testInternalState_Buckets() {
         if (isPutAddSupported() == false || isPutChangeSupported() == false) return;
         SingleHashCode one = new SingleHashCode("1");
@@ -348,12 +368,12 @@ public class TestLRUMap extends AbstractTestOrderedMap {
         SingleHashCode five = new SingleHashCode("5");
         SingleHashCode six = new SingleHashCode("6");
 
-        LRUMap map = new LRUMap(3, 1.0f);
+        LRUMap<K, V> map = new LRUMap<K, V>(3, 1.0f);
         int hashIndex = map.hashIndex(map.hash(one), 4);
-        map.put(one, "A");
-        map.put(two, "B");
-        map.put(three, "C");
-        
+        map.put((K) one, (V) "A");
+        map.put((K) two, (V) "B");
+        map.put((K) three, (V) "C");
+
         assertEquals(4, map.data.length);
         assertEquals(3, map.size);
         assertEquals(null, map.header.next);
@@ -363,9 +383,9 @@ public class TestLRUMap extends AbstractTestOrderedMap {
         assertEquals(three, map.data[hashIndex].key);
         assertEquals(two, map.data[hashIndex].next.key);
         assertEquals(one, map.data[hashIndex].next.next.key);
-        
-        map.put(four, "D");  // reuses last in next list
-        
+
+        map.put((K) four, (V) "D");  // reuses last in next list
+
         assertEquals(4, map.data.length);
         assertEquals(3, map.size);
         assertEquals(null, map.header.next);
@@ -375,9 +395,9 @@ public class TestLRUMap extends AbstractTestOrderedMap {
         assertEquals(four, map.data[hashIndex].key);
         assertEquals(three, map.data[hashIndex].next.key);
         assertEquals(two, map.data[hashIndex].next.next.key);
-        
+
         map.get(three);
-        
+
         assertEquals(4, map.data.length);
         assertEquals(3, map.size);
         assertEquals(null, map.header.next);
@@ -387,9 +407,9 @@ public class TestLRUMap extends AbstractTestOrderedMap {
         assertEquals(four, map.data[hashIndex].key);
         assertEquals(three, map.data[hashIndex].next.key);
         assertEquals(two, map.data[hashIndex].next.next.key);
-        
-        map.put(five, "E");  // reuses last in next list
-        
+
+        map.put((K) five, (V) "E");  // reuses last in next list
+
         assertEquals(4, map.data.length);
         assertEquals(3, map.size);
         assertEquals(null, map.header.next);
@@ -399,10 +419,10 @@ public class TestLRUMap extends AbstractTestOrderedMap {
         assertEquals(five, map.data[hashIndex].key);
         assertEquals(four, map.data[hashIndex].next.key);
         assertEquals(three, map.data[hashIndex].next.next.key);
-        
+
         map.get(three);
         map.get(five);
-        
+
         assertEquals(4, map.data.length);
         assertEquals(3, map.size);
         assertEquals(null, map.header.next);
@@ -412,9 +432,9 @@ public class TestLRUMap extends AbstractTestOrderedMap {
         assertEquals(five, map.data[hashIndex].key);
         assertEquals(four, map.data[hashIndex].next.key);
         assertEquals(three, map.data[hashIndex].next.next.key);
-        
-        map.put(six, "F");  // reuses middle in next list
-        
+
+        map.put((K) six, (V) "F");  // reuses middle in next list
+
         assertEquals(4, map.data.length);
         assertEquals(3, map.size);
         assertEquals(null, map.header.next);
@@ -426,21 +446,18 @@ public class TestLRUMap extends AbstractTestOrderedMap {
         assertEquals(three, map.data[hashIndex].next.next.key);
     }
 
+    @SuppressWarnings("unchecked")
     public void testInternalState_getEntry_int() {
         if (isPutAddSupported() == false || isPutChangeSupported() == false) return;
         SingleHashCode one = new SingleHashCode("1");
         SingleHashCode two = new SingleHashCode("2");
         SingleHashCode three = new SingleHashCode("3");
-        SingleHashCode four = new SingleHashCode("4");
-        SingleHashCode five = new SingleHashCode("5");
-        SingleHashCode six = new SingleHashCode("6");
 
-        LRUMap map = new LRUMap(3, 1.0f);
-        int hashIndex = map.hashIndex(map.hash(one), 4);
-        map.put(one, "A");
-        map.put(two, "B");
-        map.put(three, "C");
-        
+        LRUMap<K, V> map = new LRUMap<K, V>(3, 1.0f);
+        map.put((K) one, (V) "A");
+        map.put((K) two, (V) "B");
+        map.put((K) three, (V) "C");
+
         assertEquals(one, map.getEntry(0).key);
         assertEquals(two, map.getEntry(1).key);
         assertEquals(three, map.getEntry(2).key);
@@ -460,4 +477,12 @@ public class TestLRUMap extends AbstractTestOrderedMap {
 //        resetFull();
 //        writeExternalFormToDisk((java.io.Serializable) map, "D:/dev/collections/data/test/LRUMap.fullCollection.version3.obj");
 //    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public LRUMap<K, V> getMap() {
+        return (LRUMap<K, V>) super.getMap();
+    }
 }


[77/77] [abbrv] commons-collections git commit: Obsolete DOAP

Posted by ch...@apache.org.
Obsolete DOAP

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@1719134 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/76d7c407
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/76d7c407
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/76d7c407

Branch: refs/heads/collections_jdk5_branch
Commit: 76d7c4078f31674bf646100ba75e2d17d86b0c15
Parents: d74b0b0
Author: Sebastian Bazley <se...@apache.org>
Authored: Thu Dec 10 18:11:21 2015 +0000
Committer: Sebastian Bazley <se...@apache.org>
Committed: Thu Dec 10 18:11:21 2015 +0000

----------------------------------------------------------------------
 doap_collections.rdf | 55 -----------------------------------------------
 1 file changed, 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/76d7c407/doap_collections.rdf
----------------------------------------------------------------------
diff --git a/doap_collections.rdf b/doap_collections.rdf
deleted file mode 100644
index c1e9fa9..0000000
--- a/doap_collections.rdf
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-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.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<rdf:RDF xmlns="http://usefulinc.com/ns/doap#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:asfext="http://projects.apache.org/ns/asfext#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:doap="http://usefulinc.com/ns/doap#" xml:lang="en">
-  <Project rdf:about="http://commons.apache.org/collections/">
-    <name>Apache Commons Collections</name>
-    <homepage rdf:resource="http://commons.apache.org/collections/"/>
-    <programming-language>Java</programming-language>
-    <category rdf:resource="http://projects.apache.org/category/library"/>
-    <license rdf:resource="http://usefulinc.com/doap/licenses/asl20"/>
-    <bug-database rdf:resource="http://issues.apache.org/jira/browse/COLLECTIONS"/>
-    <download-page rdf:resource="http://jakarta.apache.org/site/downloads/downloads_commons-collections.cgi"/>
-    <asfext:pmc rdf:resource="http://commons.apache.org/"/>
-    <shortdesc xml:lang="en">Commons Collections</shortdesc>
-    <description xml:lang="en">Types that extend and augment the Java Collections Framework.</description>
-    <repository>
-      <SVNRepository>
-        <browse rdf:resource="http://svn.apache.org/repos/asf/commons/proper/collections/trunk"/>
-        <location rdf:resource="http://svn.apache.org/repos/asf/commons/proper/collections"/>
-      </SVNRepository>
-    </repository>
-    <release>
-      <Version>
-        <name>commons-collections</name>
-        <created>2006-05-14</created>
-        <revision>3.2</revision>
-      </Version>
-      <Version>
-        <name>commons-collections</name>
-        <created>2004-06-23</created>
-        <revision>3.1</revision>
-      </Version>
-      <Version>
-        <name>commons-collections</name>
-        <created>2004-06-23</created>
-        <revision>2.1.1</revision>
-      </Version>
-    </release>
-    <mailing-list rdf:resource="http://commons.apache.org/mail-lists.html"/>
-  </Project>
-</rdf:RDF>


[42/77] [abbrv] commons-collections git commit: ws

Posted by ch...@apache.org.
ws

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@740457 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/1bc525db
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/1bc525db
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/1bc525db

Branch: refs/heads/collections_jdk5_branch
Commit: 1bc525dbb7034700479d8f74b08e962b25846572
Parents: 2aefdf6
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Tue Feb 3 21:23:15 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Tue Feb 3 21:23:15 2009 +0000

----------------------------------------------------------------------
 .../apache/commons/collections/MapUtils.java    | 116 +++++++++----------
 1 file changed, 58 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/1bc525db/src/java/org/apache/commons/collections/MapUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/MapUtils.java b/src/java/org/apache/commons/collections/MapUtils.java
index ea017ff..d8ed529 100644
--- a/src/java/org/apache/commons/collections/MapUtils.java
+++ b/src/java/org/apache/commons/collections/MapUtils.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.
@@ -43,7 +43,7 @@ import org.apache.commons.collections.map.TransformedSortedMap;
 import org.apache.commons.collections.map.UnmodifiableMap;
 import org.apache.commons.collections.map.UnmodifiableSortedMap;
 
-/** 
+/**
  * Provides utility methods and decorators for
  * {@link Map} and {@link SortedMap} instances.
  * <p>
@@ -72,7 +72,7 @@ import org.apache.commons.collections.map.UnmodifiableSortedMap;
  *
  * @since Commons Collections 1.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
  * @author <a href="mailto:nissim@nksystems.com">Nissim Karpenstein</a>
  * @author <a href="mailto:knielsen@apache.org">Kasper Nielsen</a>
@@ -87,7 +87,7 @@ import org.apache.commons.collections.map.UnmodifiableSortedMap;
  * @author Neil O'Toole
  */
 public class MapUtils {
-    
+
     /**
      * An empty unmodifiable map.
      * This was not provided in JDK1.2.
@@ -109,7 +109,7 @@ public class MapUtils {
      * <code>MapUtils</code> should not normally be instantiated.
      */
     public MapUtils() {
-    }    
+    }
 
     // Type safe getters
     //-------------------------------------------------------------------------
@@ -382,7 +382,7 @@ public class MapUtils {
      *  @param key  the key of the value to look up in that map
      *  @param defaultValue  what to return if the value is null or if the
      *     conversion fails
-     *  @return  the value in the map as a string, or defaultValue if the 
+     *  @return  the value in the map as a string, or defaultValue if the
      *    original value is null, the map is null or the string conversion
      *    fails
      */
@@ -402,7 +402,7 @@ public class MapUtils {
      *  @param key  the key of the value to look up in that map
      *  @param defaultValue  what to return if the value is null or if the
      *     conversion fails
-     *  @return  the value in the map as a boolean, or defaultValue if the 
+     *  @return  the value in the map as a boolean, or defaultValue if the
      *    original value is null, the map is null or the boolean conversion
      *    fails
      */
@@ -422,7 +422,7 @@ public class MapUtils {
      *  @param key  the key of the value to look up in that map
      *  @param defaultValue  what to return if the value is null or if the
      *     conversion fails
-     *  @return  the value in the map as a number, or defaultValue if the 
+     *  @return  the value in the map as a number, or defaultValue if the
      *    original value is null, the map is null or the number conversion
      *    fails
      */
@@ -442,7 +442,7 @@ public class MapUtils {
      *  @param key  the key of the value to look up in that map
      *  @param defaultValue  what to return if the value is null or if the
      *     conversion fails
-     *  @return  the value in the map as a number, or defaultValue if the 
+     *  @return  the value in the map as a number, or defaultValue if the
      *    original value is null, the map is null or the number conversion
      *    fails
      */
@@ -462,7 +462,7 @@ public class MapUtils {
      *  @param key  the key of the value to look up in that map
      *  @param defaultValue  what to return if the value is null or if the
      *     conversion fails
-     *  @return  the value in the map as a number, or defaultValue if the 
+     *  @return  the value in the map as a number, or defaultValue if the
      *    original value is null, the map is null or the number conversion
      *    fails
      */
@@ -482,7 +482,7 @@ public class MapUtils {
      *  @param key  the key of the value to look up in that map
      *  @param defaultValue  what to return if the value is null or if the
      *     conversion fails
-     *  @return  the value in the map as a number, or defaultValue if the 
+     *  @return  the value in the map as a number, or defaultValue if the
      *    original value is null, the map is null or the number conversion
      *    fails
      */
@@ -502,7 +502,7 @@ public class MapUtils {
      *  @param key  the key of the value to look up in that map
      *  @param defaultValue  what to return if the value is null or if the
      *     conversion fails
-     *  @return  the value in the map as a number, or defaultValue if the 
+     *  @return  the value in the map as a number, or defaultValue if the
      *    original value is null, the map is null or the number conversion
      *    fails
      */
@@ -522,7 +522,7 @@ public class MapUtils {
      *  @param key  the key of the value to look up in that map
      *  @param defaultValue  what to return if the value is null or if the
      *     conversion fails
-     *  @return  the value in the map as a number, or defaultValue if the 
+     *  @return  the value in the map as a number, or defaultValue if the
      *    original value is null, the map is null or the number conversion
      *    fails
      */
@@ -542,7 +542,7 @@ public class MapUtils {
      *  @param key  the key of the value to look up in that map
      *  @param defaultValue  what to return if the value is null or if the
      *     conversion fails
-     *  @return  the value in the map as a number, or defaultValue if the 
+     *  @return  the value in the map as a number, or defaultValue if the
      *    original value is null, the map is null or the number conversion
      *    fails
      */
@@ -562,7 +562,7 @@ public class MapUtils {
      *  @param key  the key of the value to look up in that map
      *  @param defaultValue  what to return if the value is null or if the
      *     conversion fails
-     *  @return  the value in the map as a number, or defaultValue if the 
+     *  @return  the value in the map as a number, or defaultValue if the
      *    original value is null, the map is null or the map conversion
      *    fails
      */
@@ -725,7 +725,7 @@ public class MapUtils {
 
     /**
      * Gets a byte from a Map in a null-safe manner,
-     * using the default value if the the conversion fails.     
+     * using the default value if the the conversion fails.
      * <p>
      * The byte is obtained from the results of {@link #getNumber(Map,Object)}.
      *
@@ -745,7 +745,7 @@ public class MapUtils {
 
     /**
      * Gets a short from a Map in a null-safe manner,
-     * using the default value if the the conversion fails.     
+     * using the default value if the the conversion fails.
      * <p>
      * The short is obtained from the results of {@link #getNumber(Map,Object)}.
      *
@@ -765,7 +765,7 @@ public class MapUtils {
 
     /**
      * Gets an int from a Map in a null-safe manner,
-     * using the default value if the the conversion fails.     
+     * using the default value if the the conversion fails.
      * <p>
      * The int is obtained from the results of {@link #getNumber(Map,Object)}.
      *
@@ -785,7 +785,7 @@ public class MapUtils {
 
     /**
      * Gets a long from a Map in a null-safe manner,
-     * using the default value if the the conversion fails.     
+     * using the default value if the the conversion fails.
      * <p>
      * The long is obtained from the results of {@link #getNumber(Map,Object)}.
      *
@@ -805,7 +805,7 @@ public class MapUtils {
 
     /**
      * Gets a float from a Map in a null-safe manner,
-     * using the default value if the the conversion fails.     
+     * using the default value if the the conversion fails.
      * <p>
      * The float is obtained from the results of {@link #getNumber(Map,Object)}.
      *
@@ -825,7 +825,7 @@ public class MapUtils {
 
     /**
      * Gets a double from a Map in a null-safe manner,
-     * using the default value if the the conversion fails.     
+     * using the default value if the the conversion fails.
      * <p>
      * The double is obtained from the results of {@link #getNumber(Map,Object)}.
      *
@@ -848,7 +848,7 @@ public class MapUtils {
     /**
      * Gets a new Properties object initialised with the values from a Map.
      * A null input will return an empty properties object.
-     * 
+     *
      * @param map  the map to convert to a Properties object, may not be null
      * @return the properties object
      */
@@ -867,7 +867,7 @@ public class MapUtils {
 
     /**
      * Creates a new HashMap using data copied from a ResourceBundle.
-     * 
+     *
      * @param resourceBundle  the resource bundle to convert, may not be null
      * @return the hashmap containing the data
      * @throws NullPointerException if the bundle is null
@@ -884,7 +884,7 @@ public class MapUtils {
 
         return map;
     }
- 
+
     // Printing methods
     //-------------------------------------------------------------------------
     /**
@@ -953,15 +953,15 @@ public class MapUtils {
     }
 
     /**
-     * Implementation providing functionality for {@link #debugPrint} and for 
+     * Implementation providing functionality for {@link #debugPrint} and for
      * {@link #verbosePrint}.  This prints the given map with nice line breaks.
-     * If the debug flag is true, it additionally prints the type of the object 
-     * value.  If the contents of a map include the map itself, then the text 
-     * <em>(this Map)</em> is printed out.  If the contents include a 
-     * parent container of the map, the the text <em>(ancestor[i] Map)</em> is 
-     * printed, where i actually indicates the number of levels which must be 
-     * traversed in the sequential list of ancestors (e.g. father, grandfather, 
-     * great-grandfather, etc).  
+     * If the debug flag is true, it additionally prints the type of the object
+     * value.  If the contents of a map include the map itself, then the text
+     * <em>(this Map)</em> is printed out.  If the contents include a
+     * parent container of the map, the the text <em>(ancestor[i] Map)</em> is
+     * printed, where i actually indicates the number of levels which must be
+     * traversed in the sequential list of ancestors (e.g. father, grandfather,
+     * great-grandfather, etc).
      *
      * @param out  the stream to print to
      * @param label  the label to be used, may be <code>null</code>.
@@ -969,7 +969,7 @@ public class MapUtils {
      *  It typically represents the name of the property in a bean or similar.
      * @param map  the map to print, may be <code>null</code>.
      *  If <code>null</code>, the text 'null' is output
-     * @param lineage  a stack consisting of any maps in which the previous 
+     * @param lineage  a stack consisting of any maps in which the previous
      *  argument is contained. This is checked to avoid infinite recursion when
      *  printing the output
      * @param debug  flag indicating whether type names should be output.
@@ -981,7 +981,7 @@ public class MapUtils {
         final Map<?, ?> map,
         final ArrayStack<Map<?, ?>> lineage,
         final boolean debug) {
-        
+
         printIndent(out, lineage.size());
 
         if (map == null) {
@@ -1016,12 +1016,12 @@ public class MapUtils {
                 printIndent(out, lineage.size());
                 out.print(childKey);
                 out.print(" = ");
-                
+
                 final int lineageIndex = lineage.indexOf(childValue);
                 if (lineageIndex == -1) {
                     out.print(childValue);
                 } else if (lineage.size() - 1 == lineageIndex) {
-                    out.print("(this Map)");    
+                    out.print("(this Map)");
                 } else {
                     out.print(
                         "(ancestor["
@@ -1063,7 +1063,7 @@ public class MapUtils {
      * <p>
      * This operation assumes that the inverse mapping is well defined.
      * If the input map had multiple entries with the same value mapped to
-     * different keys, the returned map will map one of those keys to the 
+     * different keys, the returned map will map one of those keys to the
      * value, but the exact key which will be mapped is undefined.
      *
      * @param map  the map to invert, may not be null
@@ -1093,7 +1093,7 @@ public class MapUtils {
      * Keys are not validated.
      * Note that this method can be used to circumvent the map's
      * value type at runtime.
-     * 
+     *
      * @param map  the map to add to, may not be null
      * @param key  the key
      * @param value  the value, null converted to ""
@@ -1189,7 +1189,7 @@ public class MapUtils {
      * Null-safe check if the specified map is empty.
      * <p>
      * Null returns true.
-     * 
+     *
      * @param map  the map to check, may be null
      * @return true if empty or null
      * @since Commons Collections 3.2
@@ -1203,7 +1203,7 @@ public class MapUtils {
      * Null-safe check if the specified map is not empty.
      * <p>
      * Null returns false.
-     * 
+     *
      * @param map  the map to check, may be null
      * @return true if non-null and non-empty
      * @since Commons Collections 3.2
@@ -1218,9 +1218,9 @@ public class MapUtils {
     /**
      * Returns a synchronized map backed by the given map.
      * <p>
-     * You must manually synchronize on the returned buffer's iterator to 
+     * You must manually synchronize on the returned buffer's iterator to
      * avoid non-deterministic behavior:
-     *  
+     *
      * <pre>
      * Map m = MapUtils.synchronizedMap(myMap);
      * Set s = m.keySet();  // outside synchronized block
@@ -1231,9 +1231,9 @@ public class MapUtils {
      *     }
      * }
      * </pre>
-     * 
+     *
      * This method uses the implementation in {@link java.util.Collections Collections}.
-     * 
+     *
      * @param map  the map to synchronize, must not be null
      * @return a synchronized map backed by the given map
      * @throws IllegalArgumentException  if the map is null
@@ -1283,7 +1283,7 @@ public class MapUtils {
      * If you want that behaviour, see {@link TransformedMap#decorateTransform}.
      * <p>
      * Each object is passed through the transformers as it is added to the
-     * Map. It is important not to use the original map after invoking this 
+     * Map. It is important not to use the original map after invoking this
      * method, as it is a backdoor for adding untransformed objects.
      * <p>
      * If there are any elements already in the map being decorated, they
@@ -1300,11 +1300,11 @@ public class MapUtils {
             Transformer<? super V, ? extends V> valueTransformer) {
         return TransformedMap.decorate(map, keyTransformer, valueTransformer);
     }
-    
+
     /**
      * Returns a fixed-sized map backed by the given map.
-     * Elements may not be added or removed from the returned map, but 
-     * existing elements can be changed (for instance, via the 
+     * Elements may not be added or removed from the returned map, but
+     * existing elements can be changed (for instance, via the
      * {@link Map#put(Object,Object)} method).
      *
      * @param map  the map whose size to fix, must not be null
@@ -1449,9 +1449,9 @@ public class MapUtils {
     /**
      * Returns a synchronized sorted map backed by the given sorted map.
      * <p>
-     * You must manually synchronize on the returned buffer's iterator to 
+     * You must manually synchronize on the returned buffer's iterator to
      * avoid non-deterministic behavior:
-     *  
+     *
      * <pre>
      * Map m = MapUtils.synchronizedSortedMap(myMap);
      * Set s = m.keySet();  // outside synchronized block
@@ -1462,9 +1462,9 @@ public class MapUtils {
      *     }
      * }
      * </pre>
-     * 
+     *
      * This method uses the implementation in {@link java.util.Collections Collections}.
-     * 
+     *
      * @param map  the map to synchronize, must not be null
      * @return a synchronized map backed by the given map
      * @throws IllegalArgumentException  if the map is null
@@ -1515,7 +1515,7 @@ public class MapUtils {
      * If you want that behaviour, see {@link TransformedSortedMap#decorateTransform}.
      * <p>
      * Each object is passed through the transformers as it is added to the
-     * Map. It is important not to use the original map after invoking this 
+     * Map. It is important not to use the original map after invoking this
      * method, as it is a backdoor for adding untransformed objects.
      * <p>
      * If there are any elements already in the map being decorated, they
@@ -1532,11 +1532,11 @@ public class MapUtils {
             Transformer<? super V, ? extends V> valueTransformer) {
         return TransformedSortedMap.decorate(map, keyTransformer, valueTransformer);
     }
-    
+
     /**
      * Returns a fixed-sized sorted map backed by the given sorted map.
-     * Elements may not be added or removed from the returned map, but 
-     * existing elements can be changed (for instance, via the 
+     * Elements may not be added or removed from the returned map, but
+     * existing elements can be changed (for instance, via the
      * {@link Map#put(Object,Object)} method).
      *
      * @param map  the map whose size to fix, must not be null
@@ -1580,7 +1580,7 @@ public class MapUtils {
             Factory<? extends V> factory) {
         return LazySortedMap.getLazySortedMap(map, factory);
     }
-    
+
     /**
      * Returns a "lazy" sorted map whose values will be created on demand.
      * <p>


[61/77] [abbrv] commons-collections git commit: javadoc

Posted by ch...@apache.org.
javadoc

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@813924 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/df940e08
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/df940e08
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/df940e08

Branch: refs/heads/collections_jdk5_branch
Commit: df940e08fb179603eec565bc12a3c22d48bac23d
Parents: a68a932
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Fri Sep 11 17:03:40 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Fri Sep 11 17:03:40 2009 +0000

----------------------------------------------------------------------
 .../apache/commons/collections/IndexedCollection.java  | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/df940e08/src/java/org/apache/commons/collections/IndexedCollection.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/IndexedCollection.java b/src/java/org/apache/commons/collections/IndexedCollection.java
index 92d8bd7..0b8b2f7 100644
--- a/src/java/org/apache/commons/collections/IndexedCollection.java
+++ b/src/java/org/apache/commons/collections/IndexedCollection.java
@@ -16,7 +16,7 @@ import org.apache.commons.collections.collection.AbstractCollectionDecorator;
  * If modification to the decorated {@link Collection} is unavoidable, then a
  * call to {@link #reindex()} will update the index to the current contents of
  * the {@link Collection}.
- * 
+ *
  * @param K the type of object in the index.
  * @param C the type of object in the collection.
  * @author Stephen Kestle
@@ -31,7 +31,7 @@ public class IndexedCollection<K, C> extends AbstractCollectionDecorator<C> {
 
     /**
      * Create an {@link IndexedCollection} for a unique index.
-     * 
+     *
      * @param <K> the index object type.
      * @param <C> the collection type.
      * @param coll the decorated {@link Collection}.
@@ -54,7 +54,7 @@ public class IndexedCollection<K, C> extends AbstractCollectionDecorator<C> {
 
     /**
      * Create a {@link IndexedCollection} for a unique index.
-     * 
+     *
      * @param coll the decorated {@link Collection}.
      * @param keyTransformer the {@link Transformer} for generating index keys.
      * @return the created {@link IndexedCollection}.
@@ -100,7 +100,7 @@ public class IndexedCollection<K, C> extends AbstractCollectionDecorator<C> {
 
     /**
      * Provides checking for adding the index.
-     * 
+     *
      * @param object the object to index.
      */
     private void addIndex(C object) {
@@ -110,6 +110,11 @@ public class IndexedCollection<K, C> extends AbstractCollectionDecorator<C> {
         }
     }
 
+    /**
+     * Get the element associated with the given key.
+     * @param key to look up
+     * @return element found
+     */
     public C get(K key) {
         return index.get(key);
     }


[39/77] [abbrv] commons-collections git commit: since I changed the test hierarchy, AbstractTestMap shouldn't force IterableMap

Posted by ch...@apache.org.
since I changed the test hierarchy, AbstractTestMap shouldn't force IterableMap

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@740153 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/800616b2
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/800616b2
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/800616b2

Branch: refs/heads/collections_jdk5_branch
Commit: 800616b2441505b7092ce331cc9014f5be030943
Parents: 0495621
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Mon Feb 2 23:41:20 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Mon Feb 2 23:41:20 2009 +0000

----------------------------------------------------------------------
 .../org/apache/commons/collections/map/AbstractTestMap.java | 9 ---------
 1 file changed, 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/800616b2/src/test/org/apache/commons/collections/map/AbstractTestMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/AbstractTestMap.java b/src/test/org/apache/commons/collections/map/AbstractTestMap.java
index 514f1cd..d61eafc 100644
--- a/src/test/org/apache/commons/collections/map/AbstractTestMap.java
+++ b/src/test/org/apache/commons/collections/map/AbstractTestMap.java
@@ -28,7 +28,6 @@ import java.util.Map.Entry;
 
 import org.apache.commons.collections.AbstractTestObject;
 import org.apache.commons.collections.BulkTest;
-import org.apache.commons.collections.IterableMap;
 import org.apache.commons.collections.collection.AbstractTestCollection;
 import org.apache.commons.collections.set.AbstractTestSet;
 
@@ -1715,14 +1714,6 @@ public abstract class AbstractTestMap<K, V> extends AbstractTestObject {
     }
 
     /**
-     * All [collections] Map implementations should implement IterableMap.
-     */
-    public void testSubsetInterfaces() {
-        resetEmpty();
-        assertTrue(getMap() instanceof IterableMap);
-    }
-
-    /**
      * Erases any leftover instance variables by setting them to null.
      */
     public void tearDown() throws Exception {


[70/77] [abbrv] commons-collections git commit: Replacing '^ \* $' with '^ \*$' - to help with merging to trunk

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java b/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java
index 0006d18..e1f31e1 100644
--- a/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java
+++ b/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.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.
@@ -32,7 +32,7 @@ import org.apache.commons.collections.BulkTest;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Dieter Wimberger
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/set/TestAll.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/TestAll.java b/src/test/org/apache/commons/collections/set/TestAll.java
index 2a56131..5bffaa6 100644
--- a/src/test/org/apache/commons/collections/set/TestAll.java
+++ b/src/test/org/apache/commons/collections/set/TestAll.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.
@@ -22,10 +22,10 @@ import junit.framework.TestSuite;
 
 /**
  * Entry point for tests.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TestAll extends TestCase {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/set/TestMapBackedSet.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/TestMapBackedSet.java b/src/test/org/apache/commons/collections/set/TestMapBackedSet.java
index 8113f40..91b1890 100644
--- a/src/test/org/apache/commons/collections/set/TestMapBackedSet.java
+++ b/src/test/org/apache/commons/collections/set/TestMapBackedSet.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.
@@ -28,7 +28,7 @@ import org.apache.commons.collections.map.HashedMap;
  *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TestMapBackedSet<E> extends AbstractTestSet<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java b/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java
index 9bf1e0d..dd31f5a 100644
--- a/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java
+++ b/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.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.


[72/77] [abbrv] commons-collections git commit: Replacing '^ \* $' with '^ \*$' - to help with merging to trunk

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/EnumerationIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/EnumerationIterator.java b/src/java/org/apache/commons/collections/iterators/EnumerationIterator.java
index 4fef2ae..f8ca1dd 100644
--- a/src/java/org/apache/commons/collections/iterators/EnumerationIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/EnumerationIterator.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.
@@ -26,7 +26,7 @@ import java.util.Iterator;
  *
  * @since Commons Collections 1.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
  * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/FilterIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/FilterIterator.java b/src/java/org/apache/commons/collections/iterators/FilterIterator.java
index 6d8c8ca..22de8e3 100644
--- a/src/java/org/apache/commons/collections/iterators/FilterIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/FilterIterator.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,7 +29,7 @@ import org.apache.commons.collections.Predicate;
  *
  * @since Commons Collections 1.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author James Strachan
  * @author Jan Sorensen
  * @author Ralph Wagner

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/FilterListIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/FilterListIterator.java b/src/java/org/apache/commons/collections/iterators/FilterListIterator.java
index 36321fa..7e9b4bf 100644
--- a/src/java/org/apache/commons/collections/iterators/FilterListIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/FilterListIterator.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,7 +29,7 @@ import org.apache.commons.collections.Predicate;
  *
  * @since Commons Collections 2.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Rodney Waldhoff
  */
 public class FilterListIterator<E> implements ListIterator<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/IteratorChain.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/IteratorChain.java b/src/java/org/apache/commons/collections/iterators/IteratorChain.java
index eaca82a..8d33c10 100644
--- a/src/java/org/apache/commons/collections/iterators/IteratorChain.java
+++ b/src/java/org/apache/commons/collections/iterators/IteratorChain.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.
@@ -42,11 +42,11 @@ import org.apache.commons.collections.list.UnmodifiableList;
  * <p>
  * NOTE: As from version 3.0, the IteratorChain may contain no iterators. In
  * this case the class will function as an empty iterator.
- * 
+ *
  * @since Commons Collections 2.1
  * @version $Revision$ $Date: 2006-10-27 19:52:37 -0500 (Fri, 27 Oct
  * 2006) $
- * 
+ *
  * @author Morgan Delagrange
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/IteratorEnumeration.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/IteratorEnumeration.java b/src/java/org/apache/commons/collections/iterators/IteratorEnumeration.java
index 499d994..8eab99c 100644
--- a/src/java/org/apache/commons/collections/iterators/IteratorEnumeration.java
+++ b/src/java/org/apache/commons/collections/iterators/IteratorEnumeration.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.
@@ -22,11 +22,11 @@ import java.util.Iterator;
 /**
  * Adapter to make an {@link Iterator Iterator} instance appear to be an
  * {@link Enumeration Enumeration} instance.
- * 
+ *
  * @since Commons Collections 1.0
  * @version $Revision$ $Date: 2006-10-27 19:52:37 -0500 (Fri, 27 Oct
  * 2006) $
- * 
+ *
  * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
  */
 public class IteratorEnumeration<E> implements Enumeration<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java b/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java
index 6a9e5bf..baf1085 100644
--- a/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java
+++ b/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/LoopingIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/LoopingIterator.java b/src/java/org/apache/commons/collections/iterators/LoopingIterator.java
index 8a23122..05721fc 100644
--- a/src/java/org/apache/commons/collections/iterators/LoopingIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/LoopingIterator.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/LoopingListIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/LoopingListIterator.java b/src/java/org/apache/commons/collections/iterators/LoopingListIterator.java
index a951c61..80dc4b0 100644
--- a/src/java/org/apache/commons/collections/iterators/LoopingListIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/LoopingListIterator.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/ObjectArrayIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/ObjectArrayIterator.java b/src/java/org/apache/commons/collections/iterators/ObjectArrayIterator.java
index 378e772..344311c 100644
--- a/src/java/org/apache/commons/collections/iterators/ObjectArrayIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/ObjectArrayIterator.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.
@@ -32,7 +32,7 @@ import org.apache.commons.collections.ResettableIterator;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author James Strachan
  * @author Mauricio S. Moura
  * @author Michael A. Smith

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java b/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java
index fffb599..1c8fe39 100644
--- a/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.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.
@@ -36,7 +36,7 @@ import org.apache.commons.collections.ResettableListIterator;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Neil O'Toole
  * @author Stephen Colebourne
  * @author Phil Steitz

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/ObjectGraphIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/ObjectGraphIterator.java b/src/java/org/apache/commons/collections/iterators/ObjectGraphIterator.java
index 3926f11..c275cf1 100644
--- a/src/java/org/apache/commons/collections/iterators/ObjectGraphIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/ObjectGraphIterator.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.
@@ -69,10 +69,10 @@ import org.apache.commons.collections.Transformer;
  * <p>
  * Under many circumstances, linking Iterators together in this manner is
  * more efficient (and convenient) than using nested for loops to extract a list.
- * 
+ *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class ObjectGraphIterator<E> implements Iterator<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/ReverseListIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/ReverseListIterator.java b/src/java/org/apache/commons/collections/iterators/ReverseListIterator.java
index 6552676..e3e0977 100644
--- a/src/java/org/apache/commons/collections/iterators/ReverseListIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/ReverseListIterator.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/SingletonIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/SingletonIterator.java b/src/java/org/apache/commons/collections/iterators/SingletonIterator.java
index e6145f2..cb565fe 100644
--- a/src/java/org/apache/commons/collections/iterators/SingletonIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/SingletonIterator.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.
@@ -27,7 +27,7 @@ import org.apache.commons.collections.ResettableIterator;
  *
  * @since Commons Collections 2.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author James Strachan
  * @author Stephen Colebourne
  * @author Rodney Waldhoff

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/SingletonListIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/SingletonListIterator.java b/src/java/org/apache/commons/collections/iterators/SingletonListIterator.java
index 73fc9fd..0600783 100644
--- a/src/java/org/apache/commons/collections/iterators/SingletonListIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/SingletonListIterator.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.
@@ -27,7 +27,7 @@ import org.apache.commons.collections.ResettableListIterator;
  *
  * @since Commons Collections 2.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Rodney Waldhoff
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/TransformIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/TransformIterator.java b/src/java/org/apache/commons/collections/iterators/TransformIterator.java
index 1546719..9f79a2b 100644
--- a/src/java/org/apache/commons/collections/iterators/TransformIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/TransformIterator.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.
@@ -25,7 +25,7 @@ import org.apache.commons.collections.Transformer;
  *
  * @since Commons Collections 1.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author James Strachan
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/UnmodifiableIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/UnmodifiableIterator.java b/src/java/org/apache/commons/collections/iterators/UnmodifiableIterator.java
index 3cff73c..0427afa 100644
--- a/src/java/org/apache/commons/collections/iterators/UnmodifiableIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/UnmodifiableIterator.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.
@@ -25,7 +25,7 @@ import org.apache.commons.collections.Unmodifiable;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public final class UnmodifiableIterator<E> implements Iterator<E>, Unmodifiable {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/UnmodifiableListIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/UnmodifiableListIterator.java b/src/java/org/apache/commons/collections/iterators/UnmodifiableListIterator.java
index a2bafe1..a940ae6 100644
--- a/src/java/org/apache/commons/collections/iterators/UnmodifiableListIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/UnmodifiableListIterator.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.
@@ -25,7 +25,7 @@ import org.apache.commons.collections.Unmodifiable;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public final class UnmodifiableListIterator<E> implements ListIterator<E>, Unmodifiable {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/iterators/UnmodifiableMapIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/UnmodifiableMapIterator.java b/src/java/org/apache/commons/collections/iterators/UnmodifiableMapIterator.java
index 9c1905f..7e7506b 100644
--- a/src/java/org/apache/commons/collections/iterators/UnmodifiableMapIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/UnmodifiableMapIterator.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,7 +24,7 @@ import org.apache.commons.collections.Unmodifiable;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public final class UnmodifiableMapIterator<K, V> implements MapIterator<K, V>, Unmodifiable {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/keyvalue/AbstractKeyValue.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/keyvalue/AbstractKeyValue.java b/src/java/org/apache/commons/collections/keyvalue/AbstractKeyValue.java
index 61f46db..7aa2185 100644
--- a/src/java/org/apache/commons/collections/keyvalue/AbstractKeyValue.java
+++ b/src/java/org/apache/commons/collections/keyvalue/AbstractKeyValue.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,7 +24,7 @@ import org.apache.commons.collections.KeyValue;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author James Strachan
  * @author Michael A. Smith
  * @author Neil O'Toole

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntry.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntry.java b/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntry.java
index 16967aa..2f7c9ee 100644
--- a/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntry.java
+++ b/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntry.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,7 +24,7 @@ import java.util.Map;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author James Strachan
  * @author Michael A. Smith
  * @author Neil O'Toole

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntryDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntryDecorator.java b/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntryDecorator.java
index 0acd80e..6639ff9 100644
--- a/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntryDecorator.java
+++ b/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntryDecorator.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.
@@ -26,7 +26,7 @@ import org.apache.commons.collections.KeyValue;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public abstract class AbstractMapEntryDecorator<K, V> implements Map.Entry<K, V>, KeyValue<K, V> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/keyvalue/DefaultKeyValue.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/keyvalue/DefaultKeyValue.java b/src/java/org/apache/commons/collections/keyvalue/DefaultKeyValue.java
index e38df5d..f4514e7 100644
--- a/src/java/org/apache/commons/collections/keyvalue/DefaultKeyValue.java
+++ b/src/java/org/apache/commons/collections/keyvalue/DefaultKeyValue.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,7 +29,7 @@ import org.apache.commons.collections.KeyValue;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author James Strachan
  * @author Michael A. Smith
  * @author Neil O'Toole

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/keyvalue/DefaultMapEntry.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/keyvalue/DefaultMapEntry.java b/src/java/org/apache/commons/collections/keyvalue/DefaultMapEntry.java
index 8731b66..276be1d 100644
--- a/src/java/org/apache/commons/collections/keyvalue/DefaultMapEntry.java
+++ b/src/java/org/apache/commons/collections/keyvalue/DefaultMapEntry.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.
@@ -26,7 +26,7 @@ import org.apache.commons.collections.KeyValue;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author James Strachan
  * @author Michael A. Smith
  * @author Neil O'Toole

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/keyvalue/MultiKey.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/keyvalue/MultiKey.java b/src/java/org/apache/commons/collections/keyvalue/MultiKey.java
index c91047e..262854a 100644
--- a/src/java/org/apache/commons/collections/keyvalue/MultiKey.java
+++ b/src/java/org/apache/commons/collections/keyvalue/MultiKey.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.
@@ -38,10 +38,10 @@ import java.util.Arrays;
  * MultiKey multiKey = new MultiKey(key, locale);
  * String localizedText = (String) map.get(multiKey);
  * </pre>
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Howard Lewis Ship
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/keyvalue/TiedMapEntry.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/keyvalue/TiedMapEntry.java b/src/java/org/apache/commons/collections/keyvalue/TiedMapEntry.java
index 46d2083..51340e3 100644
--- a/src/java/org/apache/commons/collections/keyvalue/TiedMapEntry.java
+++ b/src/java/org/apache/commons/collections/keyvalue/TiedMapEntry.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,7 +29,7 @@ import org.apache.commons.collections.KeyValue;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TiedMapEntry<K, V> implements Map.Entry<K, V>, KeyValue<K, V>, Serializable {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/keyvalue/UnmodifiableMapEntry.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/keyvalue/UnmodifiableMapEntry.java b/src/java/org/apache/commons/collections/keyvalue/UnmodifiableMapEntry.java
index c316bbc..a6a75cd 100644
--- a/src/java/org/apache/commons/collections/keyvalue/UnmodifiableMapEntry.java
+++ b/src/java/org/apache/commons/collections/keyvalue/UnmodifiableMapEntry.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.
@@ -27,7 +27,7 @@ import org.apache.commons.collections.Unmodifiable;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public final class UnmodifiableMapEntry<K, V> extends AbstractMapEntry<K, V> implements Unmodifiable {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/list/AbstractListDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/AbstractListDecorator.java b/src/java/org/apache/commons/collections/list/AbstractListDecorator.java
index c8550d2..e56d0cd 100644
--- a/src/java/org/apache/commons/collections/list/AbstractListDecorator.java
+++ b/src/java/org/apache/commons/collections/list/AbstractListDecorator.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,7 +30,7 @@ import org.apache.commons.collections.collection.AbstractCollectionDecorator;
  * @param <E> the type of the elements in the list
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public abstract class AbstractListDecorator<E> extends AbstractCollectionDecorator<E> implements

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/list/AbstractSerializableListDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/AbstractSerializableListDecorator.java b/src/java/org/apache/commons/collections/list/AbstractSerializableListDecorator.java
index eac1c3a..93f69c0 100644
--- a/src/java/org/apache/commons/collections/list/AbstractSerializableListDecorator.java
+++ b/src/java/org/apache/commons/collections/list/AbstractSerializableListDecorator.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.
@@ -25,7 +25,7 @@ import java.util.List;
 
 /**
  * Serializable subclass of AbstractListDecorator.
- * 
+ *
  * @author Stephen Colebourne
  * @since Commons Collections 3.1
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/list/CursorableLinkedList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/CursorableLinkedList.java b/src/java/org/apache/commons/collections/list/CursorableLinkedList.java
index 022eaaa..6b1d46c 100644
--- a/src/java/org/apache/commons/collections/list/CursorableLinkedList.java
+++ b/src/java/org/apache/commons/collections/list/CursorableLinkedList.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.
@@ -54,7 +54,7 @@ import java.util.ListIterator;
  * @see java.util.LinkedList
  * @since Commons Collections 1.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Rodney Waldhoff
  * @author Janek Bogucki
  * @author Simon Kitching

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/list/FixedSizeList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/FixedSizeList.java b/src/java/org/apache/commons/collections/list/FixedSizeList.java
index 65e0955..fdc45ef 100644
--- a/src/java/org/apache/commons/collections/list/FixedSizeList.java
+++ b/src/java/org/apache/commons/collections/list/FixedSizeList.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.
@@ -35,7 +35,7 @@ import org.apache.commons.collections.iterators.UnmodifiableIterator;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Paul Jack
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/list/GrowthList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/GrowthList.java b/src/java/org/apache/commons/collections/list/GrowthList.java
index bdf7c21..dbcc394 100644
--- a/src/java/org/apache/commons/collections/list/GrowthList.java
+++ b/src/java/org/apache/commons/collections/list/GrowthList.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/list/LazyList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/LazyList.java b/src/java/org/apache/commons/collections/list/LazyList.java
index f1b11c3..9c66284 100644
--- a/src/java/org/apache/commons/collections/list/LazyList.java
+++ b/src/java/org/apache/commons/collections/list/LazyList.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.
@@ -56,7 +56,7 @@ import org.apache.commons.collections.Factory;
  * @see GrowthList
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Arron Bates
  * @author Paul Jack

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/list/NodeCachingLinkedList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/NodeCachingLinkedList.java b/src/java/org/apache/commons/collections/list/NodeCachingLinkedList.java
index 0b5a13f..299cb3b 100644
--- a/src/java/org/apache/commons/collections/list/NodeCachingLinkedList.java
+++ b/src/java/org/apache/commons/collections/list/NodeCachingLinkedList.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.
@@ -35,10 +35,10 @@ import java.util.Collection;
  * using this class.
  * <p>
  * <b>Note that this implementation is not synchronized.</b>
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Jeff Varszegi
  * @author Rich Dougherty
  * @author Phil Steitz

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/list/PredicatedList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/PredicatedList.java b/src/java/org/apache/commons/collections/list/PredicatedList.java
index 68cebda..a84b6ce 100644
--- a/src/java/org/apache/commons/collections/list/PredicatedList.java
+++ b/src/java/org/apache/commons/collections/list/PredicatedList.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.
@@ -39,7 +39,7 @@ import java.util.ListIterator;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Paul Jack
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/list/SynchronizedList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/SynchronizedList.java b/src/java/org/apache/commons/collections/list/SynchronizedList.java
index a01e656..3a234e0 100644
--- a/src/java/org/apache/commons/collections/list/SynchronizedList.java
+++ b/src/java/org/apache/commons/collections/list/SynchronizedList.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.
@@ -32,7 +32,7 @@ import org.apache.commons.collections.collection.SynchronizedCollection;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class SynchronizedList<E> extends SynchronizedCollection<E> implements List<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/list/TransformedList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/TransformedList.java b/src/java/org/apache/commons/collections/list/TransformedList.java
index 4ca6cf2..f84e062 100644
--- a/src/java/org/apache/commons/collections/list/TransformedList.java
+++ b/src/java/org/apache/commons/collections/list/TransformedList.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.
@@ -36,7 +36,7 @@ import org.apache.commons.collections.iterators.AbstractListIteratorDecorator;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TransformedList<E> extends TransformedCollection<E> implements List<E> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/list/UnmodifiableList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/UnmodifiableList.java b/src/java/org/apache/commons/collections/list/UnmodifiableList.java
index f11b700..44cf2cc 100644
--- a/src/java/org/apache/commons/collections/list/UnmodifiableList.java
+++ b/src/java/org/apache/commons/collections/list/UnmodifiableList.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.
@@ -32,7 +32,7 @@ import org.apache.commons.collections.iterators.UnmodifiableListIterator;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public final class UnmodifiableList<E>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/AbstractInputCheckedMapDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/AbstractInputCheckedMapDecorator.java b/src/java/org/apache/commons/collections/map/AbstractInputCheckedMapDecorator.java
index e8be0cd..4d62588 100644
--- a/src/java/org/apache/commons/collections/map/AbstractInputCheckedMapDecorator.java
+++ b/src/java/org/apache/commons/collections/map/AbstractInputCheckedMapDecorator.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.
@@ -41,7 +41,7 @@ import org.apache.commons.collections.set.AbstractSetDecorator;
  *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 abstract class AbstractInputCheckedMapDecorator<K, V>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/AbstractIterableMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/AbstractIterableMap.java b/src/java/org/apache/commons/collections/map/AbstractIterableMap.java
index 2f812cb..199f7f4 100644
--- a/src/java/org/apache/commons/collections/map/AbstractIterableMap.java
+++ b/src/java/org/apache/commons/collections/map/AbstractIterableMap.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,7 +24,7 @@ import org.apache.commons.collections.MapIterator;
  * @since Commons Collections 5
  * @TODO fix version
  * @version $Revision$ $Date$
- * 
+ *
  * @author Matt Benson
  */
 public abstract class AbstractIterableMap<K, V> implements IterableMap<K, V> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java b/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java
index 9086918..6af2712 100644
--- a/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java
+++ b/src/java/org/apache/commons/collections/map/AbstractLinkedMap.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.
@@ -55,7 +55,7 @@ import org.apache.commons.collections.iterators.EmptyOrderedMapIterator;
  * <p>
  * The implementation is also designed to be subclassed, with lots of useful
  * methods exposed.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/AbstractMapDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/AbstractMapDecorator.java b/src/java/org/apache/commons/collections/map/AbstractMapDecorator.java
index 9394775..9dc35cb 100644
--- a/src/java/org/apache/commons/collections/map/AbstractMapDecorator.java
+++ b/src/java/org/apache/commons/collections/map/AbstractMapDecorator.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.
@@ -37,7 +37,7 @@ import java.util.Set;
  * @param <V> the type of the values in the map
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Daniel Rall
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java b/src/java/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java
index 4998a03..2f1ebd8 100644
--- a/src/java/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java
+++ b/src/java/org/apache/commons/collections/map/AbstractOrderedMapDecorator.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.OrderedMapIterator;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public abstract class AbstractOrderedMapDecorator<K, V> extends AbstractMapDecorator<K, V>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java b/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java
index d47411b..4d62626 100644
--- a/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.java
+++ b/src/java/org/apache/commons/collections/map/AbstractSortedMapDecorator.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.
@@ -43,7 +43,7 @@ import org.apache.commons.collections.iterators.ListIteratorWrapper;
  * @param <V> the type of the values in the map
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public abstract class AbstractSortedMapDecorator<K, V> extends AbstractMapDecorator<K, V> implements

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java b/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java
index 05f4206..5932d57 100644
--- a/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java
+++ b/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/DefaultedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/DefaultedMap.java b/src/java/org/apache/commons/collections/map/DefaultedMap.java
index 010de2f..cac72f2 100644
--- a/src/java/org/apache/commons/collections/map/DefaultedMap.java
+++ b/src/java/org/apache/commons/collections/map/DefaultedMap.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.
@@ -59,7 +59,7 @@ import org.apache.commons.collections.functors.FactoryTransformer;
  *
  * @since Commons Collections 3.2
  * @version $Revision: 1.7 $ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Rafael U.C. Afonso
  * @see LazyMap

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.java b/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.java
index e69ca9d..d3ac26d 100644
--- a/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.java
+++ b/src/java/org/apache/commons/collections/map/EntrySetToMapIteratorAdapter.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.
@@ -25,11 +25,11 @@ import org.apache.commons.collections.ResettableIterator;
 
 /**
  * Adapts a Map entrySet to the MapIterator interface.
- * 
+ *
  * @since Commons Collections 5
  * @TODO fix version
  * @version $Revision$ $Date$
- * 
+ *
  * @author Matt Benson
  */
 public class EntrySetToMapIteratorAdapter<K, V> implements MapIterator<K, V>, ResettableIterator<K> {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/FixedSizeMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/FixedSizeMap.java b/src/java/org/apache/commons/collections/map/FixedSizeMap.java
index b293508..55ff9a3 100644
--- a/src/java/org/apache/commons/collections/map/FixedSizeMap.java
+++ b/src/java/org/apache/commons/collections/map/FixedSizeMap.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.
@@ -52,7 +52,7 @@ import org.apache.commons.collections.set.UnmodifiableSet;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Paul Jack
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/FixedSizeSortedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/FixedSizeSortedMap.java b/src/java/org/apache/commons/collections/map/FixedSizeSortedMap.java
index eb50fb7..17abe58 100644
--- a/src/java/org/apache/commons/collections/map/FixedSizeSortedMap.java
+++ b/src/java/org/apache/commons/collections/map/FixedSizeSortedMap.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.
@@ -53,7 +53,7 @@ import org.apache.commons.collections.set.UnmodifiableSet;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Paul Jack
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/LazyMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/LazyMap.java b/src/java/org/apache/commons/collections/map/LazyMap.java
index d84ff71..064a837 100644
--- a/src/java/org/apache/commons/collections/map/LazyMap.java
+++ b/src/java/org/apache/commons/collections/map/LazyMap.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.
@@ -58,7 +58,7 @@ import org.apache.commons.collections.functors.FactoryTransformer;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Paul Jack
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/LazySortedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/LazySortedMap.java b/src/java/org/apache/commons/collections/map/LazySortedMap.java
index 0cada69..4cb7d68 100644
--- a/src/java/org/apache/commons/collections/map/LazySortedMap.java
+++ b/src/java/org/apache/commons/collections/map/LazySortedMap.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.
@@ -54,7 +54,7 @@ import org.apache.commons.collections.Transformer;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Paul Jack
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/LinkedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/LinkedMap.java b/src/java/org/apache/commons/collections/map/LinkedMap.java
index d6479d5..eeaf97d 100644
--- a/src/java/org/apache/commons/collections/map/LinkedMap.java
+++ b/src/java/org/apache/commons/collections/map/LinkedMap.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/ListOrderedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/ListOrderedMap.java b/src/java/org/apache/commons/collections/map/ListOrderedMap.java
index c94f907..fea2f36 100644
--- a/src/java/org/apache/commons/collections/map/ListOrderedMap.java
+++ b/src/java/org/apache/commons/collections/map/ListOrderedMap.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.
@@ -62,7 +62,7 @@ import org.apache.commons.collections.list.UnmodifiableList;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Henri Yandell
  * @author Stephen Colebourne
  * @author Matt Benson

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/MultiKeyMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/MultiKeyMap.java b/src/java/org/apache/commons/collections/map/MultiKeyMap.java
index 563e7bd..ce39401 100644
--- a/src/java/org/apache/commons/collections/map/MultiKeyMap.java
+++ b/src/java/org/apache/commons/collections/map/MultiKeyMap.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.
@@ -53,7 +53,7 @@ import org.apache.commons.collections.keyvalue.MultiKey;
  * and a Locale to lookup the airline's name:
  * <pre>
  * private MultiKeyMap cache = MultiKeyMap.decorate(new LRUMap(50));
- * 
+ *
  * public String getAirlineName(String code, String locale) {
  *   String name = (String) cache.get(code, locale);
  *   if (name == null) {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/MultiValueMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/MultiValueMap.java b/src/java/org/apache/commons/collections/map/MultiValueMap.java
index b7b7059..7f9d5be 100644
--- a/src/java/org/apache/commons/collections/map/MultiValueMap.java
+++ b/src/java/org/apache/commons/collections/map/MultiValueMap.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.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/PredicatedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/PredicatedMap.java b/src/java/org/apache/commons/collections/map/PredicatedMap.java
index eebce71..c5f44c4 100644
--- a/src/java/org/apache/commons/collections/map/PredicatedMap.java
+++ b/src/java/org/apache/commons/collections/map/PredicatedMap.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.
@@ -47,7 +47,7 @@ import org.apache.commons.collections.Predicate;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Paul Jack
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/PredicatedSortedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/PredicatedSortedMap.java b/src/java/org/apache/commons/collections/map/PredicatedSortedMap.java
index 63f75a3..3bbf93a 100644
--- a/src/java/org/apache/commons/collections/map/PredicatedSortedMap.java
+++ b/src/java/org/apache/commons/collections/map/PredicatedSortedMap.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.
@@ -42,7 +42,7 @@ import org.apache.commons.collections.Predicate;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Paul Jack
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/ReferenceIdentityMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/ReferenceIdentityMap.java b/src/java/org/apache/commons/collections/map/ReferenceIdentityMap.java
index 7a6ac47..74447ea 100644
--- a/src/java/org/apache/commons/collections/map/ReferenceIdentityMap.java
+++ b/src/java/org/apache/commons/collections/map/ReferenceIdentityMap.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.
@@ -64,10 +64,10 @@ import java.lang.ref.Reference;
  * exceptions when accessed by concurrent threads without synchronization.
  *
  * @see java.lang.ref.Reference
- * 
+ *
  * @since Commons Collections 3.0 (previously in main package v2.1)
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class ReferenceIdentityMap<K, V> extends AbstractReferenceMap<K, V> implements Serializable {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/ReferenceMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/ReferenceMap.java b/src/java/org/apache/commons/collections/map/ReferenceMap.java
index 861db7f..3ffc5bb 100644
--- a/src/java/org/apache/commons/collections/map/ReferenceMap.java
+++ b/src/java/org/apache/commons/collections/map/ReferenceMap.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.
@@ -66,10 +66,10 @@ import java.io.Serializable;
  * extensible and provides a <code>MapIterator</code>.
  *
  * @see java.lang.ref.Reference
- * 
+ *
  * @since Commons Collections 3.0 (previously in main package v2.1)
  * @version $Revision$ $Date$
- * 
+ *
  * @author Paul Jack
  * @author Stephen Colebourne
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/SingletonMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/SingletonMap.java b/src/java/org/apache/commons/collections/map/SingletonMap.java
index a3ae8c0..4c670cf 100644
--- a/src/java/org/apache/commons/collections/map/SingletonMap.java
+++ b/src/java/org/apache/commons/collections/map/SingletonMap.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.
@@ -52,7 +52,7 @@ import org.apache.commons.collections.keyvalue.TiedMapEntry;
  * <li>the <code>MapIterator</code>, see {@link #mapIterator()}
  * <li>the <code>KeyValue</code> interface (just cast - no object creation)
  * </ul>
- * 
+ *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
  *

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/StaticBucketMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/StaticBucketMap.java b/src/java/org/apache/commons/collections/map/StaticBucketMap.java
index 141eefc..dc3aca7 100644
--- a/src/java/org/apache/commons/collections/map/StaticBucketMap.java
+++ b/src/java/org/apache/commons/collections/map/StaticBucketMap.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.
@@ -92,7 +92,7 @@ import org.apache.commons.collections.KeyValue;
  *
  * @since Commons Collections 3.0 (previously in main package v2.1)
  * @version $Revision$ $Date$
- * 
+ *
  * @author Berin Loritsch
  * @author Gerhard Froehlich
  * @author Michael A. Smith

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/TransformedSortedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/TransformedSortedMap.java b/src/java/org/apache/commons/collections/map/TransformedSortedMap.java
index 5957736..9828507 100644
--- a/src/java/org/apache/commons/collections/map/TransformedSortedMap.java
+++ b/src/java/org/apache/commons/collections/map/TransformedSortedMap.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.
@@ -40,7 +40,7 @@ import org.apache.commons.collections.Transformer;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TransformedSortedMap<K, V>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/UnmodifiableEntrySet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/UnmodifiableEntrySet.java b/src/java/org/apache/commons/collections/map/UnmodifiableEntrySet.java
index afb088e..0e4ad42 100644
--- a/src/java/org/apache/commons/collections/map/UnmodifiableEntrySet.java
+++ b/src/java/org/apache/commons/collections/map/UnmodifiableEntrySet.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.
@@ -32,7 +32,7 @@ import org.apache.commons.collections.set.AbstractSetDecorator;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public final class UnmodifiableEntrySet<K, V>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/UnmodifiableMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/UnmodifiableMap.java b/src/java/org/apache/commons/collections/map/UnmodifiableMap.java
index 0239db1..740293c 100644
--- a/src/java/org/apache/commons/collections/map/UnmodifiableMap.java
+++ b/src/java/org/apache/commons/collections/map/UnmodifiableMap.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.
@@ -39,7 +39,7 @@ import org.apache.commons.collections.set.UnmodifiableSet;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public final class UnmodifiableMap<K, V>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java b/src/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java
index 2e42934..a0bf8ab 100644
--- a/src/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java
+++ b/src/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.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.
@@ -38,7 +38,7 @@ import org.apache.commons.collections.set.UnmodifiableSet;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public final class UnmodifiableOrderedMap<K, V> extends AbstractOrderedMapDecorator<K, V> implements

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/map/UnmodifiableSortedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/UnmodifiableSortedMap.java b/src/java/org/apache/commons/collections/map/UnmodifiableSortedMap.java
index 7c78671..1408133 100644
--- a/src/java/org/apache/commons/collections/map/UnmodifiableSortedMap.java
+++ b/src/java/org/apache/commons/collections/map/UnmodifiableSortedMap.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.
@@ -37,7 +37,7 @@ import org.apache.commons.collections.set.UnmodifiableSet;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public final class UnmodifiableSortedMap<K, V>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/set/AbstractSerializableSetDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/AbstractSerializableSetDecorator.java b/src/java/org/apache/commons/collections/set/AbstractSerializableSetDecorator.java
index 5a0c932..ab65872 100644
--- a/src/java/org/apache/commons/collections/set/AbstractSerializableSetDecorator.java
+++ b/src/java/org/apache/commons/collections/set/AbstractSerializableSetDecorator.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.
@@ -25,7 +25,7 @@ import java.util.Set;
 
 /**
  * Serializable subclass of AbstractSetDecorator.
- * 
+ *
  * @author Stephen Colebourne
  * @since Commons Collections 3.1
  */

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/set/AbstractSetDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/AbstractSetDecorator.java b/src/java/org/apache/commons/collections/set/AbstractSetDecorator.java
index dffc0c5..db25dff 100644
--- a/src/java/org/apache/commons/collections/set/AbstractSetDecorator.java
+++ b/src/java/org/apache/commons/collections/set/AbstractSetDecorator.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.
@@ -28,7 +28,7 @@ import org.apache.commons.collections.collection.AbstractCollectionDecorator;
  * @param <E> the type of the elements in the set
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public abstract class AbstractSetDecorator<E> extends AbstractCollectionDecorator<E> implements

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java b/src/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java
index e26fe9f..deafe9b 100644
--- a/src/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java
+++ b/src/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.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.
@@ -28,7 +28,7 @@ import java.util.SortedSet;
  * @param <E> the type of the elements in the sorted set
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public abstract class AbstractSortedSetDecorator<E>

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c10ea5b9/src/java/org/apache/commons/collections/set/MapBackedSet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/MapBackedSet.java b/src/java/org/apache/commons/collections/set/MapBackedSet.java
index 5144de5..a208f7b 100644
--- a/src/java/org/apache/commons/collections/set/MapBackedSet.java
+++ b/src/java/org/apache/commons/collections/set/MapBackedSet.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.
@@ -34,7 +34,7 @@ import java.util.Set;
  *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public final class MapBackedSet<E, V> implements Set<E>, Serializable {


[17/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/TestFactoryUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestFactoryUtils.java b/src/test/org/apache/commons/collections/TestFactoryUtils.java
index 3abbeaa..257acef 100644
--- a/src/test/org/apache/commons/collections/TestFactoryUtils.java
+++ b/src/test/org/apache/commons/collections/TestFactoryUtils.java
@@ -80,7 +80,7 @@ public class TestFactoryUtils extends junit.framework.TestCase {
     //------------------------------------------------------------------
     
     public void testNullFactory() {
-        Factory factory = FactoryUtils.nullFactory();
+        Factory<Object> factory = FactoryUtils.nullFactory();
         assertNotNull(factory);
         Object created = factory.create();
         assertNull(created);
@@ -90,7 +90,7 @@ public class TestFactoryUtils extends junit.framework.TestCase {
     //------------------------------------------------------------------
     
     public void testConstantFactoryNull() {
-        Factory factory = FactoryUtils.constantFactory(null);
+        Factory<Object> factory = FactoryUtils.constantFactory(null);
         assertNotNull(factory);
         Object created = factory.create();
         assertNull(created);
@@ -98,9 +98,9 @@ public class TestFactoryUtils extends junit.framework.TestCase {
 
     public void testConstantFactoryConstant() {
         Integer constant = new Integer(9);
-        Factory factory = FactoryUtils.constantFactory(constant);
+        Factory<Integer> factory = FactoryUtils.constantFactory(constant);
         assertNotNull(factory);
-        Object created = factory.create();
+        Integer created = factory.create();
         assertSame(constant, created);
     }
 
@@ -113,9 +113,9 @@ public class TestFactoryUtils extends junit.framework.TestCase {
 
     public void testPrototypeFactoryPublicCloneMethod() throws Exception {
         Date proto = new Date();
-        Factory factory = FactoryUtils.prototypeFactory(proto);
+        Factory<Date> factory = FactoryUtils.prototypeFactory(proto);
         assertNotNull(factory);
-        Object created = factory.create();
+        Date created = factory.create();
         assertTrue(proto != created);
         assertEquals(proto, created);
         
@@ -125,13 +125,13 @@ public class TestFactoryUtils extends junit.framework.TestCase {
         out.writeObject(factory);
         out.close();
         ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
-        Object dest = in.readObject();
+        in.readObject();
         in.close();
     }
 
     public void testPrototypeFactoryPublicCopyConstructor() throws Exception {
         Mock1 proto = new Mock1(6);
-        Factory factory = FactoryUtils.prototypeFactory(proto);
+        Factory<Object> factory = FactoryUtils.<Object>prototypeFactory(proto);
         assertNotNull(factory);
         Object created = factory.create();
         assertTrue(proto != created);
@@ -145,21 +145,21 @@ public class TestFactoryUtils extends junit.framework.TestCase {
         } catch (NotSerializableException ex) {
             out.close();
         }
-        factory = FactoryUtils.prototypeFactory(new Mock2("S"));
+        factory = FactoryUtils.<Object>prototypeFactory(new Mock2("S"));
         buffer = new ByteArrayOutputStream();
         out = new ObjectOutputStream(buffer);
         out.writeObject(factory);
         out.close();
         ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
-        Object dest = in.readObject();
+        in.readObject();
         in.close();
     }
 
     public void testPrototypeFactoryPublicSerialization() throws Exception {
         Integer proto = new Integer(9);
-        Factory factory = FactoryUtils.prototypeFactory(proto);
+        Factory<Integer> factory = FactoryUtils.prototypeFactory(proto);
         assertNotNull(factory);
-        Object created = factory.create();
+        Integer created = factory.create();
         assertTrue(proto != created);
         assertEquals(proto, created);
         
@@ -169,17 +169,16 @@ public class TestFactoryUtils extends junit.framework.TestCase {
         out.writeObject(factory);
         out.close();
         ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
-        Object dest = in.readObject();
+        in.readObject();
         in.close();
     }
 
     public void testPrototypeFactoryPublicSerializationError() {
         Mock2 proto = new Mock2(new Object());
-        Factory factory = FactoryUtils.prototypeFactory(proto);
+        Factory<Object> factory = FactoryUtils.<Object>prototypeFactory(proto);
         assertNotNull(factory);
         try {
-            Object created = factory.create();
-            
+            factory.create();
         } catch (FunctorException ex) {
             assertTrue(ex.getCause() instanceof IOException);
             return;
@@ -190,8 +189,7 @@ public class TestFactoryUtils extends junit.framework.TestCase {
     public void testPrototypeFactoryPublicBad() {
         Object proto = new Object();
         try {
-            Factory factory = FactoryUtils.prototypeFactory(proto);
-            
+            FactoryUtils.prototypeFactory(proto);
         } catch (IllegalArgumentException ex) {
             return;
         }
@@ -216,6 +214,7 @@ public class TestFactoryUtils extends junit.framework.TestCase {
         }
     }
     
+    @SuppressWarnings("serial")
     public static class Mock2 implements Serializable {
         private final Object iVal;
         public Mock2(Object val) {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/TestIteratorUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestIteratorUtils.java b/src/test/org/apache/commons/collections/TestIteratorUtils.java
index 03afc1d..b729306 100644
--- a/src/test/org/apache/commons/collections/TestIteratorUtils.java
+++ b/src/test/org/apache/commons/collections/TestIteratorUtils.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,9 +33,9 @@ import org.apache.commons.collections.iterators.EmptyOrderedMapIterator;
 
 /**
  * Tests for IteratorUtils.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Unknown
  */
 public class TestIteratorUtils extends BulkTest {
@@ -53,16 +53,16 @@ public class TestIteratorUtils extends BulkTest {
     }
 
     public void testToList() {
-        List list = new ArrayList();
+        List<Object> list = new ArrayList<Object>();
         list.add(new Integer(1));
         list.add("Two");
         list.add(null);
-        List result = IteratorUtils.toList(list.iterator());
+        List<Object> result = IteratorUtils.toList(list.iterator());
         assertEquals(list, result);
     }
 
     public void testToArray() {
-        List list = new ArrayList();
+        List<Object> list = new ArrayList<Object>();
         list.add(new Integer(1));
         list.add("Two");
         list.add(null);
@@ -71,137 +71,137 @@ public class TestIteratorUtils extends BulkTest {
     }
 
     public void testToArray2() {
-        List list = new ArrayList();
+        List<String> list = new ArrayList<String>();
         list.add("One");
         list.add("Two");
         list.add(null);
         String[] result = (String[]) IteratorUtils.toArray(list.iterator(), String.class);
         assertEquals(list, Arrays.asList(result));
     }
-    
+
     public void testArrayIterator() {
         Object[] objArray = {"a", "b", "c"};
-        ResettableIterator iterator = IteratorUtils.arrayIterator(objArray);
+        ResettableIterator<Object> iterator = IteratorUtils.arrayIterator(objArray);
         assertTrue(iterator.next().equals("a"));
         assertTrue(iterator.next().equals("b"));
         iterator.reset();
         assertTrue(iterator.next().equals("a"));
-        
+
         try {
             iterator = IteratorUtils.arrayIterator(new Integer(0));
             fail("Expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {
                 // expected
         }
-        
+
         try {
             iterator = IteratorUtils.arrayIterator(null);
             fail("Expecting NullPointerException");
         } catch (NullPointerException ex) {
                 // expected
         }
-        
+
         iterator = IteratorUtils.arrayIterator(objArray, 1);
         assertTrue(iterator.next().equals("b"));
-        
+
         try {
             iterator = IteratorUtils.arrayIterator(objArray, -1);
             fail("Expecting IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException ex) {
             // expected
         }
-        
+
         iterator = IteratorUtils.arrayIterator(objArray, 3);
         assertTrue(!iterator.hasNext());
         iterator.reset();
-        
+
         try {
             iterator = IteratorUtils.arrayIterator(objArray, 4);
             fail("Expecting IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException ex) {
             // expected
         }
-        
+
         iterator = IteratorUtils.arrayIterator(objArray, 2, 3);
         assertTrue(iterator.next().equals("c"));
-        
+
         try {
             iterator = IteratorUtils.arrayIterator(objArray, 2, 4);
             fail("Expecting IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException ex) {
             // expected
         }
-        
+
         try {
             iterator = IteratorUtils.arrayIterator(objArray, -1, 1);
             fail("Expecting IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException ex) {
             // expected
         }
-        
+
         try {
             iterator = IteratorUtils.arrayIterator(objArray, 2, 1);
             fail("Expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // expected
         }
-        
+
         int[] intArray = {0, 1, 2};
         iterator = IteratorUtils.arrayIterator(intArray);
         assertTrue(iterator.next().equals(new Integer(0)));
         assertTrue(iterator.next().equals(new Integer(1)));
         iterator.reset();
         assertTrue(iterator.next().equals(new Integer(0)));
-        
+
         iterator = IteratorUtils.arrayIterator(intArray, 1);
         assertTrue(iterator.next().equals(new Integer(1)));
-        
+
         try {
             iterator = IteratorUtils.arrayIterator(intArray, -1);
             fail("Expecting IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException ex) {
             // expected
         }
-        
+
         iterator = IteratorUtils.arrayIterator(intArray, 3);
         assertTrue(!iterator.hasNext());
         iterator.reset();
-        
+
         try {
             iterator = IteratorUtils.arrayIterator(intArray, 4);
             fail("Expecting IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException ex) {
             // expected
         }
-        
+
         iterator = IteratorUtils.arrayIterator(intArray, 2, 3);
         assertTrue(iterator.next().equals(new Integer(2)));
-        
+
         try {
             iterator = IteratorUtils.arrayIterator(intArray, 2, 4);
             fail("Expecting IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException ex) {
             // expected
         }
-        
+
         try {
             iterator = IteratorUtils.arrayIterator(intArray, -1, 1);
             fail("Expecting IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException ex) {
             // expected
         }
-        
+
         try {
             iterator = IteratorUtils.arrayIterator(intArray, 2, 1);
             fail("Expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // expected
-        }          
+        }
     }
-    
+
     public void testArrayListIterator() {
         Object[] objArray = {"a", "b", "c", "d"};
-        ResettableListIterator iterator = IteratorUtils.arrayListIterator(objArray);
+        ResettableListIterator<Object> iterator = IteratorUtils.arrayListIterator(objArray);
         assertTrue(!iterator.hasPrevious());
         assertTrue(iterator.previousIndex() == -1);
         assertTrue(iterator.nextIndex() == 0);
@@ -215,158 +215,158 @@ public class TestIteratorUtils extends BulkTest {
         assertTrue(iterator.next().equals("d"));
         assertTrue(iterator.nextIndex() == 4); // size of list
         assertTrue(iterator.previousIndex() == 3);
-        
+
         try {
             iterator = IteratorUtils.arrayListIterator(new Integer(0));
             fail("Expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {
                 // expected
         }
-        
+
         try {
             iterator = IteratorUtils.arrayListIterator(null);
             fail("Expecting NullPointerException");
         } catch (NullPointerException ex) {
                 // expected
         }
-        
+
         iterator = IteratorUtils.arrayListIterator(objArray, 1);
-        assertTrue(iterator.previousIndex() == -1); 
+        assertTrue(iterator.previousIndex() == -1);
         assertTrue(!iterator.hasPrevious());
-        assertTrue(iterator.nextIndex() == 0); 
+        assertTrue(iterator.nextIndex() == 0);
         assertTrue(iterator.next().equals("b"));
-        assertTrue(iterator.previousIndex() == 0);        
-        
+        assertTrue(iterator.previousIndex() == 0);
+
         try {
             iterator = IteratorUtils.arrayListIterator(objArray, -1);
             fail("Expecting IndexOutOfBoundsException.");
         } catch (IndexOutOfBoundsException ex) {
             // expected
         }
-        
+
         iterator = IteratorUtils.arrayListIterator(objArray, 3);
         assertTrue(iterator.hasNext());
         try {
-            Object x = iterator.previous();
+            iterator.previous();
             fail("Expecting NoSuchElementException.");
         } catch (NoSuchElementException ex) {
             // expected
         }
-        
+
         try {
             iterator = IteratorUtils.arrayListIterator(objArray, 5);
             fail("Expecting IndexOutOfBoundsException.");
         } catch (IndexOutOfBoundsException ex) {
             // expected
         }
-        
+
         iterator = IteratorUtils.arrayListIterator(objArray, 2, 3);
         assertTrue(iterator.next().equals("c"));
-        
+
         try {
             iterator = IteratorUtils.arrayListIterator(objArray, 2, 5);
             fail("Expecting IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException ex) {
             // expected
         }
-        
+
         try {
             iterator = IteratorUtils.arrayListIterator(objArray, -1, 1);
             fail("Expecting IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException ex) {
             // expected
         }
-        
+
         try {
             iterator = IteratorUtils.arrayListIterator(objArray, 2, 1);
             fail("Expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // expected
         }
-        
+
         int[] intArray = {0, 1, 2};
         iterator = IteratorUtils.arrayListIterator(intArray);
-        assertTrue(iterator.previousIndex() == -1); 
+        assertTrue(iterator.previousIndex() == -1);
         assertTrue(!iterator.hasPrevious());
-        assertTrue(iterator.nextIndex() == 0); 
+        assertTrue(iterator.nextIndex() == 0);
         assertTrue(iterator.next().equals(new Integer(0)));
-        assertTrue(iterator.previousIndex() == 0); 
-        assertTrue(iterator.nextIndex() == 1); 
+        assertTrue(iterator.previousIndex() == 0);
+        assertTrue(iterator.nextIndex() == 1);
         assertTrue(iterator.next().equals(new Integer(1)));
-        assertTrue(iterator.previousIndex() == 1); 
-        assertTrue(iterator.nextIndex() == 2); 
+        assertTrue(iterator.previousIndex() == 1);
+        assertTrue(iterator.nextIndex() == 2);
         assertTrue(iterator.previous().equals(new Integer(1)));
         assertTrue(iterator.next().equals(new Integer(1)));
-        
+
         iterator = IteratorUtils.arrayListIterator(intArray, 1);
-        assertTrue(iterator.previousIndex() == -1); 
+        assertTrue(iterator.previousIndex() == -1);
         assertTrue(!iterator.hasPrevious());
-        assertTrue(iterator.nextIndex() == 0); 
+        assertTrue(iterator.nextIndex() == 0);
         assertTrue(iterator.next().equals(new Integer(1)));
         assertTrue(iterator.previous().equals(new Integer(1)));
         assertTrue(iterator.next().equals(new Integer(1)));
-        assertTrue(iterator.previousIndex() == 0); 
-        assertTrue(iterator.nextIndex() == 1); 
+        assertTrue(iterator.previousIndex() == 0);
+        assertTrue(iterator.nextIndex() == 1);
         assertTrue(iterator.next().equals(new Integer(2)));
-        assertTrue(iterator.previousIndex() == 1); 
-        assertTrue(iterator.nextIndex() == 2); 
+        assertTrue(iterator.previousIndex() == 1);
+        assertTrue(iterator.nextIndex() == 2);
         assertTrue(iterator.previous().equals(new Integer(2)));
-        assertTrue(iterator.previousIndex() == 0); 
-        assertTrue(iterator.nextIndex() == 1); 
-        
+        assertTrue(iterator.previousIndex() == 0);
+        assertTrue(iterator.nextIndex() == 1);
+
         try {
             iterator = IteratorUtils.arrayListIterator(intArray, -1);
             fail("Expecting IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException ex) {
             // expected
         }
-        
+
         iterator = IteratorUtils.arrayListIterator(intArray, 3);
         assertTrue(!iterator.hasNext());
-     
+
         try {
             iterator = IteratorUtils.arrayListIterator(intArray, 4);
             fail("Expecting IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException ex) {
             // expected
         }
-        
+
         iterator = IteratorUtils.arrayListIterator(intArray, 2, 3);
         assertTrue(!iterator.hasPrevious());
         assertTrue(iterator.previousIndex() == -1);
         assertTrue(iterator.next().equals(new Integer(2)));
         assertTrue(iterator.hasPrevious());
         assertTrue(!iterator.hasNext());
-        
-        
+
+
         try {
             iterator = IteratorUtils.arrayListIterator(intArray, 2, 4);
             fail("Expecting IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException ex) {
             // expected
         }
-        
+
         try {
             iterator = IteratorUtils.arrayListIterator(intArray, -1, 1);
             fail("Expecting IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException ex) {
             // expected
         }
-        
+
         try {
             iterator = IteratorUtils.arrayListIterator(intArray, 2, 1);
             fail("Expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // expected
-        }          
+        }
     }
-        
+
 
     /**
      * Gets an immutable Iterator operating on the elements ["a", "b", "c", "d"].
      */
-    private Iterator getImmutableIterator() {
-        List list = new ArrayList();
+    private Iterator<String> getImmutableIterator() {
+        List<String> list = new ArrayList<String>();
         list.add("a");
         list.add("b");
         list.add("c");
@@ -377,8 +377,8 @@ public class TestIteratorUtils extends BulkTest {
     /**
      * Gets an immutable ListIterator operating on the elements ["a", "b", "c", "d"].
      */
-    private ListIterator getImmutableListIterator() {
-        List list = new ArrayList();
+    private ListIterator<String> getImmutableListIterator() {
+        List<String> list = new ArrayList<String>();
         list.add("a");
         list.add("b");
         list.add("c");
@@ -411,7 +411,7 @@ public class TestIteratorUtils extends BulkTest {
             fail();
         } catch (IllegalStateException ex) {}
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Test empty list iterator
@@ -451,11 +451,12 @@ public class TestIteratorUtils extends BulkTest {
             fail();
         } catch (UnsupportedOperationException ex) {}
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Test empty map iterator
      */
+    @SuppressWarnings("unchecked")
     public void testEmptyMapIterator() {
         assertSame(EmptyMapIterator.INSTANCE, IteratorUtils.EMPTY_MAP_ITERATOR);
         assertEquals(true, IteratorUtils.EMPTY_MAP_ITERATOR instanceof Iterator);
@@ -465,7 +466,7 @@ public class TestIteratorUtils extends BulkTest {
         assertEquals(false, IteratorUtils.EMPTY_MAP_ITERATOR instanceof OrderedIterator);
         assertEquals(false, IteratorUtils.EMPTY_MAP_ITERATOR instanceof OrderedMapIterator);
         assertEquals(false, IteratorUtils.EMPTY_MAP_ITERATOR.hasNext());
-        ((ResettableIterator) IteratorUtils.EMPTY_MAP_ITERATOR).reset();
+        ((ResettableIterator<Object>) IteratorUtils.EMPTY_MAP_ITERATOR).reset();
         assertSame(IteratorUtils.EMPTY_MAP_ITERATOR, IteratorUtils.EMPTY_MAP_ITERATOR);
         assertSame(IteratorUtils.EMPTY_MAP_ITERATOR, IteratorUtils.emptyMapIterator());
         try {
@@ -489,11 +490,12 @@ public class TestIteratorUtils extends BulkTest {
             fail();
         } catch (IllegalStateException ex) {}
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Test empty map iterator
      */
+    @SuppressWarnings("unchecked")
     public void testEmptyOrderedIterator() {
         assertSame(EmptyOrderedIterator.INSTANCE, IteratorUtils.EMPTY_ORDERED_ITERATOR);
         assertEquals(true, IteratorUtils.EMPTY_ORDERED_ITERATOR instanceof Iterator);
@@ -503,7 +505,7 @@ public class TestIteratorUtils extends BulkTest {
         assertEquals(false, IteratorUtils.EMPTY_ORDERED_ITERATOR instanceof MapIterator);
         assertEquals(false, IteratorUtils.EMPTY_ORDERED_ITERATOR.hasNext());
         assertEquals(false, IteratorUtils.EMPTY_ORDERED_ITERATOR.hasPrevious());
-        ((ResettableIterator) IteratorUtils.EMPTY_ORDERED_ITERATOR).reset();
+        ((ResettableIterator<Object>) IteratorUtils.EMPTY_ORDERED_ITERATOR).reset();
         assertSame(IteratorUtils.EMPTY_ORDERED_ITERATOR, IteratorUtils.EMPTY_ORDERED_ITERATOR);
         assertSame(IteratorUtils.EMPTY_ORDERED_ITERATOR, IteratorUtils.emptyOrderedIterator());
         try {
@@ -519,11 +521,12 @@ public class TestIteratorUtils extends BulkTest {
             fail();
         } catch (IllegalStateException ex) {}
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Test empty map iterator
      */
+    @SuppressWarnings("unchecked")
     public void testEmptyOrderedMapIterator() {
         assertSame(EmptyOrderedMapIterator.INSTANCE, IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR);
         assertEquals(true, IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR instanceof Iterator);
@@ -533,7 +536,7 @@ public class TestIteratorUtils extends BulkTest {
         assertEquals(false, IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR instanceof ListIterator);
         assertEquals(false, IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR.hasNext());
         assertEquals(false, IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR.hasPrevious());
-        ((ResettableIterator) IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR).reset();
+        ((ResettableIterator<Object>) IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR).reset();
         assertSame(IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR, IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR);
         assertSame(IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR, IteratorUtils.emptyOrderedMapIterator());
         try {
@@ -561,13 +564,13 @@ public class TestIteratorUtils extends BulkTest {
             fail();
         } catch (IllegalStateException ex) {}
     }
-    
+
     //-----------------------------------------------------------------------
 	/**
 	 * Test next() and hasNext() for an immutable Iterator.
 	 */
     public void testUnmodifiableIteratorIteration() {
-        Iterator iterator = getImmutableIterator();
+        Iterator<String> iterator = getImmutableIterator();
 
         assertTrue(iterator.hasNext());
 
@@ -593,7 +596,7 @@ public class TestIteratorUtils extends BulkTest {
      * ListIterator.
      */
     public void testUnmodifiableListIteratorIteration() {
-        ListIterator listIterator = getImmutableListIterator();
+        ListIterator<String> listIterator = getImmutableListIterator();
 
         assertTrue(!listIterator.hasPrevious());
         assertTrue(listIterator.hasNext());
@@ -643,7 +646,7 @@ public class TestIteratorUtils extends BulkTest {
      * Test remove() for an immutable Iterator.
      */
     public void testUnmodifiableIteratorImmutability() {
-        Iterator iterator = getImmutableIterator();
+        Iterator<String> iterator = getImmutableIterator();
 
         try {
             iterator.remove();
@@ -669,7 +672,7 @@ public class TestIteratorUtils extends BulkTest {
      * Test remove() for an immutable ListIterator.
      */
     public void testUnmodifiableListIteratorImmutability() {
-    	ListIterator listIterator = getImmutableListIterator();
+    	ListIterator<String> listIterator = getImmutableListIterator();
 
         try {
             listIterator.remove();

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/TestLinkedList.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestLinkedList.java b/src/test/org/apache/commons/collections/TestLinkedList.java
index e2ce122..62e7166 100644
--- a/src/test/org/apache/commons/collections/TestLinkedList.java
+++ b/src/test/org/apache/commons/collections/TestLinkedList.java
@@ -38,46 +38,21 @@ import org.apache.commons.collections.list.AbstractTestList;
  *
  * @author Rich Dougherty
  */
-public abstract class TestLinkedList extends AbstractTestList {
+public abstract class TestLinkedList<T> extends AbstractTestList<T> {
 
     public TestLinkedList(String testName) {
         super(testName);
     }
 
-    public List makeEmptyList() {
-        return makeEmptyLinkedList();
-    }
-
-    public List makeFullList() {
-        return makeFullLinkedList();
-    }
-
-    /**
-     *  Return a new, empty {@link LinkedList} to be used for testing.
-     *
-     *  @return an empty list for testing.
-     */
-    protected abstract LinkedList makeEmptyLinkedList();
-
-    /**
-     *  Return a new, full {@link List} to be used for testing.
-     *
-     *  @return a full list for testing
-     */
-    protected LinkedList makeFullLinkedList() {
-        // only works if list supports optional "addAll(Collection)" 
-        LinkedList list = makeEmptyLinkedList();
-        list.addAll(Arrays.asList(getFullElements()));
-        return list;
-    }
+    public abstract LinkedList<T> makeObject();
 
     /**
      *  Returns the {@link #collection} field cast to a {@link LinkedList}.
      *
      *  @return the collection field as a List
      */
-    protected LinkedList getLinkedList() {
-        return (LinkedList)collection;
+    public LinkedList<T> getCollection() {
+        return (LinkedList<T>) super.getCollection();
     }
 
     /**
@@ -85,24 +60,25 @@ public abstract class TestLinkedList extends AbstractTestList {
      *
      *  @return the confirmed field as a List
      */
-    protected LinkedList getConfirmedLinkedList() {
-        return (LinkedList)confirmed;
+    protected LinkedList<T> getConfirmedLinkedList() {
+        return (LinkedList<T>) getConfirmed();
     }
 
     /**
      *  Tests {@link LinkedList#addFirst(Object)}.
      */
+    @SuppressWarnings("unchecked")
     public void testLinkedListAddFirst() {
         if (!isAddSupported()) return;
-        Object o = "hello";
+        T o = (T) "hello";
 
         resetEmpty();
-        getLinkedList().addFirst(o);
+        getCollection().addFirst(o);
         getConfirmedLinkedList().addFirst(o);
         verify();
 
         resetFull();
-        getLinkedList().addFirst(o);
+        getCollection().addFirst(o);
         getConfirmedLinkedList().addFirst(o);
         verify();
     }
@@ -110,17 +86,18 @@ public abstract class TestLinkedList extends AbstractTestList {
     /**
      *  Tests {@link LinkedList#addLast(Object)}.
      */
+    @SuppressWarnings("unchecked")
     public void testLinkedListAddLast() {
         if (!isAddSupported()) return;
-        Object o = "hello";
+        T o = (T) "hello";
 
         resetEmpty();
-        getLinkedList().addLast(o);
+        getCollection().addLast(o);
         getConfirmedLinkedList().addLast(o);
         verify();
 
         resetFull();
-        getLinkedList().addLast(o);
+        getCollection().addLast(o);
         getConfirmedLinkedList().addLast(o);
         verify();
     }
@@ -131,7 +108,7 @@ public abstract class TestLinkedList extends AbstractTestList {
     public void testLinkedListGetFirst() {
         resetEmpty();
         try {
-            getLinkedList().getFirst();
+            getCollection().getFirst();
             fail("getFirst() should throw a NoSuchElementException for an " +
                     "empty list.");
         } catch (NoSuchElementException e) {
@@ -140,7 +117,7 @@ public abstract class TestLinkedList extends AbstractTestList {
         verify();
 
         resetFull();
-        Object first = getLinkedList().getFirst();
+        Object first = getCollection().getFirst();
         Object confirmedFirst = getConfirmedLinkedList().getFirst();
         assertEquals("Result returned by getFirst() was wrong.",
                 confirmedFirst, first);
@@ -153,7 +130,7 @@ public abstract class TestLinkedList extends AbstractTestList {
     public void testLinkedListGetLast() {
         resetEmpty();
         try {
-            getLinkedList().getLast();
+            getCollection().getLast();
             fail("getLast() should throw a NoSuchElementException for an " +
                     "empty list.");
         } catch (NoSuchElementException e) {
@@ -162,7 +139,7 @@ public abstract class TestLinkedList extends AbstractTestList {
         verify();
         
         resetFull();
-        Object last = getLinkedList().getLast();
+        Object last = getCollection().getLast();
         Object confirmedLast = getConfirmedLinkedList().getLast();
         assertEquals("Result returned by getLast() was wrong.",
                 confirmedLast, last);
@@ -177,7 +154,7 @@ public abstract class TestLinkedList extends AbstractTestList {
 
         resetEmpty();
         try {
-            getLinkedList().removeFirst();
+            getCollection().removeFirst();
             fail("removeFirst() should throw a NoSuchElementException for " +
                     "an empty list.");
         } catch (NoSuchElementException e) {
@@ -186,7 +163,7 @@ public abstract class TestLinkedList extends AbstractTestList {
         verify();
         
         resetFull();
-        Object first = getLinkedList().removeFirst();
+        Object first = getCollection().removeFirst();
         Object confirmedFirst = getConfirmedLinkedList().removeFirst();
         assertEquals("Result returned by removeFirst() was wrong.",
                 confirmedFirst, first);
@@ -201,7 +178,7 @@ public abstract class TestLinkedList extends AbstractTestList {
 
         resetEmpty();
         try {
-            getLinkedList().removeLast();
+            getCollection().removeLast();
             fail("removeLast() should throw a NoSuchElementException for " +
                     "an empty list.");
         } catch (NoSuchElementException e) {
@@ -210,7 +187,7 @@ public abstract class TestLinkedList extends AbstractTestList {
         verify();
 
         resetFull();
-        Object last = getLinkedList().removeLast();
+        Object last = getCollection().removeLast();
         Object confirmedLast = getConfirmedLinkedList().removeLast();
         assertEquals("Result returned by removeLast() was wrong.",
                 confirmedLast, last);
@@ -220,15 +197,15 @@ public abstract class TestLinkedList extends AbstractTestList {
     /**
      *  Returns an empty {@link ArrayList}.
      */
-    public Collection makeConfirmedCollection() {
-        return new LinkedList();
+    public Collection<T> makeConfirmedCollection() {
+        return new LinkedList<T>();
     }
 
     /**
      *  Returns a full {@link ArrayList}.
      */
-    public Collection makeConfirmedFullCollection() {
-        List list = new LinkedList();
+    public Collection<T> makeConfirmedFullCollection() {
+        List<T> list = new LinkedList<T>();
         list.addAll(Arrays.asList(getFullElements()));
         return list;
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/TestListUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestListUtils.java b/src/test/org/apache/commons/collections/TestListUtils.java
index c30d843..69bc0cf 100644
--- a/src/test/org/apache/commons/collections/TestListUtils.java
+++ b/src/test/org/apache/commons/collections/TestListUtils.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.
@@ -28,9 +28,9 @@ import org.apache.commons.collections.list.PredicatedList;
 
 /**
  * Tests for ListUtils.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Neil O'Toole
  * @author Matthew Hawthorne
@@ -46,7 +46,7 @@ public class TestListUtils extends BulkTest {
 
     private String[] fullArray;
     private List<String> fullList;
-    
+
     public TestListUtils(String name) {
         super(name);
     }
@@ -57,10 +57,9 @@ public class TestListUtils extends BulkTest {
 
     public void setUp() {
         fullArray = new String[]{a, b, c, d, e};
-        fullList = new ArrayList(Arrays.asList(fullArray));
+        fullList = new ArrayList<String>(Arrays.asList(fullArray));
     }
-    
-    
+
     public void testNothing() {
     }
 
@@ -68,7 +67,7 @@ public class TestListUtils extends BulkTest {
      * Tests intersecting a non-empty list with an empty list.
      */
     public void testIntersectNonEmptyWithEmptyList() {
-        final List<?> empty = Collections.EMPTY_LIST;
+        final List<String> empty = Collections.<String>emptyList();
         assertTrue("result not empty", ListUtils.intersection(empty, fullList).isEmpty());
     }
 
@@ -85,7 +84,7 @@ public class TestListUtils extends BulkTest {
      */
     public void testIntersectNonEmptySubset() {
         // create a copy
-        final List<String> other = new ArrayList(fullList);
+        final List<String> other = new ArrayList<String>(fullList);
 
         // remove a few items
         assertNotNull(other.remove(0));
@@ -111,25 +110,21 @@ public class TestListUtils extends BulkTest {
     }
 
     public void testPredicatedList() {
-        Predicate predicate = new Predicate() {
+        Predicate<Object> predicate = new Predicate<Object>() {
             public boolean evaluate(Object o) {
                 return o instanceof String;
             }
         };
-        List list =
-        ListUtils.predicatedList(new ArrayStack(), predicate);
-        assertTrue("returned object should be a PredicatedList",
-            list instanceof PredicatedList);
+        List<Object> list = ListUtils.predicatedList(new ArrayStack<Object>(), predicate);
+        assertTrue("returned object should be a PredicatedList", list instanceof PredicatedList);
         try {
-            list =
-            ListUtils.predicatedList(new ArrayStack(), null);
+            list = ListUtils.predicatedList(new ArrayStack<Object>(), null);
             fail("Expecting IllegalArgumentException for null predicate.");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
-            list =
-            ListUtils.predicatedList(null, predicate);
+            list = ListUtils.predicatedList(null, predicate);
             fail("Expecting IllegalArgumentException for null list.");
         } catch (IllegalArgumentException ex) {
             // expected
@@ -137,29 +132,29 @@ public class TestListUtils extends BulkTest {
     }
 
     public void testLazyList() {
-        List list = ListUtils.lazyList(new ArrayList(), new Factory() {
+        List<Integer> list = ListUtils.lazyList(new ArrayList<Integer>(), new Factory<Integer>() {
 
             private int index;
 
-            public Object create() {
+            public Integer create() {
                 index++;
                 return new Integer(index);
             }
         });
 
-        assertNotNull((Integer)list.get(5));
+        assertNotNull(list.get(5));
         assertEquals(6, list.size());
 
-        assertNotNull((Integer)list.get(5));
+        assertNotNull(list.get(5));
         assertEquals(6, list.size());
     }
 
     public void testEquals() {
-        Collection data = Arrays.asList( new String[] { "a", "b", "c" });
-        
-        List a = new ArrayList( data );
-        List b = new ArrayList( data );
-        
+        Collection<String> data = Arrays.asList( new String[] { "a", "b", "c" });
+
+        List<String> a = new ArrayList<String>( data );
+        List<String> b = new ArrayList<String>( data );
+
         assertEquals(true, a.equals(b));
         assertEquals(true, ListUtils.isEqualList(a, b));
         a.clear();
@@ -168,13 +163,13 @@ public class TestListUtils extends BulkTest {
         assertEquals(false, ListUtils.isEqualList(null, b));
         assertEquals(true, ListUtils.isEqualList(null, null));
     }
-    
+
     public void testHashCode() {
-        Collection data = Arrays.asList( new String[] { "a", "b", "c" });
-            
-        List a = new ArrayList( data );
-        List b = new ArrayList( data );
-        
+        Collection<String> data = Arrays.asList( new String[] { "a", "b", "c" });
+
+        List<String> a = new ArrayList<String>(data);
+        List<String> b = new ArrayList<String>(data);
+
         assertEquals(true, a.hashCode() == b.hashCode());
         assertEquals(true, a.hashCode() == ListUtils.hashCodeForList(a));
         assertEquals(true, b.hashCode() == ListUtils.hashCodeForList(b));
@@ -183,20 +178,20 @@ public class TestListUtils extends BulkTest {
         assertEquals(false, ListUtils.hashCodeForList(a) == ListUtils.hashCodeForList(b));
         assertEquals(0, ListUtils.hashCodeForList(null));
     }
-    
+
     public void testRetainAll() {
-        List sub = new ArrayList();
+        List<String> sub = new ArrayList<String>();
         sub.add(a);
         sub.add(b);
         sub.add(x);
 
-        List retained = ListUtils.retainAll(fullList, sub);
+        List<String> retained = ListUtils.retainAll(fullList, sub);
         assertTrue(retained.size() == 2);
         sub.remove(x);
         assertTrue(retained.equals(sub));
         fullList.retainAll(sub);
         assertTrue(retained.equals(fullList));
-        
+
         try {
             ListUtils.retainAll(null, null);
             fail("expecting NullPointerException");
@@ -204,20 +199,20 @@ public class TestListUtils extends BulkTest {
     }
 
     public void testRemoveAll() {
-        List sub = new ArrayList();
+        List<String> sub = new ArrayList<String>();
         sub.add(a);
         sub.add(b);
         sub.add(x);
 
-        List remainder = ListUtils.removeAll(fullList, sub);
+        List<String> remainder = ListUtils.removeAll(fullList, sub);
         assertTrue(remainder.size() == 3);
         fullList.removeAll(sub);
         assertTrue(remainder.equals(fullList));
-        
+
         try {
             ListUtils.removeAll(null, null);
             fail("expecting NullPointerException");
         } catch(NullPointerException npe) {} // this is what we want
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/TestMapUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestMapUtils.java b/src/test/org/apache/commons/collections/TestMapUtils.java
index e1243d7..2f7006c 100644
--- a/src/test/org/apache/commons/collections/TestMapUtils.java
+++ b/src/test/org/apache/commons/collections/TestMapUtils.java
@@ -51,13 +51,12 @@ public class TestMapUtils extends BulkTest {
         super(name);
     }
 
-
     public static Test suite() {
         return BulkTest.makeSuite(TestMapUtils.class);
     }
 
-    public Predicate getPredicate() {
-        return new Predicate() {
+    public Predicate<Object> getPredicate() {
+        return new Predicate<Object>() {
             public boolean evaluate(Object o) {
                 return o instanceof String;
             }
@@ -65,10 +64,9 @@ public class TestMapUtils extends BulkTest {
     }
 
     public void testPredicatedMap() {
-        Predicate p = getPredicate();
-        Map map = MapUtils.predicatedMap(new HashMap(), p, p);
-        assertTrue("returned object should be a PredicatedMap",
-            map instanceof PredicatedMap);
+        Predicate<Object> p = getPredicate();
+        Map<Object, Object> map = MapUtils.predicatedMap(new HashMap<Object, Object>(), p, p);
+        assertTrue("returned object should be a PredicatedMap", map instanceof PredicatedMap);
         try {
             map = MapUtils.predicatedMap(null, p, p);
             fail("Expecting IllegalArgumentException for null map.");
@@ -78,32 +76,32 @@ public class TestMapUtils extends BulkTest {
     }
 
     public void testLazyMapFactory() {
-        Factory factory = FactoryUtils.constantFactory(new Integer(5));
-        Map map = MapUtils.lazyMap(new HashMap(), factory);
+        Factory<Integer> factory = FactoryUtils.constantFactory(new Integer(5));
+        Map<Object, Object> map = MapUtils.lazyMap(new HashMap<Object, Object>(), factory);
         assertTrue(map instanceof LazyMap);
         try {
-            map = MapUtils.lazyMap(new HashMap(), (Factory) null);
+            map = MapUtils.lazyMap(new HashMap<Object, Object>(), (Factory<Object>) null);
             fail("Expecting IllegalArgumentException for null factory");
         } catch (IllegalArgumentException e) {
             // expected
         }
         try {
-            map = MapUtils.lazyMap(null, factory);
+            map = MapUtils.lazyMap((Map<Object, Object>) null, factory);
             fail("Expecting IllegalArgumentException for null map");
         } catch (IllegalArgumentException e) {
             // expected
         }
-        Transformer transformer = TransformerUtils.asTransformer(factory);
-        map = MapUtils.lazyMap(new HashMap(), transformer);
+        Transformer<Object, Integer> transformer = TransformerUtils.asTransformer(factory);
+        map = MapUtils.lazyMap(new HashMap<Object, Object>(), transformer);
         assertTrue(map instanceof LazyMap);
          try {
-            map = MapUtils.lazyMap(new HashMap(), (Transformer) null);
+            map = MapUtils.lazyMap(new HashMap<Object, Object>(), (Transformer<Object, Object>) null);
             fail("Expecting IllegalArgumentException for null transformer");
         } catch (IllegalArgumentException e) {
             // expected
         }
         try {
-            map = MapUtils.lazyMap(null, transformer);
+            map = MapUtils.lazyMap((Map<Object, Object>) null, transformer);
             fail("Expecting IllegalArgumentException for null map");
         } catch (IllegalArgumentException e) {
             // expected
@@ -111,7 +109,7 @@ public class TestMapUtils extends BulkTest {
     }
 
     public void testLazyMapTransformer() {
-        Map map = MapUtils.lazyMap(new HashMap(), new Transformer() {
+        Map<Object, Object> map = MapUtils.lazyMap(new HashMap<Object, Object>(), new Transformer<Object, Object>() {
             public Object transform(Object mapKey) {
                 if (mapKey instanceof String) {
                     return new Integer((String) mapKey);
@@ -131,20 +129,20 @@ public class TestMapUtils extends BulkTest {
     }
 
     public void testInvertMap() {
-        final Map in = new HashMap( 5 , 1 );
-        in.put( "1" , "A" );
-        in.put( "2" , "B" );
-        in.put( "3" , "C" );
-        in.put( "4" , "D" );
-        in.put( "5" , "E" );
+        final Map<String, String> in = new HashMap<String, String>(5, 1);
+        in.put("1", "A");
+        in.put("2", "B");
+        in.put("3", "C");
+        in.put("4", "D");
+        in.put("5", "E");
 
-        final Set inKeySet = new HashSet( in.keySet() );
-        final Set inValSet = new HashSet( in.values() );
+        final Set<String> inKeySet = new HashSet<String>(in.keySet());
+        final Set<String> inValSet = new HashSet<String>(in.values());
 
-        final Map out =  MapUtils.invertMap(in);
+        final Map<String, String> out =  MapUtils.invertMap(in);
 
-        final Set outKeySet = new HashSet( out.keySet() );
-        final Set outValSet = new HashSet( out.values() );
+        final Set<String> outKeySet = new HashSet<String>(out.keySet());
+        final Set<String> outValSet = new HashSet<String>(out.values());
 
         assertTrue( inKeySet.equals( outValSet ));
         assertTrue( inValSet.equals( outKeySet ));
@@ -166,11 +164,11 @@ public class TestMapUtils extends BulkTest {
             fail();
         } catch (NullPointerException ex) {}
 
-        Map test = MapUtils.putAll(new HashMap(), new String[0]);
+        Map<String, String> test = MapUtils.putAll(new HashMap<String, String>(), new String[0]);
         assertEquals(0, test.size());
 
         // sub array
-        test = MapUtils.putAll(new HashMap(), new String[][] {
+        test = MapUtils.putAll(new HashMap<String, String>(), new String[][] {
             {"RED", "#FF0000"},
             {"GREEN", "#00FF00"},
             {"BLUE", "#0000FF"}
@@ -184,7 +182,7 @@ public class TestMapUtils extends BulkTest {
         assertEquals(3, test.size());
 
         try {
-            MapUtils.putAll(new HashMap(), new String[][] {
+            MapUtils.putAll(new HashMap<String, String>(), new String[][] {
                 {"RED", "#FF0000"},
                 null,
                 {"BLUE", "#0000FF"}
@@ -193,7 +191,7 @@ public class TestMapUtils extends BulkTest {
         } catch (IllegalArgumentException ex) {}
 
         try {
-            MapUtils.putAll(new HashMap(), new String[][] {
+            MapUtils.putAll(new HashMap<String, String>(), new String[][] {
                 {"RED", "#FF0000"},
                 {"GREEN"},
                 {"BLUE", "#0000FF"}
@@ -202,7 +200,7 @@ public class TestMapUtils extends BulkTest {
         } catch (IllegalArgumentException ex) {}
 
         try {
-            MapUtils.putAll(new HashMap(), new String[][] {
+            MapUtils.putAll(new HashMap<String, String>(), new String[][] {
                 {"RED", "#FF0000"},
                 {},
                 {"BLUE", "#0000FF"}
@@ -211,7 +209,7 @@ public class TestMapUtils extends BulkTest {
         } catch (IllegalArgumentException ex) {}
 
         // flat array
-        test = MapUtils.putAll(new HashMap(), new String[] {
+        test = MapUtils.putAll(new HashMap<String, String>(), new String[] {
             "RED", "#FF0000",
             "GREEN", "#00FF00",
             "BLUE", "#0000FF"
@@ -224,7 +222,7 @@ public class TestMapUtils extends BulkTest {
         assertEquals("#0000FF", test.get("BLUE"));
         assertEquals(3, test.size());
 
-        test = MapUtils.putAll(new HashMap(), new String[] {
+        test = MapUtils.putAll(new HashMap<String, String>(), new String[] {
             "RED", "#FF0000",
             "GREEN", "#00FF00",
             "BLUE", "#0000FF",
@@ -239,10 +237,10 @@ public class TestMapUtils extends BulkTest {
         assertEquals(3, test.size());
 
         // map entry
-        test = MapUtils.putAll(new HashMap(), new Object[] {
-            new DefaultMapEntry("RED", "#FF0000"),
-            new DefaultMapEntry("GREEN", "#00FF00"),
-            new DefaultMapEntry("BLUE", "#0000FF")
+        test = MapUtils.putAll(new HashMap<String, String>(), new Object[] {
+            new DefaultMapEntry<String, String>("RED", "#FF0000"),
+            new DefaultMapEntry<String, String>("GREEN", "#00FF00"),
+            new DefaultMapEntry<String, String>("BLUE", "#0000FF")
         });
         assertEquals(true, test.containsKey("RED"));
         assertEquals("#FF0000", test.get("RED"));
@@ -253,10 +251,10 @@ public class TestMapUtils extends BulkTest {
         assertEquals(3, test.size());
 
         // key value
-        test = MapUtils.putAll(new HashMap(), new Object[] {
-            new DefaultKeyValue("RED", "#FF0000"),
-            new DefaultKeyValue("GREEN", "#00FF00"),
-            new DefaultKeyValue("BLUE", "#0000FF")
+        test = MapUtils.putAll(new HashMap<String, String>(), new Object[] {
+            new DefaultKeyValue<String, String>("RED", "#FF0000"),
+            new DefaultKeyValue<String, String>("GREEN", "#00FF00"),
+            new DefaultKeyValue<String, String>("BLUE", "#0000FF")
         });
         assertEquals(true, test.containsKey("RED"));
         assertEquals("#FF0000", test.get("RED"));
@@ -268,17 +266,17 @@ public class TestMapUtils extends BulkTest {
     }
 
     public void testConvertResourceBundle() {
-        final Map in = new HashMap( 5 , 1 );
-        in.put( "1" , "A" );
-        in.put( "2" , "B" );
-        in.put( "3" , "C" );
-        in.put( "4" , "D" );
-        in.put( "5" , "E" );
+        final Map<String, String> in = new HashMap<String, String>( 5 , 1 );
+        in.put("1", "A");
+        in.put("2", "B");
+        in.put("3", "C");
+        in.put("4", "D");
+        in.put("5", "E");
 
         ResourceBundle b = new ListResourceBundle() {
             public Object[][] getContents() {
                 final Object[][] contents = new Object[ in.size() ][2];
-                final Iterator i = in.keySet().iterator();
+                final Iterator<String> i = in.keySet().iterator();
                 int n = 0;
                 while ( i.hasNext() ) {
                     final Object key = i.next();
@@ -291,20 +289,19 @@ public class TestMapUtils extends BulkTest {
             }
         };
 
-        final Map out = MapUtils.toMap(b);
+        final Map<String, Object> out = MapUtils.toMap(b);
 
         assertTrue( in.equals(out));
     }
 
     public void testDebugAndVerbosePrintCasting() {
-        final Map inner = new HashMap(2, 1);
-        inner.put( new Integer(2) , "B" );
-        inner.put( new Integer(3) , "C" );
-
-        final Map outer = new HashMap(2, 1);
-        outer.put( new Integer(0) , inner );
-        outer.put( new Integer(1) , "A");
+        final Map<Integer, String> inner = new HashMap<Integer, String>(2, 1);
+        inner.put(2, "B");
+        inner.put(3, "C");
 
+        final Map<Integer, Object> outer = new HashMap<Integer, Object>(2, 1);
+        outer.put(0, inner);
+        outer.put(1, "A");
 
         final ByteArrayOutputStream out = new ByteArrayOutputStream();
         final PrintStream outPrint = new PrintStream(out);
@@ -341,10 +338,10 @@ public class TestMapUtils extends BulkTest {
 
         final String INDENT = "    ";
 
-        final Map map = new TreeMap();  // treeMap guarantees order across JDKs for test
-        map.put( new Integer(2) , "B" );
-        map.put( new Integer(3) , "C" );
-        map.put( new Integer(4) , null );
+        final Map<Integer, String> map = new TreeMap<Integer, String>();  // treeMap guarantees order across JDKs for test
+        map.put(2, "B");
+        map.put(3, "C");
+        map.put(4, null);
 
         outPrint.println("{");
         outPrint.println(INDENT + "2 = B");
@@ -364,10 +361,10 @@ public class TestMapUtils extends BulkTest {
 
         final String INDENT = "    ";
 
-        final Map map = new TreeMap();  // treeMap guarantees order across JDKs for test
-        map.put( new Integer(2) , "B" );
-        map.put( new Integer(3) , "C" );
-        map.put( new Integer(4) , null );
+        final Map<Integer, String> map = new TreeMap<Integer, String>();  // treeMap guarantees order across JDKs for test
+        map.put(2, "B");
+        map.put(3, "C");
+        map.put(4, null);
 
         outPrint.println("{");
         outPrint.println(INDENT + "2 = B " + String.class.getName());
@@ -407,7 +404,7 @@ public class TestMapUtils extends BulkTest {
 
     public void testVerbosePrintNullStream() {
         try {
-            MapUtils.verbosePrint(null, "Map", new HashMap());
+            MapUtils.verbosePrint(null, "Map", new HashMap<Object, Object>());
             fail("Should generate NullPointerException");
         } catch (NullPointerException expected) {
         }
@@ -415,7 +412,7 @@ public class TestMapUtils extends BulkTest {
 
     public void testDebugPrintNullStream() {
         try {
-            MapUtils.debugPrint(null, "Map", new HashMap());
+            MapUtils.debugPrint(null, "Map", new HashMap<Object, Object>());
             fail("Should generate NullPointerException");
         } catch (NullPointerException expected) {
         }
@@ -427,8 +424,8 @@ public class TestMapUtils extends BulkTest {
 
         final String INDENT = "    ";
 
-        final Map map = new HashMap();
-        map.put( null , "A" );
+        final Map<Object, String> map = new HashMap<Object, String>();
+        map.put(null, "A");
 
         outPrint.println("{");
         outPrint.println(INDENT + "null = A " + String.class.getName());
@@ -446,8 +443,8 @@ public class TestMapUtils extends BulkTest {
 
         final String INDENT = "    ";
 
-        final Map map = new HashMap();
-        map.put( null , "A" );
+        final Map<Object, String> map = new HashMap<Object, String>();
+        map.put(null, "A");
 
         outPrint.println("{");
         outPrint.println(INDENT + "null = A");
@@ -465,8 +462,8 @@ public class TestMapUtils extends BulkTest {
 
         final String INDENT = "    ";
 
-        final Map map = new HashMap();
-        map.put( null , map );
+        final Map<Object, Map<?, ?>> map = new HashMap<Object, Map<?, ?>>();
+        map.put(null, map);
 
         outPrint.println("{");
         outPrint.println(INDENT + "null = (this Map) " + HashMap.class.getName());
@@ -484,8 +481,8 @@ public class TestMapUtils extends BulkTest {
 
         final String INDENT = "    ";
 
-        final Map map = new HashMap();
-        map.put( null , map );
+        final Map<Object, Map<?, ?>> map = new HashMap<Object, Map<?, ?>>();
+        map.put(null, map);
 
         outPrint.println("{");
         outPrint.println(INDENT + "null = (this Map)");
@@ -503,10 +500,10 @@ public class TestMapUtils extends BulkTest {
 
         final String INDENT = "    ";
 
-        final Map map = new HashMap();
-        final Map map2= new HashMap();
-        map.put( null , map2 );
-        map2.put( "2", "B" );
+        final Map<Object, Object> map = new HashMap<Object, Object>();
+        final Map<Object, Object> map2= new HashMap<Object, Object>();
+        map.put(null, map2);
+        map2.put("2", "B");
 
         outPrint.println("{");
         outPrint.println(INDENT + "null = ");
@@ -527,10 +524,10 @@ public class TestMapUtils extends BulkTest {
 
         final String INDENT = "    ";
 
-        final Map map = new HashMap();
-        final Map map2= new HashMap();
-        map.put( null , map2 );
-        map2.put( "2", "B" );
+        final Map<Object, Object> map = new HashMap<Object, Object>();
+        final Map<Object, Object> map2= new HashMap<Object, Object>();
+        map.put(null, map2);
+        map2.put("2", "B");
 
         outPrint.println("{");
         outPrint.println(INDENT + "null = ");
@@ -567,14 +564,14 @@ public class TestMapUtils extends BulkTest {
 
         out.reset();
 
-        final Map inner = new TreeMap();  // treeMap guarantees order across JDKs for test
-        inner.put( new Integer(2) , "B" );
-        inner.put( new Integer(3) , "C" );
+        final Map<Integer, String> inner = new TreeMap<Integer, String>();  // treeMap guarantees order across JDKs for test
+        inner.put(2, "B");
+        inner.put(3, "C");
 
-        final Map outer = new TreeMap();
-        outer.put( new Integer(1) , inner );
-        outer.put( new Integer(0) , "A");
-        outer.put( new Integer(7) , outer);
+        final Map<Integer, Object> outer = new TreeMap<Integer, Object>();
+        outer.put(1, inner);
+        outer.put(0, "A");
+        outer.put(7, outer);
 
         MapUtils.verbosePrint(outPrint, "Print Map", outer);
         assertEquals(EXPECTED_OUT, out.toString());
@@ -602,14 +599,14 @@ public class TestMapUtils extends BulkTest {
 
         out.reset();
 
-        final Map inner = new TreeMap();  // treeMap guarantees order across JDKs for test
-        inner.put( new Integer(2) , "B" );
-        inner.put( new Integer(3) , "C" );
+        final Map<Integer, String> inner = new TreeMap<Integer, String>();  // treeMap guarantees order across JDKs for test
+        inner.put(2, "B");
+        inner.put(3, "C");
 
-        final Map outer = new TreeMap();
-        outer.put( new Integer(1) , inner );
-        outer.put( new Integer(0) , "A");
-        outer.put( new Integer(7) , outer);
+        final Map<Integer, Object> outer = new TreeMap<Integer, Object>();
+        outer.put(1, inner);
+        outer.put(0, "A");
+        outer.put(7, outer);
 
         MapUtils.debugPrint(outPrint, "Print Map", outer);
         assertEquals(EXPECTED_OUT, out.toString());
@@ -622,21 +619,20 @@ public class TestMapUtils extends BulkTest {
         final String LABEL = "Print Map";
         final String INDENT = "    ";
 
+        final Map<Integer, Object> grandfather = new TreeMap<Integer, Object>();// treeMap guarantees order across JDKs for test
+        final Map<Integer, Object> father = new TreeMap<Integer, Object>();
+        final Map<Integer, Object> son    = new TreeMap<Integer, Object>();
 
-        final Map grandfather = new TreeMap();// treeMap guarantees order across JDKs for test
-        final Map father = new TreeMap();
-        final Map son    = new TreeMap();
+        grandfather.put(0, "A");
+        grandfather.put(1, father);
 
-        grandfather.put( new Integer(0), "A" );
-        grandfather.put( new Integer(1), father );
+        father.put(2, "B");
+        father.put(3, grandfather);
+        father.put(4, son);
 
-        father.put( new Integer(2), "B" );
-        father.put( new Integer(3), grandfather);
-        father.put( new Integer(4), son);
-
-        son.put( new Integer(5), "C");
-        son.put( new Integer(6), grandfather);
-        son.put( new Integer(7), father);
+        son.put(5, "C");
+        son.put(6, grandfather);
+        son.put(7, father);
 
         outPrint.println(LABEL + " = ");
         outPrint.println("{");
@@ -669,21 +665,20 @@ public class TestMapUtils extends BulkTest {
         final String LABEL = "Print Map";
         final String INDENT = "    ";
 
+        final Map<Integer, Object> grandfather = new TreeMap<Integer, Object>();// treeMap guarantees order across JDKs for test
+        final Map<Integer, Object> father = new TreeMap<Integer, Object>();
+        final Map<Integer, Object> son    = new TreeMap<Integer, Object>();
 
-        final Map grandfather = new TreeMap();// treeMap guarantees order across JDKs for test
-        final Map father = new TreeMap();
-        final Map son    = new TreeMap();
-
-        grandfather.put( new Integer(0), "A" );
-        grandfather.put( new Integer(1), father );
+        grandfather.put(0, "A");
+        grandfather.put(1, father);
 
-        father.put( new Integer(2), "B" );
-        father.put( new Integer(3), grandfather);
-        father.put( new Integer(4), son);
+        father.put(2, "B");
+        father.put(3, grandfather);
+        father.put(4, son);
 
-        son.put( new Integer(5), "C");
-        son.put( new Integer(6), grandfather);
-        son.put( new Integer(7), father);
+        son.put(5, "C");
+        son.put(6, grandfather);
+        son.put(7, father);
 
         outPrint.println(LABEL + " = ");
         outPrint.println("{");
@@ -711,34 +706,34 @@ public class TestMapUtils extends BulkTest {
 
     //-----------------------------------------------------------------------
     public void testIsEmptyWithEmptyMap() {
-        Map map = new HashMap();
+        Map<Object, Object> map = new HashMap<Object, Object>();
         assertEquals(true, MapUtils.isEmpty(map));
     }
 
     public void testIsEmptyWithNonEmptyMap() {
-        Map map = new HashMap();
+        Map<String, String> map = new HashMap<String, String>();
         map.put("item", "value");
         assertEquals(false, MapUtils.isEmpty(map));
     }
 
     public void testIsEmptyWithNull() {
-        Map map = null;
+        Map<Object, Object> map = null;
         assertEquals(true, MapUtils.isEmpty(map));
     }
 
     public void testIsNotEmptyWithEmptyMap() {
-        Map map = new HashMap();
+        Map<Object, Object> map = new HashMap<Object, Object>();
         assertEquals(false, MapUtils.isNotEmpty(map));
     }
 
     public void testIsNotEmptyWithNonEmptyMap() {
-        Map map = new HashMap();
+        Map<String, String> map = new HashMap<String, String>();
         map.put("item", "value");
         assertEquals(true, MapUtils.isNotEmpty(map));
     }
 
     public void testIsNotEmptyWithNull() {
-        Map map = null;
+        Map<Object, Object> map = null;
         assertEquals(false, MapUtils.isNotEmpty(map));
     }
 


[24/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/keyvalue/TiedMapEntry.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/keyvalue/TiedMapEntry.java b/src/java/org/apache/commons/collections/keyvalue/TiedMapEntry.java
index a793824..46d2083 100644
--- a/src/java/org/apache/commons/collections/keyvalue/TiedMapEntry.java
+++ b/src/java/org/apache/commons/collections/keyvalue/TiedMapEntry.java
@@ -32,15 +32,16 @@ import org.apache.commons.collections.KeyValue;
  * 
  * @author Stephen Colebourne
  */
-public class TiedMapEntry implements Map.Entry, KeyValue, Serializable {
+public class TiedMapEntry<K, V> implements Map.Entry<K, V>, KeyValue<K, V>, Serializable {
 
     /** Serialization version */    
     private static final long serialVersionUID = -8453869361373831205L;
 
     /** The map underlying the entry/iterator */    
-    private final Map map;
+    private final Map<K, V> map;
+
     /** The key */
-    private final Object key;
+    private final K key;
 
     /**
      * Constructs a new entry with the given Map and key.
@@ -48,7 +49,7 @@ public class TiedMapEntry implements Map.Entry, KeyValue, Serializable {
      * @param map  the map
      * @param key  the key
      */
-    public TiedMapEntry(Map map, Object key) {
+    public TiedMapEntry(Map<K, V> map, K key) {
         super();
         this.map = map;
         this.key = key;
@@ -61,7 +62,7 @@ public class TiedMapEntry implements Map.Entry, KeyValue, Serializable {
      * 
      * @return the key
      */
-    public Object getKey() {
+    public K getKey() {
         return key;
     }
 
@@ -70,7 +71,7 @@ public class TiedMapEntry implements Map.Entry, KeyValue, Serializable {
      * 
      * @return the value
      */
-    public Object getValue() {
+    public V getValue() {
         return map.get(key);
     }
 
@@ -81,7 +82,7 @@ public class TiedMapEntry implements Map.Entry, KeyValue, Serializable {
      * @return the old value
      * @throws IllegalArgumentException if the value is set to this map entry
      */
-    public Object setValue(Object value) {
+    public V setValue(V value) {
         if (value == this) {
             throw new IllegalArgumentException("Cannot set value to this map entry");
         }
@@ -96,6 +97,7 @@ public class TiedMapEntry implements Map.Entry, KeyValue, Serializable {
      * @param obj  the object to compare to
      * @return true if equal key and value
      */
+    @SuppressWarnings("unchecked")
     public boolean equals(Object obj) {
         if (obj == this) {
             return true;

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/keyvalue/UnmodifiableMapEntry.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/keyvalue/UnmodifiableMapEntry.java b/src/java/org/apache/commons/collections/keyvalue/UnmodifiableMapEntry.java
index 047967e..c316bbc 100644
--- a/src/java/org/apache/commons/collections/keyvalue/UnmodifiableMapEntry.java
+++ b/src/java/org/apache/commons/collections/keyvalue/UnmodifiableMapEntry.java
@@ -30,7 +30,7 @@ import org.apache.commons.collections.Unmodifiable;
  * 
  * @author Stephen Colebourne
  */
-public final class UnmodifiableMapEntry extends AbstractMapEntry implements Unmodifiable {
+public final class UnmodifiableMapEntry<K, V> extends AbstractMapEntry<K, V> implements Unmodifiable {
 
     /**
      * Constructs a new entry with the specified key and given value.
@@ -38,7 +38,7 @@ public final class UnmodifiableMapEntry extends AbstractMapEntry implements Unmo
      * @param key  the key for the entry, may be null
      * @param value  the value for the entry, may be null
      */
-    public UnmodifiableMapEntry(final Object key, final Object value) {
+    public UnmodifiableMapEntry(final K key, final V value) {
         super(key, value);
     }
 
@@ -48,7 +48,7 @@ public final class UnmodifiableMapEntry extends AbstractMapEntry implements Unmo
      * @param pair  the pair to copy, must not be null
      * @throws NullPointerException if the entry is null
      */
-    public UnmodifiableMapEntry(final KeyValue pair) {
+    public UnmodifiableMapEntry(final KeyValue<K, V> pair) {
         super(pair.getKey(), pair.getValue());
     }
 
@@ -58,7 +58,7 @@ public final class UnmodifiableMapEntry extends AbstractMapEntry implements Unmo
      * @param entry  the entry to copy, must not be null
      * @throws NullPointerException if the entry is null
      */
-    public UnmodifiableMapEntry(final Map.Entry entry) {
+    public UnmodifiableMapEntry(final Map.Entry<K, V> entry) {
         super(entry.getKey(), entry.getValue());
     }
 
@@ -69,7 +69,7 @@ public final class UnmodifiableMapEntry extends AbstractMapEntry implements Unmo
      * @return the previous value
      * @throws UnsupportedOperationException always
      */
-    public Object setValue(Object value) {
+    public V setValue(V value) {
         throw new UnsupportedOperationException("setValue() is not supported");
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/list/AbstractLinkedList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/AbstractLinkedList.java b/src/java/org/apache/commons/collections/list/AbstractLinkedList.java
index 04c7357..738871e 100644
--- a/src/java/org/apache/commons/collections/list/AbstractLinkedList.java
+++ b/src/java/org/apache/commons/collections/list/AbstractLinkedList.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.
@@ -37,7 +37,7 @@ import org.apache.commons.collections.OrderedIterator;
  * Overridable methods are provided to change the storage node and to change how
  * nodes are added to and removed. Hopefully, all you need for unusual subclasses
  * is here.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
@@ -45,7 +45,7 @@ import org.apache.commons.collections.OrderedIterator;
  * @author Phil Steitz
  * @author Stephen Colebourne
  */
-public abstract class AbstractLinkedList implements List {
+public abstract class AbstractLinkedList<E> implements List<E> {
 
     /*
      * Implementation notes:
@@ -63,9 +63,11 @@ public abstract class AbstractLinkedList implements List {
      * hold a value. The value of <code>next</code> is the first item in the
      * list. The value of of <code>previous</code> is the last item in the list.
      */
-    protected transient Node header;
+    protected transient Node<E> header;
+
     /** The size of the list */
     protected transient int size;
+
     /** Modification count for iterators */
     protected transient int modCount;
 
@@ -81,10 +83,10 @@ public abstract class AbstractLinkedList implements List {
 
     /**
      * Constructs a list copying data from the specified collection.
-     * 
+     *
      * @param coll  the collection to copy
      */
-    protected AbstractLinkedList(Collection coll) {
+    protected AbstractLinkedList(Collection<? extends E> coll) {
         super();
         init();
         addAll(coll);
@@ -109,28 +111,28 @@ public abstract class AbstractLinkedList implements List {
         return (size() == 0);
     }
 
-    public Object get(int index) {
-        Node node = getNode(index, false);
+    public E get(int index) {
+        Node<E> node = getNode(index, false);
         return node.getValue();
     }
 
     //-----------------------------------------------------------------------
-    public Iterator iterator() {
+    public Iterator<E> iterator() {
         return listIterator();
     }
 
-    public ListIterator listIterator() {
-        return new LinkedListIterator(this, 0);
+    public ListIterator<E> listIterator() {
+        return new LinkedListIterator<E>(this, 0);
     }
 
-    public ListIterator listIterator(int fromIndex) {
-        return new LinkedListIterator(this, fromIndex);
+    public ListIterator<E> listIterator(int fromIndex) {
+        return new LinkedListIterator<E>(this, fromIndex);
     }
 
     //-----------------------------------------------------------------------
     public int indexOf(Object value) {
         int i = 0;
-        for (Node node = header.next; node != header; node = node.next) {
+        for (Node<E> node = header.next; node != header; node = node.next) {
             if (isEqualValue(node.getValue(), value)) {
                 return i;
             }
@@ -141,7 +143,7 @@ public abstract class AbstractLinkedList implements List {
 
     public int lastIndexOf(Object value) {
         int i = size - 1;
-        for (Node node = header.previous; node != header; node = node.previous) {
+        for (Node<E> node = header.previous; node != header; node = node.previous) {
             if (isEqualValue(node.getValue(), value)) {
                 return i;
             }
@@ -154,31 +156,31 @@ public abstract class AbstractLinkedList implements List {
         return indexOf(value) != -1;
     }
 
-    public boolean containsAll(Collection coll) {
-        Iterator it = coll.iterator();
-        while (it.hasNext()) {
-            if (contains(it.next()) == false) {
+    public boolean containsAll(Collection<?> coll) {
+        for (Object o : coll) {
+            if (!contains(o)) {
                 return false;
             }
         }
         return true;
     }
-    
+
     //-----------------------------------------------------------------------
     public Object[] toArray() {
         return toArray(new Object[size]);
     }
 
-    public Object[] toArray(Object[] array) {
+    @SuppressWarnings("unchecked")
+    public <T> T[] toArray(T[] array) {
         // Extend the array if needed
         if (array.length < size) {
             Class componentType = array.getClass().getComponentType();
-            array = (Object[]) Array.newInstance(componentType, size);
+            array = (T[]) Array.newInstance(componentType, size);
         }
         // Copy the values into the array
         int i = 0;
-        for (Node node = header.next; node != header; node = node.next, i++) {
-            array[i] = node.getValue();
+        for (Node<E> node = header.next; node != header; node = node.next, i++) {
+            array[i] = (T) node.getValue();
         }
         // Set the value after the last value to null
         if (array.length > size) {
@@ -189,49 +191,48 @@ public abstract class AbstractLinkedList implements List {
 
     /**
      * Gets a sublist of the main list.
-     * 
+     *
      * @param fromIndexInclusive  the index to start from
      * @param toIndexExclusive  the index to end at
      * @return the new sublist
      */
-    public List subList(int fromIndexInclusive, int toIndexExclusive) {
-        return new LinkedSubList(this, fromIndexInclusive, toIndexExclusive);
+    public List<E> subList(int fromIndexInclusive, int toIndexExclusive) {
+        return new LinkedSubList<E>(this, fromIndexInclusive, toIndexExclusive);
     }
-    
+
     //-----------------------------------------------------------------------
-    public boolean add(Object value) {
+    public boolean add(E value) {
         addLast(value);
         return true;
     }
-    
-    public void add(int index, Object value) {
-        Node node = getNode(index, true);
+
+    public void add(int index, E value) {
+        Node<E> node = getNode(index, true);
         addNodeBefore(node, value);
     }
-    
-    public boolean addAll(Collection coll) {
+
+    public boolean addAll(Collection<? extends E> coll) {
         return addAll(size, coll);
     }
 
-    public boolean addAll(int index, Collection coll) {
-        Node node = getNode(index, true);
-        for (Iterator itr = coll.iterator(); itr.hasNext();) {
-            Object value = itr.next();
-            addNodeBefore(node, value);
+    public boolean addAll(int index, Collection<? extends E> coll) {
+        Node<E> node = getNode(index, true);
+        for (E e : coll) {
+            addNodeBefore(node, e);
         }
         return true;
     }
 
     //-----------------------------------------------------------------------
-    public Object remove(int index) {
-        Node node = getNode(index, false);
-        Object oldValue = node.getValue();
+    public E remove(int index) {
+        Node<E> node = getNode(index, false);
+        E oldValue = node.getValue();
         removeNode(node);
         return oldValue;
     }
 
     public boolean remove(Object value) {
-        for (Node node = header.next; node != header; node = node.next) {
+        for (Node<E> node = header.next; node != header; node = node.next) {
             if (isEqualValue(node.getValue(), value)) {
                 removeNode(node);
                 return true;
@@ -240,9 +241,9 @@ public abstract class AbstractLinkedList implements List {
         return false;
     }
 
-    public boolean removeAll(Collection coll) {
+    public boolean removeAll(Collection<?> coll) {
         boolean modified = false;
-        Iterator it = iterator();
+        Iterator<E> it = iterator();
         while (it.hasNext()) {
             if (coll.contains(it.next())) {
                 it.remove();
@@ -253,9 +254,9 @@ public abstract class AbstractLinkedList implements List {
     }
 
     //-----------------------------------------------------------------------
-    public boolean retainAll(Collection coll) {
+    public boolean retainAll(Collection<?> coll) {
         boolean modified = false;
-        Iterator it = iterator();
+        Iterator<E> it = iterator();
         while (it.hasNext()) {
             if (coll.contains(it.next()) == false) {
                 it.remove();
@@ -265,9 +266,9 @@ public abstract class AbstractLinkedList implements List {
         return modified;
     }
 
-    public Object set(int index, Object value) {
-        Node node = getNode(index, false);
-        Object oldValue = node.getValue();
+    public E set(int index, E value) {
+        Node<E> node = getNode(index, false);
+        E oldValue = node.getValue();
         updateNode(node, value);
         return oldValue;
     }
@@ -275,55 +276,56 @@ public abstract class AbstractLinkedList implements List {
     public void clear() {
         removeAllNodes();
     }
-    
+
     //-----------------------------------------------------------------------
-    public Object getFirst() {
-        Node node = header.next;
+    public E getFirst() {
+        Node<E> node = header.next;
         if (node == header) {
             throw new NoSuchElementException();
         }
         return node.getValue();
     }
 
-    public Object getLast() {
-        Node node = header.previous;
+    public E getLast() {
+        Node<E> node = header.previous;
         if (node == header) {
             throw new NoSuchElementException();
         }
         return node.getValue();
     }
 
-    public boolean addFirst(Object o) {
+    public boolean addFirst(E o) {
         addNodeAfter(header, o);
         return true;
     }
 
-    public boolean addLast(Object o) {
+    public boolean addLast(E o) {
         addNodeBefore(header, o);
         return true;
     }
 
-    public Object removeFirst() {
-        Node node = header.next;
+    public E removeFirst() {
+        Node<E> node = header.next;
         if (node == header) {
             throw new NoSuchElementException();
         }
-        Object oldValue = node.getValue();
+        E oldValue = node.getValue();
         removeNode(node);
         return oldValue;
     }
 
-    public Object removeLast() {
-        Node node = header.previous;
+    public E removeLast() {
+        Node<E> node = header.previous;
         if (node == header) {
             throw new NoSuchElementException();
         }
-        Object oldValue = node.getValue();
+        E oldValue = node.getValue();
         removeNode(node);
         return oldValue;
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
     public boolean equals(Object obj) {
         if (obj == this) {
             return true;
@@ -348,10 +350,8 @@ public abstract class AbstractLinkedList implements List {
 
     public int hashCode() {
         int hashCode = 1;
-        Iterator it = iterator();
-        while (it.hasNext()) {
-            Object obj = it.next();
-            hashCode = 31 * hashCode + (obj == null ? 0 : obj.hashCode());
+        for (E e : this) {
+            hashCode = 31 * hashCode + (e == null ? 0 : e.hashCode());
         }
         return hashCode;
     }
@@ -363,7 +363,7 @@ public abstract class AbstractLinkedList implements List {
         StringBuffer buf = new StringBuffer(16 * size());
         buf.append("[");
 
-        Iterator it = iterator();
+        Iterator<E> it = iterator();
         boolean hasNext = it.hasNext();
         while (hasNext) {
             Object value = it.next();
@@ -382,7 +382,7 @@ public abstract class AbstractLinkedList implements List {
      * Compares two values for equals.
      * This implementation uses the equals method.
      * Subclasses can override this to match differently.
-     * 
+     *
      * @param value1  the first value to compare, may be null
      * @param value2  the second value to compare, may be null
      * @return true if equal
@@ -390,16 +390,16 @@ public abstract class AbstractLinkedList implements List {
     protected boolean isEqualValue(Object value1, Object value2) {
         return (value1 == value2 || (value1 == null ? false : value1.equals(value2)));
     }
-    
+
     /**
      * Updates the node with a new value.
      * This implementation sets the value on the node.
      * Subclasses can override this to record the change.
-     * 
+     *
      * @param node  node to update
      * @param value  new value of the node
      */
-    protected void updateNode(Node node, Object value) {
+    protected void updateNode(Node<E> node, E value) {
         node.setValue(value);
     }
 
@@ -407,26 +407,26 @@ public abstract class AbstractLinkedList implements List {
      * Creates a new node with previous, next and element all set to null.
      * This implementation creates a new empty Node.
      * Subclasses can override this to create a different class.
-     * 
+     *
      * @return  newly created node
      */
-    protected Node createHeaderNode() {
-        return new Node();
+    protected Node<E> createHeaderNode() {
+        return new Node<E>();
     }
 
     /**
      * Creates a new node with the specified properties.
      * This implementation creates a new Node with data.
      * Subclasses can override this to create a different class.
-     * 
+     *
      * @param value  value of the new node
      */
-    protected Node createNode(Object value) {
-        return new Node(value);
+    protected Node<E> createNode(E value) {
+        return new Node<E>(value);
     }
 
     /**
-     * Creates a new node with the specified object as its 
+     * Creates a new node with the specified object as its
      * <code>value</code> and inserts it before <code>node</code>.
      * <p>
      * This implementation uses {@link #createNode(Object)} and
@@ -436,24 +436,24 @@ public abstract class AbstractLinkedList implements List {
      * @param value  value of the newly added node
      * @throws NullPointerException if <code>node</code> is null
      */
-    protected void addNodeBefore(Node node, Object value) {
-        Node newNode = createNode(value);
+    protected void addNodeBefore(Node<E> node, E value) {
+        Node<E> newNode = createNode(value);
         addNode(newNode, node);
     }
 
     /**
-     * Creates a new node with the specified object as its 
+     * Creates a new node with the specified object as its
      * <code>value</code> and inserts it after <code>node</code>.
      * <p>
      * This implementation uses {@link #createNode(Object)} and
      * {@link #addNode(AbstractLinkedList.Node,AbstractLinkedList.Node)}.
-     * 
+     *
      * @param node  node to insert after
      * @param value  value of the newly added node
      * @throws NullPointerException if <code>node</code> is null
      */
-    protected void addNodeAfter(Node node, Object value) {
-        Node newNode = createNode(value);
+    protected void addNodeAfter(Node<E> node, E value) {
+        Node<E> newNode = createNode(value);
         addNode(newNode, node.next);
     }
 
@@ -464,7 +464,7 @@ public abstract class AbstractLinkedList implements List {
      * @param insertBeforeNode  node to insert before
      * @throws NullPointerException if either node is null
      */
-    protected void addNode(Node nodeToInsert, Node insertBeforeNode) {
+    protected void addNode(Node<E> nodeToInsert, Node<E> insertBeforeNode) {
         nodeToInsert.next = insertBeforeNode;
         nodeToInsert.previous = insertBeforeNode.previous;
         insertBeforeNode.previous.next = nodeToInsert;
@@ -479,7 +479,7 @@ public abstract class AbstractLinkedList implements List {
      * @param node  the node to remove
      * @throws NullPointerException if <code>node</code> is null
      */
-    protected void removeNode(Node node) {
+    protected void removeNode(Node<E> node) {
         node.previous.next = node.next;
         node.next.previous = node.previous;
         size--;
@@ -498,7 +498,7 @@ public abstract class AbstractLinkedList implements List {
 
     /**
      * Gets the node at a particular index.
-     * 
+     *
      * @param index  the index, starting from 0
      * @param endMarkerAllowed  whether or not the end marker can be returned if
      * startIndex is set to the list's size
@@ -506,7 +506,7 @@ public abstract class AbstractLinkedList implements List {
      * the size of the list and endMakerAllowed is false; or greater than the
      * size of the list
      */
-    protected Node getNode(int index, boolean endMarkerAllowed) throws IndexOutOfBoundsException {
+    protected Node<E> getNode(int index, boolean endMarkerAllowed) throws IndexOutOfBoundsException {
         // Check the index is within the bounds
         if (index < 0) {
             throw new IndexOutOfBoundsException("Couldn't get the node: " +
@@ -522,7 +522,7 @@ public abstract class AbstractLinkedList implements List {
                     "list (" + size + ").");
         }
         // Search the list and get the node
-        Node node;
+        Node<E> node;
         if (index < (size / 2)) {
             // Search forwards
             node = header.next;
@@ -542,21 +542,21 @@ public abstract class AbstractLinkedList implements List {
     //-----------------------------------------------------------------------
     /**
      * Creates an iterator for the sublist.
-     * 
+     *
      * @param subList  the sublist to get an iterator for
      */
-    protected Iterator createSubListIterator(LinkedSubList subList) {
+    protected Iterator<E> createSubListIterator(LinkedSubList<E> subList) {
         return createSubListListIterator(subList, 0);
     }
 
     /**
      * Creates a list iterator for the sublist.
-     * 
+     *
      * @param subList  the sublist to get an iterator for
      * @param fromIndex  the index to start from, relative to the sublist
      */
-    protected ListIterator createSubListListIterator(LinkedSubList subList, int fromIndex) {
-        return new LinkedSubListIterator(subList, fromIndex);
+    protected ListIterator<E> createSubListListIterator(LinkedSubList<E> subList, int fromIndex) {
+        return new LinkedSubListIterator<E>(subList, fromIndex);
     }
 
     //-----------------------------------------------------------------------
@@ -569,7 +569,7 @@ public abstract class AbstractLinkedList implements List {
     protected void doWriteObject(ObjectOutputStream outputStream) throws IOException {
         // Write the size so we know how many nodes to read back
         outputStream.writeInt(size());
-        for (Iterator itr = iterator(); itr.hasNext();) {
+        for (Iterator<E> itr = iterator(); itr.hasNext();) {
             outputStream.writeObject(itr.next());
         }
     }
@@ -580,11 +580,12 @@ public abstract class AbstractLinkedList implements List {
      * The first serializable subclass must call this method from
      * <code>readObject</code>.
      */
+    @SuppressWarnings("unchecked")
     protected void doReadObject(ObjectInputStream inputStream) throws IOException, ClassNotFoundException {
         init();
         int size = inputStream.readInt();
         for (int i = 0; i < size; i++) {
-            add(inputStream.readObject());
+            add((E) inputStream.readObject());
         }
     }
 
@@ -595,14 +596,14 @@ public abstract class AbstractLinkedList implements List {
      * From Commons Collections 3.1, all access to the <code>value</code> property
      * is via the methods on this class.
      */
-    protected static class Node {
+    protected static class Node<E> {
 
         /** A pointer to the node before this node */
-        protected Node previous;
+        protected Node<E> previous;
         /** A pointer to the node after this node */
-        protected Node next;
+        protected Node<E> next;
         /** The object contained within this node */
-        protected Object value;
+        protected E value;
 
         /**
          * Constructs a new header node.
@@ -615,85 +616,85 @@ public abstract class AbstractLinkedList implements List {
 
         /**
          * Constructs a new node.
-         * 
+         *
          * @param value  the value to store
          */
-        protected Node(Object value) {
+        protected Node(E value) {
             super();
             this.value = value;
         }
-        
+
         /**
          * Constructs a new node.
-         * 
+         *
          * @param previous  the previous node in the list
          * @param next  the next node in the list
          * @param value  the value to store
          */
-        protected Node(Node previous, Node next, Object value) {
+        protected Node(Node<E> previous, Node<E> next, E value) {
             super();
             this.previous = previous;
             this.next = next;
             this.value = value;
         }
-        
+
         /**
          * Gets the value of the node.
-         * 
+         *
          * @return the value
          * @since Commons Collections 3.1
          */
-        protected Object getValue() {
+        protected E getValue() {
             return value;
         }
-        
+
         /**
          * Sets the value of the node.
-         * 
+         *
          * @param value  the value
          * @since Commons Collections 3.1
          */
-        protected void setValue(Object value) {
+        protected void setValue(E value) {
             this.value = value;
         }
-        
+
         /**
          * Gets the previous node.
-         * 
+         *
          * @return the previous node
          * @since Commons Collections 3.1
          */
-        protected Node getPreviousNode() {
+        protected Node<E> getPreviousNode() {
             return previous;
         }
-        
+
         /**
          * Sets the previous node.
-         * 
+         *
          * @param previous  the previous node
          * @since Commons Collections 3.1
          */
-        protected void setPreviousNode(Node previous) {
+        protected void setPreviousNode(Node<E> previous) {
             this.previous = previous;
         }
-        
+
         /**
          * Gets the next node.
-         * 
+         *
          * @return the next node
          * @since Commons Collections 3.1
          */
-        protected Node getNextNode() {
+        protected Node<E> getNextNode() {
             return next;
         }
-        
+
         /**
          * Sets the next node.
-         * 
+         *
          * @param next  the next node
          * @since Commons Collections 3.1
          */
-        protected void setNextNode(Node next) {
+        protected void setNextNode(Node<E> next) {
             this.next = next;
         }
     }
@@ -702,16 +703,16 @@ public abstract class AbstractLinkedList implements List {
     /**
      * A list iterator over the linked list.
      */
-    protected static class LinkedListIterator implements ListIterator, OrderedIterator {
-        
+    protected static class LinkedListIterator<E> implements ListIterator<E>, OrderedIterator<E> {
+
         /** The parent list */
-        protected final AbstractLinkedList parent;
+        protected final AbstractLinkedList<E> parent;
 
         /**
          * The node that will be returned by {@link #next()}. If this is equal
          * to {@link AbstractLinkedList#header} then there are no more values to return.
          */
-        protected Node next;
+        protected Node<E> next;
 
         /**
          * The index of {@link #next}.
@@ -726,7 +727,7 @@ public abstract class AbstractLinkedList implements List {
          * Should be accessed through {@link #getLastNodeReturned()} to enforce
          * this behaviour.
          */
-        protected Node current;
+        protected Node<E> current;
 
         /**
          * The modification count that the list is expected to have. If the list
@@ -738,11 +739,11 @@ public abstract class AbstractLinkedList implements List {
 
         /**
          * Create a ListIterator for a list.
-         * 
+         *
          * @param parent  the parent list
          * @param fromIndex  the index to start at
          */
-        protected LinkedListIterator(AbstractLinkedList parent, int fromIndex) throws IndexOutOfBoundsException {
+        protected LinkedListIterator(AbstractLinkedList<E> parent, int fromIndex) throws IndexOutOfBoundsException {
             super();
             this.parent = parent;
             this.expectedModCount = parent.modCount;
@@ -753,7 +754,7 @@ public abstract class AbstractLinkedList implements List {
         /**
          * Checks the modification count of the list is the value that this
          * object expects.
-         * 
+         *
          * @throws ConcurrentModificationException If the list's modification
          * count isn't the value that was expected.
          */
@@ -765,12 +766,12 @@ public abstract class AbstractLinkedList implements List {
 
         /**
          * Gets the last node returned.
-         * 
+         *
          * @throws IllegalStateException If {@link #next()} or
          * {@link #previous()} haven't been called, or if the node has been removed
          * with {@link #remove()} or a new node added with {@link #add(Object)}.
          */
-        protected Node getLastNodeReturned() throws IllegalStateException {
+        protected Node<E> getLastNodeReturned() throws IllegalStateException {
             if (current == null) {
                 throw new IllegalStateException();
             }
@@ -781,12 +782,12 @@ public abstract class AbstractLinkedList implements List {
             return next != parent.header;
         }
 
-        public Object next() {
+        public E next() {
             checkModCount();
             if (!hasNext()) {
                 throw new NoSuchElementException("No element at index " + nextIndex + ".");
             }
-            Object value = next.getValue();
+            E value = next.getValue();
             current = next;
             next = next.next;
             nextIndex++;
@@ -797,13 +798,13 @@ public abstract class AbstractLinkedList implements List {
             return next.previous != parent.header;
         }
 
-        public Object previous() {
+        public E previous() {
             checkModCount();
             if (!hasPrevious()) {
                 throw new NoSuchElementException("Already at start of list.");
             }
             next = next.previous;
-            Object value = next.getValue();
+            E value = next.getValue();
             current = next;
             nextIndex--;
             return value;
@@ -833,12 +834,12 @@ public abstract class AbstractLinkedList implements List {
             expectedModCount++;
         }
 
-        public void set(Object obj) {
+        public void set(E obj) {
             checkModCount();
             getLastNodeReturned().setValue(obj);
         }
 
-        public void add(Object obj) {
+        public void add(E obj) {
             checkModCount();
             parent.addNodeBefore(next, obj);
             current = null;
@@ -852,12 +853,12 @@ public abstract class AbstractLinkedList implements List {
     /**
      * A list iterator over the linked sub list.
      */
-    protected static class LinkedSubListIterator extends LinkedListIterator {
-        
+    protected static class LinkedSubListIterator<E> extends LinkedListIterator<E> {
+
         /** The parent list */
-        protected final LinkedSubList sub;
-        
-        protected LinkedSubListIterator(LinkedSubList sub, int startIndex) {
+        protected final LinkedSubList<E> sub;
+
+        protected LinkedSubListIterator(LinkedSubList<E> sub, int startIndex) {
             super(sub.parent, startIndex + sub.offset);
             this.sub = sub;
         }
@@ -874,26 +875,26 @@ public abstract class AbstractLinkedList implements List {
             return (super.nextIndex() - sub.offset);
         }
 
-        public void add(Object obj) {
+        public void add(E obj) {
             super.add(obj);
             sub.expectedModCount = parent.modCount;
             sub.size++;
         }
-        
+
         public void remove() {
             super.remove();
             sub.expectedModCount = parent.modCount;
             sub.size--;
         }
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * The sublist implementation for AbstractLinkedList.
      */
-    protected static class LinkedSubList extends AbstractList {
+    protected static class LinkedSubList<E> extends AbstractList<E> {
         /** The main list */
-        AbstractLinkedList parent;
+        AbstractLinkedList<E> parent;
         /** Offset from the main list */
         int offset;
         /** Sublist size */
@@ -901,7 +902,7 @@ public abstract class AbstractLinkedList implements List {
         /** Sublist modCount */
         int expectedModCount;
 
-        protected LinkedSubList(AbstractLinkedList parent, int fromIndex, int toIndex) {
+        protected LinkedSubList(AbstractLinkedList<E> parent, int fromIndex, int toIndex) {
             if (fromIndex < 0) {
                 throw new IndexOutOfBoundsException("fromIndex = " + fromIndex);
             }
@@ -922,13 +923,13 @@ public abstract class AbstractLinkedList implements List {
             return size;
         }
 
-        public Object get(int index) {
+        public E get(int index) {
             rangeCheck(index, size);
             checkModCount();
             return parent.get(index + offset);
         }
 
-        public void add(int index, Object obj) {
+        public void add(int index, E obj) {
             rangeCheck(index, size + 1);
             checkModCount();
             parent.add(index + offset, obj);
@@ -937,21 +938,21 @@ public abstract class AbstractLinkedList implements List {
             LinkedSubList.this.modCount++;
         }
 
-        public Object remove(int index) {
+        public E remove(int index) {
             rangeCheck(index, size);
             checkModCount();
-            Object result = parent.remove(index + offset);
+            E result = parent.remove(index + offset);
             expectedModCount = parent.modCount;
             size--;
             LinkedSubList.this.modCount++;
             return result;
         }
 
-        public boolean addAll(Collection coll) {
+        public boolean addAll(Collection<? extends E> coll) {
             return addAll(size, coll);
         }
 
-        public boolean addAll(int index, Collection coll) {
+        public boolean addAll(int index, Collection<? extends E> coll) {
             rangeCheck(index, size + 1);
             int cSize = coll.size();
             if (cSize == 0) {
@@ -966,7 +967,7 @@ public abstract class AbstractLinkedList implements List {
             return true;
         }
 
-        public Object set(int index, Object obj) {
+        public E set(int index, E obj) {
             rangeCheck(index, size);
             checkModCount();
             return parent.set(index + offset, obj);
@@ -974,26 +975,26 @@ public abstract class AbstractLinkedList implements List {
 
         public void clear() {
             checkModCount();
-            Iterator it = iterator();
+            Iterator<E> it = iterator();
             while (it.hasNext()) {
                 it.next();
                 it.remove();
             }
         }
 
-        public Iterator iterator() {
+        public Iterator<E> iterator() {
             checkModCount();
             return parent.createSubListIterator(this);
         }
 
-        public ListIterator listIterator(final int index) {
+        public ListIterator<E> listIterator(final int index) {
             rangeCheck(index, size + 1);
             checkModCount();
             return parent.createSubListListIterator(this, index);
         }
 
-        public List subList(int fromIndexInclusive, int toIndexExclusive) {
-            return new LinkedSubList(parent, fromIndexInclusive + offset, toIndexExclusive + offset);
+        public List<E> subList(int fromIndexInclusive, int toIndexExclusive) {
+            return new LinkedSubList<E>(parent, fromIndexInclusive + offset, toIndexExclusive + offset);
         }
 
         protected void rangeCheck(int index, int beyond) {
@@ -1008,5 +1009,5 @@ public abstract class AbstractLinkedList implements List {
             }
         }
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/list/AbstractListDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/AbstractListDecorator.java b/src/java/org/apache/commons/collections/list/AbstractListDecorator.java
index ecd48f2..c8550d2 100644
--- a/src/java/org/apache/commons/collections/list/AbstractListDecorator.java
+++ b/src/java/org/apache/commons/collections/list/AbstractListDecorator.java
@@ -33,9 +33,11 @@ import org.apache.commons.collections.collection.AbstractCollectionDecorator;
  * 
  * @author Stephen Colebourne
  */
-public abstract class AbstractListDecorator<E>
-        extends AbstractCollectionDecorator<E>
-        implements List<E> {
+public abstract class AbstractListDecorator<E> extends AbstractCollectionDecorator<E> implements
+        List<E> {
+
+    /** Serialization version--necessary in an abstract class? */
+    private static final long serialVersionUID = 4500739654952315623L;
 
     /**
      * Constructor only used in deserialization, do not use otherwise.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/list/AbstractSerializableListDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/AbstractSerializableListDecorator.java b/src/java/org/apache/commons/collections/list/AbstractSerializableListDecorator.java
index 7793581..eac1c3a 100644
--- a/src/java/org/apache/commons/collections/list/AbstractSerializableListDecorator.java
+++ b/src/java/org/apache/commons/collections/list/AbstractSerializableListDecorator.java
@@ -29,8 +29,8 @@ import java.util.List;
  * @author Stephen Colebourne
  * @since Commons Collections 3.1
  */
-public abstract class AbstractSerializableListDecorator
-        extends AbstractListDecorator
+public abstract class AbstractSerializableListDecorator<E>
+        extends AbstractListDecorator<E>
         implements Serializable {
 
     /** Serialization version */
@@ -39,7 +39,7 @@ public abstract class AbstractSerializableListDecorator
     /**
      * Constructor.
      */
-    protected AbstractSerializableListDecorator(List list) {
+    protected AbstractSerializableListDecorator(List<E> list) {
         super(list);
     }
 
@@ -62,9 +62,10 @@ public abstract class AbstractSerializableListDecorator
      * @throws IOException
      * @throws ClassNotFoundException
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
-        collection = (Collection) in.readObject();
+        collection = (Collection<E>) in.readObject();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/list/CursorableLinkedList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/CursorableLinkedList.java b/src/java/org/apache/commons/collections/list/CursorableLinkedList.java
index b6ce57d..022eaaa 100644
--- a/src/java/org/apache/commons/collections/list/CursorableLinkedList.java
+++ b/src/java/org/apache/commons/collections/list/CursorableLinkedList.java
@@ -60,13 +60,13 @@ import java.util.ListIterator;
  * @author Simon Kitching
  * @author Stephen Colebourne
  */
-public class CursorableLinkedList extends AbstractLinkedList implements Serializable {
+public class CursorableLinkedList<E> extends AbstractLinkedList<E> implements Serializable {
 
     /** Ensure serialization compatibility */
     private static final long serialVersionUID = 8836393098519411393L;
 
     /** A list of the cursor currently open on this list */
-    protected transient List cursors = new ArrayList();
+    protected transient List<WeakReference<Cursor<E>>> cursors;
 
     //-----------------------------------------------------------------------
     /**
@@ -82,7 +82,7 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
      * 
      * @param coll  the collection to copy
      */
-    public CursorableLinkedList(Collection coll) {
+    public CursorableLinkedList(Collection<E> coll) {
         super(coll);
     }
 
@@ -92,7 +92,7 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
      */
     protected void init() {
         super.init();
-        cursors = new ArrayList();
+        cursors = new ArrayList<WeakReference<Cursor<E>>>();
     }
 
     //-----------------------------------------------------------------------
@@ -105,7 +105,7 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
      * 
      * @return a new iterator that does <b>not</b> support concurrent modification
      */
-    public Iterator iterator() {
+    public Iterator<E> iterator() {
         return super.listIterator(0);
     }
 
@@ -124,7 +124,7 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
      * 
      * @return a new cursor iterator
      */
-    public ListIterator listIterator() {
+    public ListIterator<E> listIterator() {
         return cursor(0);
     }
 
@@ -144,7 +144,7 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
      * @param fromIndex  the index to start from
      * @return a new cursor iterator
      */
-    public ListIterator listIterator(int fromIndex) {
+    public ListIterator<E> listIterator(int fromIndex) {
         return cursor(fromIndex);
     }
 
@@ -171,7 +171,7 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
      *
      * @return a new cursor iterator
      */
-    public CursorableLinkedList.Cursor cursor() {
+    public CursorableLinkedList.Cursor<E> cursor() {
         return cursor(0);
     }
 
@@ -202,8 +202,8 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
      * @throws IndexOutOfBoundsException if the index is out of range
      *      (index &lt; 0 || index &gt; size()).
      */
-    public CursorableLinkedList.Cursor cursor(int fromIndex) {
-        Cursor cursor = new Cursor(this, fromIndex);
+    public CursorableLinkedList.Cursor<E> cursor(int fromIndex) {
+        Cursor<E> cursor = new Cursor<E>(this, fromIndex);
         registerCursor(cursor);
         return cursor;
     }
@@ -217,7 +217,7 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
      * @param node  node to update
      * @param value  new value of the node
      */
-    protected void updateNode(Node node, Object value) {
+    protected void updateNode(Node<E> node, E value) {
         super.updateNode(node, value);
         broadcastNodeChanged(node);
     }
@@ -229,7 +229,7 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
      * @param insertBeforeNode  node to insert before
      * @throws NullPointerException if either node is null
      */
-    protected void addNode(Node nodeToInsert, Node insertBeforeNode) {
+    protected void addNode(Node<E> nodeToInsert, Node<E> insertBeforeNode) {
         super.addNode(nodeToInsert, insertBeforeNode);
         broadcastNodeInserted(nodeToInsert);
     }
@@ -240,7 +240,7 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
      * @param node  the node to remove
      * @throws NullPointerException if <code>node</code> is null
      */
-    protected void removeNode(Node node) {
+    protected void removeNode(Node<E> node) {
         super.removeNode(node);
         broadcastNodeRemoved(node);
     }
@@ -251,7 +251,7 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
     protected void removeAllNodes() {
         if (size() > 0) {
             // superclass implementation would break all the iterators
-            Iterator it = iterator();
+            Iterator<E> it = iterator();
             while (it.hasNext()) {
                 it.next();
                 it.remove();
@@ -265,16 +265,16 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
      * 
      * @param cursor  the cursor to register
      */
-    protected void registerCursor(Cursor cursor) {
+    protected void registerCursor(Cursor<E> cursor) {
         // We take this opportunity to clean the cursors list
         // of WeakReference objects to garbage-collected cursors.
-        for (Iterator it = cursors.iterator(); it.hasNext();) {
-            WeakReference ref = (WeakReference) it.next();
+        for (Iterator<WeakReference<Cursor<E>>> it = cursors.iterator(); it.hasNext();) {
+            WeakReference<Cursor<E>> ref = it.next();
             if (ref.get() == null) {
                 it.remove();
             }
         }
-        cursors.add(new WeakReference(cursor));
+        cursors.add(new WeakReference<Cursor<E>>(cursor));
     }
 
     /**
@@ -282,16 +282,15 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
      * 
      * @param cursor  the cursor to deregister
      */
-    protected void unregisterCursor(Cursor cursor) {
-        for (Iterator it = cursors.iterator(); it.hasNext();) {
-            WeakReference ref = (WeakReference) it.next();
-            Cursor cur = (Cursor) ref.get();
+    protected void unregisterCursor(Cursor<E> cursor) {
+        for (Iterator<WeakReference<Cursor<E>>> it = cursors.iterator(); it.hasNext();) {
+            WeakReference<Cursor<E>> ref = it.next();
+            Cursor<E> cur = ref.get();
             if (cur == null) {
                 // some other unrelated cursor object has been 
                 // garbage-collected; let's take the opportunity to
                 // clean up the cursors list anyway..
                 it.remove();
-
             } else if (cur == cursor) {
                 ref.clear();
                 it.remove();
@@ -307,11 +306,11 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
      * 
      * @param node  the node that was changed
      */
-    protected void broadcastNodeChanged(Node node) {
-        Iterator it = cursors.iterator();
+    protected void broadcastNodeChanged(Node<E> node) {
+        Iterator<WeakReference<Cursor<E>>> it = cursors.iterator();
         while (it.hasNext()) {
-            WeakReference ref = (WeakReference) it.next();
-            Cursor cursor = (Cursor) ref.get();
+            WeakReference<Cursor<E>> ref = it.next();
+            Cursor<E> cursor = ref.get();
             if (cursor == null) {
                 it.remove(); // clean up list
             } else {
@@ -326,11 +325,11 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
      * 
      * @param node  the node that was changed
      */
-    protected void broadcastNodeRemoved(Node node) {
-        Iterator it = cursors.iterator();
+    protected void broadcastNodeRemoved(Node<E> node) {
+        Iterator<WeakReference<Cursor<E>>> it = cursors.iterator();
         while (it.hasNext()) {
-            WeakReference ref = (WeakReference) it.next();
-            Cursor cursor = (Cursor) ref.get();
+            WeakReference<Cursor<E>> ref = it.next();
+            Cursor<E> cursor = ref.get();
             if (cursor == null) {
                 it.remove(); // clean up list
             } else {
@@ -345,11 +344,11 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
      * 
      * @param node  the node that was changed
      */
-    protected void broadcastNodeInserted(Node node) {
-        Iterator it = cursors.iterator();
+    protected void broadcastNodeInserted(Node<E> node) {
+        Iterator<WeakReference<Cursor<E>>> it = cursors.iterator();
         while (it.hasNext()) {
-            WeakReference ref = (WeakReference) it.next();
-            Cursor cursor = (Cursor) ref.get();
+            WeakReference<Cursor<E>> ref = it.next();
+            Cursor<E> cursor = ref.get();
             if (cursor == null) {
                 it.remove(); // clean up list
             } else {
@@ -382,8 +381,8 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
      * @param subList  the sublist to get an iterator for
      * @param fromIndex  the index to start from, relative to the sublist
      */
-    protected ListIterator createSubListListIterator(LinkedSubList subList, int fromIndex) {
-        SubCursor cursor = new SubCursor(subList, fromIndex);
+    protected ListIterator<E> createSubListListIterator(LinkedSubList<E> subList, int fromIndex) {
+        SubCursor<E> cursor = new SubCursor<E>(subList, fromIndex);
         registerCursor(cursor);
         return cursor;
     }
@@ -393,7 +392,7 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
      * An extended <code>ListIterator</code> that allows concurrent changes to
      * the underlying list.
      */
-    public static class Cursor extends AbstractLinkedList.LinkedListIterator {
+    public static class Cursor<E> extends AbstractLinkedList.LinkedListIterator<E> {
         /** Is the cursor valid (not closed) */
         boolean valid = true;
         /** Is the next index valid */
@@ -406,7 +405,7 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
          * 
          * @param index  the index to start from
          */
-        protected Cursor(CursorableLinkedList parent, int index) {
+        protected Cursor(CursorableLinkedList<E> parent, int index) {
             super(parent, index);
             valid = true;
         }
@@ -443,7 +442,7 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
          * 
          * @param obj  the object to add
          */
-        public void add(Object obj) {
+        public void add(E obj) {
             // overridden, as the nodeInserted() method updates the iterator state
             super.add(obj);
             // matches the (next.previous == node) clause in nodeInserted()
@@ -467,7 +466,7 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
                     nextIndex = parent.size();
                 } else {
                     int pos = 0;
-                    Node temp = parent.header.next;
+                    Node<E> temp = parent.header.next;
                     while (temp != next) {
                         pos++;
                         temp = temp.next;
@@ -484,7 +483,7 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
          * 
          * @param node  the node that changed
          */
-        protected void nodeChanged(Node node) {
+        protected void nodeChanged(Node<E> node) {
             // do nothing
         }
 
@@ -493,7 +492,7 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
          * 
          * @param node  the node that was removed
          */
-        protected void nodeRemoved(Node node) {
+        protected void nodeRemoved(Node<E> node) {
             if (node == next && node == current) {
                 // state where next() followed by previous()
                 next = node.next;
@@ -521,7 +520,7 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
          * 
          * @param node  the node that was added
          */
-        protected void nodeInserted(Node node) {
+        protected void nodeInserted(Node<E> node) {
             if (node.previous == current) {
                 next = node;
             } else if (next.previous == node) {
@@ -550,7 +549,7 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
          */
         public void close() {
             if (valid) {
-                ((CursorableLinkedList) parent).unregisterCursor(this);
+                ((CursorableLinkedList<E>) parent).unregisterCursor(this);
                 valid = false;
             }
         }
@@ -562,18 +561,18 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
      *
      * @since Commons Collections 3.2
      */
-    protected static class SubCursor extends Cursor {
+    protected static class SubCursor<E> extends Cursor<E> {
 
         /** The parent list */
-        protected final LinkedSubList sub;
+        protected final LinkedSubList<E> sub;
 
         /**
          * Constructs a new cursor.
          * 
          * @param index  the index to start from
          */
-        protected SubCursor(LinkedSubList sub, int index) {
-            super((CursorableLinkedList) sub.parent, index + sub.offset);
+        protected SubCursor(LinkedSubList<E> sub, int index) {
+            super((CursorableLinkedList<E>) sub.parent, index + sub.offset);
             this.sub = sub;
         }
 
@@ -589,7 +588,7 @@ public class CursorableLinkedList extends AbstractLinkedList implements Serializ
             return (super.nextIndex() - sub.offset);
         }
 
-        public void add(Object obj) {
+        public void add(E obj) {
             super.add(obj);
             sub.expectedModCount = parent.modCount;
             sub.size++;

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/list/FixedSizeList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/FixedSizeList.java b/src/java/org/apache/commons/collections/list/FixedSizeList.java
index 8709bbe..65e0955 100644
--- a/src/java/org/apache/commons/collections/list/FixedSizeList.java
+++ b/src/java/org/apache/commons/collections/list/FixedSizeList.java
@@ -39,9 +39,9 @@ import org.apache.commons.collections.iterators.UnmodifiableIterator;
  * @author Stephen Colebourne
  * @author Paul Jack
  */
-public class FixedSizeList
-        extends AbstractSerializableListDecorator
-        implements BoundedCollection {
+public class FixedSizeList<E>
+        extends AbstractSerializableListDecorator<E>
+        implements BoundedCollection<E> {
 
     /** Serialization version */
     private static final long serialVersionUID = -2218010673611160319L;
@@ -52,8 +52,8 @@ public class FixedSizeList
      * @param list  the list to decorate, must not be null
      * @throws IllegalArgumentException if list is null
      */
-    public static List decorate(List list) {
-        return new FixedSizeList(list);
+    public static <E> List<E> decorate(List<E> list) {
+        return new FixedSizeList<E>(list);
     }
 
     //-----------------------------------------------------------------------
@@ -63,24 +63,24 @@ public class FixedSizeList
      * @param list  the list to decorate, must not be null
      * @throws IllegalArgumentException if list is null
      */
-    protected FixedSizeList(List list) {
+    protected FixedSizeList(List<E> list) {
         super(list);
     }
 
     //-----------------------------------------------------------------------
-    public boolean add(Object object) {
+    public boolean add(E object) {
         throw new UnsupportedOperationException("List is fixed size");
     }
 
-    public void add(int index, Object object) {
+    public void add(int index, E object) {
         throw new UnsupportedOperationException("List is fixed size");
     }
 
-    public boolean addAll(Collection coll) {
+    public boolean addAll(Collection<? extends E> coll) {
         throw new UnsupportedOperationException("List is fixed size");
     }
 
-    public boolean addAll(int index, Collection coll) {
+    public boolean addAll(int index, Collection<? extends E> coll) {
         throw new UnsupportedOperationException("List is fixed size");
     }
 
@@ -88,7 +88,7 @@ public class FixedSizeList
         throw new UnsupportedOperationException("List is fixed size");
     }
 
-    public Object get(int index) {
+    public E get(int index) {
         return decorated().get(index);
     }
 
@@ -96,7 +96,7 @@ public class FixedSizeList
         return decorated().indexOf(object);
     }
 
-    public Iterator iterator() {
+    public Iterator<E> iterator() {
         return UnmodifiableIterator.decorate(decorated().iterator());
     }
 
@@ -104,15 +104,15 @@ public class FixedSizeList
         return decorated().lastIndexOf(object);
     }
 
-    public ListIterator listIterator() {
+    public ListIterator<E> listIterator() {
         return new FixedSizeListIterator(decorated().listIterator(0));
     }
 
-    public ListIterator listIterator(int index) {
+    public ListIterator<E> listIterator(int index) {
         return new FixedSizeListIterator(decorated().listIterator(index));
     }
 
-    public Object remove(int index) {
+    public E remove(int index) {
         throw new UnsupportedOperationException("List is fixed size");
     }
 
@@ -120,28 +120,28 @@ public class FixedSizeList
         throw new UnsupportedOperationException("List is fixed size");
     }
 
-    public boolean removeAll(Collection coll) {
+    public boolean removeAll(Collection<?> coll) {
         throw new UnsupportedOperationException("List is fixed size");
     }
 
-    public boolean retainAll(Collection coll) {
+    public boolean retainAll(Collection<?> coll) {
         throw new UnsupportedOperationException("List is fixed size");
     }
 
-    public Object set(int index, Object object) {
+    public E set(int index, E object) {
         return decorated().set(index, object);
     }
 
-    public List subList(int fromIndex, int toIndex) {
-        List sub = decorated().subList(fromIndex, toIndex);
-        return new FixedSizeList(sub);
+    public List<E> subList(int fromIndex, int toIndex) {
+        List<E> sub = decorated().subList(fromIndex, toIndex);
+        return new FixedSizeList<E>(sub);
     }
 
     /**
      * List iterator that only permits changes via set()
      */
-    static class FixedSizeListIterator extends AbstractListIteratorDecorator {
-        protected FixedSizeListIterator(ListIterator iterator) {
+    private class FixedSizeListIterator extends AbstractListIteratorDecorator<E> {
+        protected FixedSizeListIterator(ListIterator<E> iterator) {
             super(iterator);
         }
         public void remove() {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/list/GrowthList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/GrowthList.java b/src/java/org/apache/commons/collections/list/GrowthList.java
index ae2f652..bdf7c21 100644
--- a/src/java/org/apache/commons/collections/list/GrowthList.java
+++ b/src/java/org/apache/commons/collections/list/GrowthList.java
@@ -55,7 +55,7 @@ import java.util.List;
  * @author Stephen Colebourne
  * @author Paul Legato
  */
-public class GrowthList extends AbstractSerializableListDecorator {
+public class GrowthList<E> extends AbstractSerializableListDecorator<E> {
 
     /** Serialization version */
     private static final long serialVersionUID = -3620001881672L;
@@ -66,8 +66,8 @@ public class GrowthList extends AbstractSerializableListDecorator {
      * @param list  the list to decorate, must not be null
      * @throws IllegalArgumentException if list is null
      */
-    public static List decorate(List list) {
-        return new GrowthList(list);
+    public static <E> List<E> decorate(List<E> list) {
+        return new GrowthList<E>(list);
     }
 
     //-----------------------------------------------------------------------
@@ -75,7 +75,7 @@ public class GrowthList extends AbstractSerializableListDecorator {
      * Constructor that uses an ArrayList internally.
      */
     public GrowthList() {
-        super(new ArrayList());
+        super(new ArrayList<E>());
     }
 
     /**
@@ -85,7 +85,7 @@ public class GrowthList extends AbstractSerializableListDecorator {
      * @throws IllegalArgumentException if initial size is invalid
      */
     public GrowthList(int initialSize) {
-        super(new ArrayList(initialSize));
+        super(new ArrayList<E>(initialSize));
     }
 
     /**
@@ -94,7 +94,7 @@ public class GrowthList extends AbstractSerializableListDecorator {
      * @param list  the list to decorate, must not be null
      * @throws IllegalArgumentException if list is null
      */
-    protected GrowthList(List list) {
+    protected GrowthList(List<E> list) {
         super(list);
     }
 
@@ -117,10 +117,10 @@ public class GrowthList extends AbstractSerializableListDecorator {
      * @throws ClassCastException if the underlying list rejects the element
      * @throws IllegalArgumentException if the underlying list rejects the element
      */
-    public void add(int index, Object element) {
+    public void add(int index, E element) {
         int size = decorated().size();
         if (index > size) {
-            decorated().addAll(Collections.nCopies(index - size, null));
+            decorated().addAll(Collections.<E>nCopies(index - size, null));
         }
         decorated().add(index, element);
     }
@@ -145,11 +145,11 @@ public class GrowthList extends AbstractSerializableListDecorator {
      * @throws ClassCastException if the underlying list rejects the element
      * @throws IllegalArgumentException if the underlying list rejects the element
      */
-    public boolean addAll(int index, Collection coll) {
+    public boolean addAll(int index, Collection<? extends E> coll) {
         int size = decorated().size();
         boolean result = false;
         if (index > size) {
-            decorated().addAll(Collections.nCopies(index - size, null));
+            decorated().addAll(Collections.<E>nCopies(index - size, null));
             result = true;
         }
         return (decorated().addAll(index, coll) | result);
@@ -175,10 +175,10 @@ public class GrowthList extends AbstractSerializableListDecorator {
      * @throws ClassCastException if the underlying list rejects the element
      * @throws IllegalArgumentException if the underlying list rejects the element
      */
-    public Object set(int index, Object element) {
+    public E set(int index, E element) {
         int size = decorated().size();
         if (index >= size) {
-            decorated().addAll(Collections.nCopies((index - size) + 1, null));
+            decorated().addAll(Collections.<E>nCopies((index - size) + 1, null));
         }
         return decorated().set(index, element);
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/list/LazyList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/LazyList.java b/src/java/org/apache/commons/collections/list/LazyList.java
index ad83195..f1b11c3 100644
--- a/src/java/org/apache/commons/collections/list/LazyList.java
+++ b/src/java/org/apache/commons/collections/list/LazyList.java
@@ -61,13 +61,13 @@ import org.apache.commons.collections.Factory;
  * @author Arron Bates
  * @author Paul Jack
  */
-public class LazyList extends AbstractSerializableListDecorator {
+public class LazyList<E> extends AbstractSerializableListDecorator<E> {
 
     /** Serialization version */
     private static final long serialVersionUID = -1708388017160694542L;
 
     /** The factory to use to lazily instantiate the objects */
-    protected final Factory factory;
+    protected final Factory<? extends E> factory;
 
     /**
      * Factory method to create a lazily instantiating list.
@@ -76,8 +76,8 @@ public class LazyList extends AbstractSerializableListDecorator {
      * @param factory  the factory to use for creation, must not be null
      * @throws IllegalArgumentException if list or factory is null
      */
-    public static List decorate(List list, Factory factory) {
-        return new LazyList(list, factory);
+    public static <E> List<E> decorate(List<E> list, Factory<? extends E> factory) {
+        return new LazyList<E>(list, factory);
     }
     
     //-----------------------------------------------------------------------
@@ -88,7 +88,7 @@ public class LazyList extends AbstractSerializableListDecorator {
      * @param factory  the factory to use for creation, must not be null
      * @throws IllegalArgumentException if list or factory is null
      */
-    protected LazyList(List list, Factory factory) {
+    protected LazyList(List<E> list, Factory<? extends E> factory) {
         super(list);
         if (factory == null) {
             throw new IllegalArgumentException("Factory must not be null");
@@ -107,36 +107,33 @@ public class LazyList extends AbstractSerializableListDecorator {
      * 
      * @param index  the index to retrieve
      */
-    public Object get(int index) {
+    public E get(int index) {
         int size = decorated().size();
         if (index < size) {
             // within bounds, get the object
-            Object object = decorated().get(index);
+            E object = decorated().get(index);
             if (object == null) {
                 // item is a place holder, create new one, set and return
                 object = factory.create();
                 decorated().set(index, object);
                 return object;
-            } else {
-                // good and ready to go
-                return object;
-            }
-        } else {
-            // we have to grow the list
-            for (int i = size; i < index; i++) {
-                decorated().add(null);
             }
-            // create our last object, set and return
-            Object object = factory.create();
-            decorated().add(object);
+            // good and ready to go
             return object;
         }
+        // we have to grow the list
+        for (int i = size; i < index; i++) {
+            decorated().add(null);
+        }
+        // create our last object, set and return
+        E object = factory.create();
+        decorated().add(object);
+        return object;
     }
 
-
-    public List subList(int fromIndex, int toIndex) {
-        List sub = decorated().subList(fromIndex, toIndex);
-        return new LazyList(sub, factory);
+    public List<E> subList(int fromIndex, int toIndex) {
+        List<E> sub = decorated().subList(fromIndex, toIndex);
+        return new LazyList<E>(sub, factory);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/list/NodeCachingLinkedList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/NodeCachingLinkedList.java b/src/java/org/apache/commons/collections/list/NodeCachingLinkedList.java
index f997043..0b5a13f 100644
--- a/src/java/org/apache/commons/collections/list/NodeCachingLinkedList.java
+++ b/src/java/org/apache/commons/collections/list/NodeCachingLinkedList.java
@@ -44,7 +44,7 @@ import java.util.Collection;
  * @author Phil Steitz
  * @author Stephen Colebourne
  */
-public class NodeCachingLinkedList extends AbstractLinkedList implements Serializable {
+public class NodeCachingLinkedList<E> extends AbstractLinkedList<E> implements Serializable {
 
     /** Serialization version */
     private static final long serialVersionUID = 6897789178562232073L;
@@ -59,7 +59,7 @@ public class NodeCachingLinkedList extends AbstractLinkedList implements Seriali
      * Cached nodes are stored in a singly-linked list with
      * <code>next</code> pointing to the next element.
      */
-    protected transient Node firstCachedNode;
+    protected transient Node<E> firstCachedNode;
     
     /**
      * The size of the cache.
@@ -84,7 +84,7 @@ public class NodeCachingLinkedList extends AbstractLinkedList implements Seriali
      * 
      * @param coll  the collection to copy
      */
-    public NodeCachingLinkedList(Collection coll) {
+    public NodeCachingLinkedList(Collection<E> coll) {
         super(coll);
         this.maximumCacheSize = DEFAULT_MAXIMUM_CACHE_SIZE;
     }
@@ -137,11 +137,11 @@ public class NodeCachingLinkedList extends AbstractLinkedList implements Seriali
      *
      * @return a node, or <code>null</code> if there are no nodes in the cache.
      */
-    protected Node getNodeFromCache() {
+    protected Node<E> getNodeFromCache() {
         if (cacheSize == 0) {
             return null;
         }
-        Node cachedNode = firstCachedNode;
+        Node<E> cachedNode = firstCachedNode;
         firstCachedNode = cachedNode.next;
         cachedNode.next = null; // This should be changed anyway, but defensively
                                 // set it to null.                    
@@ -164,13 +164,13 @@ public class NodeCachingLinkedList extends AbstractLinkedList implements Seriali
      * 
      * @param node  the node to add to the cache
      */
-    protected void addNodeToCache(Node node) {
+    protected void addNodeToCache(Node<E> node) {
         if (isCacheFull()) {
             // don't cache the node.
             return;
         }
         // clear the node's contents and add it to the cache.
-        Node nextCachedNode = firstCachedNode;
+        Node<E> nextCachedNode = firstCachedNode;
         node.previous = null;
         node.next = nextCachedNode;
         node.setValue(null);
@@ -186,14 +186,13 @@ public class NodeCachingLinkedList extends AbstractLinkedList implements Seriali
      * @param value  value of the new node
      * @return the newly created node
      */
-    protected Node createNode(Object value) {
-        Node cachedNode = getNodeFromCache();
+    protected Node<E> createNode(E value) {
+        Node<E> cachedNode = getNodeFromCache();
         if (cachedNode == null) {
             return super.createNode(value);
-        } else {
-            cachedNode.setValue(value);
-            return cachedNode;
         }
+        cachedNode.setValue(value);
+        return cachedNode;
     }
 
     /**
@@ -202,7 +201,7 @@ public class NodeCachingLinkedList extends AbstractLinkedList implements Seriali
      * 
      * @param node  the node to remove
      */
-    protected void removeNode(Node node) {
+    protected void removeNode(Node<E> node) {
         super.removeNode(node);
         addNodeToCache(node);
     }
@@ -218,9 +217,9 @@ public class NodeCachingLinkedList extends AbstractLinkedList implements Seriali
         // {@link AbstractLinkedList.removeAllNodes()} removes the
         // nodes by removing references directly from {@link #header}.
         int numberOfNodesToCache = Math.min(size, maximumCacheSize - cacheSize);
-        Node node = header.next;
+        Node<E> node = header.next;
         for (int currentIndex = 0; currentIndex < numberOfNodesToCache; currentIndex++) {
-            Node oldNode = node;
+            Node<E> oldNode = node;
             node = node.next;
             addNodeToCache(oldNode);
         }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/list/SetUniqueList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/SetUniqueList.java b/src/java/org/apache/commons/collections/list/SetUniqueList.java
index f70311c..cc32cbf 100644
--- a/src/java/org/apache/commons/collections/list/SetUniqueList.java
+++ b/src/java/org/apache/commons/collections/list/SetUniqueList.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.
@@ -46,12 +46,12 @@ import org.apache.commons.collections.set.UnmodifiableSet;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Matthew Hawthorne
  * @author Stephen Colebourne
  * @author Tom Dunham
  */
-public class SetUniqueList extends AbstractSerializableListDecorator {
+public class SetUniqueList<E> extends AbstractSerializableListDecorator<E> {
 
     /** Serialization version */
     private static final long serialVersionUID = 7196982186153478694L;
@@ -59,30 +59,29 @@ public class SetUniqueList extends AbstractSerializableListDecorator {
     /**
      * Internal Set to maintain uniqueness.
      */
-    protected final Set set;
+    protected final Set<E> set;
 
     /**
      * Factory method to create a SetList using the supplied list to retain order.
      * <p>
      * If the list contains duplicates, these are removed (first indexed one kept).
      * A <code>HashSet</code> is used for the set behaviour.
-     * 
+     *
      * @param list  the list to decorate, must not be null
      * @throws IllegalArgumentException if list is null
      */
-    public static SetUniqueList decorate(List list) {
+    public static <E> SetUniqueList<E> decorate(List<E> list) {
         if (list == null) {
             throw new IllegalArgumentException("List must not be null");
         }
         if (list.isEmpty()) {
-            return new SetUniqueList(list, new HashSet());
-        } else {
-            List temp = new ArrayList(list);
-            list.clear();
-            SetUniqueList sl = new SetUniqueList(list, new HashSet());
-            sl.addAll(temp);
-            return sl;
+            return new SetUniqueList<E>(list, new HashSet<E>());
         }
+        List<E> temp = new ArrayList<E>(list);
+        list.clear();
+        SetUniqueList<E> sl = new SetUniqueList<E>(list, new HashSet<E>());
+        sl.addAll(temp);
+        return sl;
     }
 
     //-----------------------------------------------------------------------
@@ -90,12 +89,12 @@ public class SetUniqueList extends AbstractSerializableListDecorator {
      * Constructor that wraps (not copies) the List and specifies the set to use.
      * <p>
      * The set and list must both be correctly initialised to the same elements.
-     * 
+     *
      * @param set  the set to decorate, must not be null
      * @param list  the list to decorate, must not be null
      * @throws IllegalArgumentException if set or list is null
      */
-    protected SetUniqueList(List list, Set set) {
+    protected SetUniqueList(List<E> list, Set<E> set) {
         super(list);
         if (set == null) {
             throw new IllegalArgumentException("Set must not be null");
@@ -106,10 +105,10 @@ public class SetUniqueList extends AbstractSerializableListDecorator {
     //-----------------------------------------------------------------------
     /**
      * Gets an unmodifiable view as a Set.
-     * 
+     *
      * @return an unmodifiable set view
      */
-    public Set asSet() {
+    public Set<E> asSet() {
         return UnmodifiableSet.decorate(set);
     }
 
@@ -121,11 +120,11 @@ public class SetUniqueList extends AbstractSerializableListDecorator {
      * The <code>List</code> interface requires that this method returns
      * <code>true</code> always. However this class may return <code>false</code>
      * because of the <code>Set</code> behaviour.
-     * 
+     *
      * @param object the object to add
      * @return true if object was added
      */
-    public boolean add(Object object) {
+    public boolean add(E object) {
         // gets initial size
         final int sizeBefore = size();
 
@@ -142,11 +141,11 @@ public class SetUniqueList extends AbstractSerializableListDecorator {
      * <i>(Violation)</i>
      * The <code>List</code> interface makes the assumption that the element is
      * always inserted. This may not happen with this implementation.
-     * 
+     *
      * @param index  the index to insert at
      * @param object  the object to add
      */
-    public void add(int index, Object object) {
+    public void add(int index, E object) {
         // adds element if it is not contained already
         if (set.contains(object) == false) {
             super.add(index, object);
@@ -160,10 +159,10 @@ public class SetUniqueList extends AbstractSerializableListDecorator {
      * <i>(Violation)</i>
      * The <code>List</code> interface makes the assumption that the element is
      * always inserted. This may not happen with this implementation.
-     * 
+     *
      * @param coll  the collection to add
      */
-    public boolean addAll(Collection coll) {
+    public boolean addAll(Collection<? extends E> coll) {
         return addAll(size(), coll);
     }
 
@@ -176,22 +175,24 @@ public class SetUniqueList extends AbstractSerializableListDecorator {
      * <i>(Violation)</i>
      * The <code>List</code> interface makes the assumption that the elements
      * are always inserted. This may not happen with this implementation.
-     * 
+     *
      * @param index  the index to insert at
      * @param coll  the collection to add in iterator order
      * @return true if this collection changed
      */
-    public boolean addAll(int index, Collection coll) {
-        // gets initial size
-        final int sizeBefore = size();
-
-        // adds all elements
-        for (final Iterator it = coll.iterator(); it.hasNext();) {
-            add(it.next());
+    public boolean addAll(int index, Collection<? extends E> coll) {
+        HashSet<E> temp = new HashSet<E>(coll);
+        temp.removeAll(set);
+        if (temp.isEmpty()) {
+            return false;
         }
-
-        // compares sizes to detect if collection changed
-        return sizeBefore != size();
+        for (E e : coll) {
+            if (temp.contains(e)) {
+                add(index, e);
+                index++;
+            }
+        }
+        return true;
     }
 
     //-----------------------------------------------------------------------
@@ -202,18 +203,18 @@ public class SetUniqueList extends AbstractSerializableListDecorator {
      * Afterwards, any previous duplicate is removed
      * If the object is not already in the list then a normal set occurs.
      * If it is present, then the old version is removed.
-     * 
+     *
      * @param index  the index to insert at
      * @param object  the object to set
      * @return the previous object
      */
-    public Object set(int index, Object object) {
+    public E set(int index, E object) {
         int pos = indexOf(object);
-        Object removed = super.set(index, object);
+        E removed = super.set(index, object);
         if (pos == -1 || pos == index) {
             return removed;
         }
-        
+
         // the object is already in the uniq list
         // (and it hasn't been swapped with itself)
         super.remove(pos);  // remove the duplicate by index
@@ -227,19 +228,19 @@ public class SetUniqueList extends AbstractSerializableListDecorator {
         return result;
     }
 
-    public Object remove(int index) {
-        Object result = super.remove(index);
+    public E remove(int index) {
+        E result = super.remove(index);
         set.remove(result);
         return result;
     }
 
-    public boolean removeAll(Collection coll) {
+    public boolean removeAll(Collection<?> coll) {
         boolean result = super.removeAll(coll);
         set.removeAll(coll);
         return result;
     }
 
-    public boolean retainAll(Collection coll) {
+    public boolean retainAll(Collection<?> coll) {
         boolean result = super.retainAll(coll);
         set.retainAll(coll);
         return result;
@@ -254,41 +255,61 @@ public class SetUniqueList extends AbstractSerializableListDecorator {
         return set.contains(object);
     }
 
-    public boolean containsAll(Collection coll) {
+    public boolean containsAll(Collection<?> coll) {
         return set.containsAll(coll);
     }
 
-    public Iterator iterator() {
-        return new SetListIterator(super.iterator(), set);
+    public Iterator<E> iterator() {
+        return new SetListIterator<E>(super.iterator(), set);
+    }
+
+    public ListIterator<E> listIterator() {
+        return new SetListListIterator<E>(super.listIterator(), set);
     }
 
-    public ListIterator listIterator() {
-        return new SetListListIterator(super.listIterator(), set);
+    public ListIterator<E> listIterator(int index) {
+        return new SetListListIterator<E>(super.listIterator(index), set);
     }
 
-    public ListIterator listIterator(int index) {
-        return new SetListListIterator(super.listIterator(index), set);
+    public List<E> subList(int fromIndex, int toIndex) {
+        List<E> superSubList = super.subList(fromIndex, toIndex);
+        Set<E> subSet = createSetBasedOnList(set, superSubList);
+        return new SetUniqueList<E>(superSubList, subSet);
     }
 
-    public List subList(int fromIndex, int toIndex) {
-        return new SetUniqueList(super.subList(fromIndex, toIndex), set);
+    @SuppressWarnings("unchecked")
+    protected Set<E> createSetBasedOnList(Set<E> set, List<E> list) {
+        Set<E> subSet = null;
+        if (set.getClass().equals(HashSet.class)) {
+            subSet = new HashSet<E>();
+        } else {
+            try {
+                subSet = (Set<E>) set.getClass().newInstance();
+            } catch (InstantiationException ie) {
+                subSet = new HashSet<E>();
+            } catch (IllegalAccessException iae) {
+                subSet = new HashSet<E>();
+            }
+        }
+        subSet.addAll(list);
+        return subSet;
     }
 
     //-----------------------------------------------------------------------
     /**
      * Inner class iterator.
      */
-    static class SetListIterator extends AbstractIteratorDecorator {
-        
-        protected final Set set;
-        protected Object last = null;
-        
-        protected SetListIterator(Iterator it, Set set) {
+    static class SetListIterator<E> extends AbstractIteratorDecorator<E> {
+
+        protected final Set<E> set;
+        protected E last = null;
+
+        protected SetListIterator(Iterator<E> it, Set<E> set) {
             super(it);
             this.set = set;
         }
-        
-        public Object next() {
+
+        public E next() {
             last = super.next();
             return last;
         }
@@ -299,26 +320,26 @@ public class SetUniqueList extends AbstractSerializableListDecorator {
             last = null;
         }
     }
-    
+
     /**
      * Inner class iterator.
      */
-    static class SetListListIterator extends AbstractListIteratorDecorator {
-        
-        protected final Set set;
-        protected Object last = null;
-        
-        protected SetListListIterator(ListIterator it, Set set) {
+    static class SetListListIterator<E> extends AbstractListIteratorDecorator<E> {
+
+        protected final Set<E> set;
+        protected E last = null;
+
+        protected SetListListIterator(ListIterator<E> it, Set<E> set) {
             super(it);
             this.set = set;
         }
-        
-        public Object next() {
+
+        public E next() {
             last = super.next();
             return last;
         }
 
-        public Object previous() {
+        public E previous() {
             last = super.previous();
             return last;
         }
@@ -329,16 +350,16 @@ public class SetUniqueList extends AbstractSerializableListDecorator {
             last = null;
         }
 
-        public void add(Object object) {
+        public void add(E object) {
             if (set.contains(object) == false) {
                 super.add(object);
                 set.add(object);
             }
         }
-        
-        public void set(Object object) {
+
+        public void set(E object) {
             throw new UnsupportedOperationException("ListIterator does not support set");
         }
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/list/SynchronizedList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/SynchronizedList.java b/src/java/org/apache/commons/collections/list/SynchronizedList.java
index e6f255c..a01e656 100644
--- a/src/java/org/apache/commons/collections/list/SynchronizedList.java
+++ b/src/java/org/apache/commons/collections/list/SynchronizedList.java
@@ -122,7 +122,7 @@ public class SynchronizedList<E> extends SynchronizedCollection<E> implements Li
      * 
      * @return an iterator that must be manually synchronized on the collection
      */
-    public ListIterator listIterator() {
+    public ListIterator<E> listIterator() {
         return getList().listIterator();
     }
 
@@ -136,7 +136,7 @@ public class SynchronizedList<E> extends SynchronizedCollection<E> implements Li
      * 
      * @return an iterator that must be manually synchronized on the collection
      */
-    public ListIterator listIterator(int index) {
+    public ListIterator<E> listIterator(int index) {
         return getList().listIterator(index);
     }
 


[23/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/list/TransformedList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/TransformedList.java b/src/java/org/apache/commons/collections/list/TransformedList.java
index 1c0316c..4ca6cf2 100644
--- a/src/java/org/apache/commons/collections/list/TransformedList.java
+++ b/src/java/org/apache/commons/collections/list/TransformedList.java
@@ -39,7 +39,7 @@ import org.apache.commons.collections.iterators.AbstractListIteratorDecorator;
  * 
  * @author Stephen Colebourne
  */
-public class TransformedList extends TransformedCollection implements List {
+public class TransformedList<E> extends TransformedCollection<E> implements List<E> {
 
     /** Serialization version */
     private static final long serialVersionUID = 1077193035000013141L;
@@ -54,8 +54,8 @@ public class TransformedList extends TransformedCollection implements List {
      * @param transformer  the transformer to use for conversion, must not be null
      * @throws IllegalArgumentException if list or transformer is null
      */
-    public static List decorate(List list, Transformer transformer) {
-        return new TransformedList(list, transformer);
+    public static <E> List<E> decorate(List<E> list, Transformer<? super E, ? extends E> transformer) {
+        return new TransformedList<E>(list, transformer);
     }
     
     //-----------------------------------------------------------------------
@@ -69,7 +69,7 @@ public class TransformedList extends TransformedCollection implements List {
      * @param transformer  the transformer to use for conversion, must not be null
      * @throws IllegalArgumentException if list or transformer is null
      */
-    protected TransformedList(List list, Transformer transformer) {
+    protected TransformedList(List<E> list, Transformer<? super E, ? extends E> transformer) {
         super(list, transformer);
     }
 
@@ -78,12 +78,12 @@ public class TransformedList extends TransformedCollection implements List {
      * 
      * @return the decorated list
      */
-    protected List getList() {
-        return (List) collection;
+    protected List<E> getList() {
+        return (List<E>) collection;
     }
 
     //-----------------------------------------------------------------------
-    public Object get(int index) {
+    public E get(int index) {
         return getList().get(index);
     }
 
@@ -95,54 +95,54 @@ public class TransformedList extends TransformedCollection implements List {
         return getList().lastIndexOf(object);
     }
 
-    public Object remove(int index) {
+    public E remove(int index) {
         return getList().remove(index);
     }
 
     //-----------------------------------------------------------------------
-    public void add(int index, Object object) {
+    public void add(int index, E object) {
         object = transform(object);
         getList().add(index, object);
     }
 
-    public boolean addAll(int index, Collection coll) {
+    public boolean addAll(int index, Collection<? extends E> coll) {
         coll = transform(coll);
         return getList().addAll(index, coll);
     }
 
-    public ListIterator listIterator() {
+    public ListIterator<E> listIterator() {
         return listIterator(0);
     }
 
-    public ListIterator listIterator(int i) {
+    public ListIterator<E> listIterator(int i) {
         return new TransformedListIterator(getList().listIterator(i));
     }
 
-    public Object set(int index, Object object) {
+    public E set(int index, E object) {
         object = transform(object);
         return getList().set(index, object);
     }
 
-    public List subList(int fromIndex, int toIndex) {
-        List sub = getList().subList(fromIndex, toIndex);
-        return new TransformedList(sub, transformer);
+    public List<E> subList(int fromIndex, int toIndex) {
+        List<E> sub = getList().subList(fromIndex, toIndex);
+        return new TransformedList<E>(sub, transformer);
     }
 
     /**
      * Inner class Iterator for the TransformedList
      */
-    protected class TransformedListIterator extends AbstractListIteratorDecorator {
-        
-        protected TransformedListIterator(ListIterator iterator) {
+    protected class TransformedListIterator extends AbstractListIteratorDecorator<E> {
+
+        protected TransformedListIterator(ListIterator<E> iterator) {
             super(iterator);
         }
-        
-        public void add(Object object) {
+
+        public void add(E object) {
             object = transform(object);
             iterator.add(object);
         }
-        
-        public void set(Object object) {
+
+        public void set(E object) {
             object = transform(object);
             iterator.set(object);
         }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/list/TreeList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/TreeList.java b/src/java/org/apache/commons/collections/list/TreeList.java
index 1576f90..b93c4e0 100644
--- a/src/java/org/apache/commons/collections/list/TreeList.java
+++ b/src/java/org/apache/commons/collections/list/TreeList.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.
@@ -48,22 +48,22 @@ import org.apache.commons.collections.OrderedIterator;
  * <p>
  * <code>LinkedList</code> is rarely a good choice of implementation.
  * <code>TreeList</code> is almost always a good replacement for it, although it
- * does use sligtly more memory.
- * 
+ * does use slightly more memory.
+ *
  * @since Commons Collections 3.1
  * @version $Revision$ $Date$
  *
  * @author Joerg Schmuecker
  * @author Stephen Colebourne
  */
-public class TreeList extends AbstractList {
+public class TreeList<E> extends AbstractList<E> {
 //    add; toArray; iterator; insert; get; indexOf; remove
 //    TreeList = 1260;7360;3080;  160;   170;3400;  170;
 //   ArrayList =  220;1480;1760; 6870;    50;1540; 7200;
 //  LinkedList =  270;7360;3350;55860;290720;2910;55200;
 
     /** The root node in the AVL tree */
-    private AVLNode root;
+    private AVLNode<E> root;
 
     /** The current size of the list */
     private int size;
@@ -78,11 +78,11 @@ public class TreeList extends AbstractList {
 
     /**
      * Constructs a new empty list that copies the specified list.
-     * 
+     *
      * @param coll  the collection to copy
      * @throws NullPointerException if the collection is null
      */
-    public TreeList(Collection coll) {
+    public TreeList(Collection<E> coll) {
         super();
         addAll(coll);
     }
@@ -90,18 +90,18 @@ public class TreeList extends AbstractList {
     //-----------------------------------------------------------------------
     /**
      * Gets the element at the specified index.
-     * 
+     *
      * @param index  the index to retrieve
      * @return the element at the specified index
      */
-    public Object get(int index) {
+    public E get(int index) {
         checkInterval(index, 0, size() - 1);
         return root.get(index).getValue();
     }
 
     /**
      * Gets the current size of the list.
-     * 
+     *
      * @return the current size
      */
     public int size() {
@@ -110,40 +110,40 @@ public class TreeList extends AbstractList {
 
     /**
      * Gets an iterator over the list.
-     * 
+     *
      * @return an iterator over the list
      */
-    public Iterator iterator() {
+    public Iterator<E> iterator() {
         // override to go 75% faster
         return listIterator(0);
     }
 
     /**
      * Gets a ListIterator over the list.
-     * 
+     *
      * @return the new iterator
      */
-    public ListIterator listIterator() {
+    public ListIterator<E> listIterator() {
         // override to go 75% faster
         return listIterator(0);
     }
 
     /**
      * Gets a ListIterator over the list.
-     * 
+     *
      * @param fromIndex  the index to start from
      * @return the new iterator
      */
-    public ListIterator listIterator(int fromIndex) {
+    public ListIterator<E> listIterator(int fromIndex) {
         // override to go 75% faster
         // cannot use EmptyIterator as iterator.add() must work
         checkInterval(fromIndex, 0, size());
-        return new TreeListIterator(this, fromIndex);
+        return new TreeListIterator<E>(this, fromIndex);
     }
 
     /**
      * Searches for the index of an object in the list.
-     * 
+     *
      * @return the index of the object, -1 if not found
      */
     public int indexOf(Object object) {
@@ -156,7 +156,7 @@ public class TreeList extends AbstractList {
 
     /**
      * Searches for the presence of an object in the list.
-     * 
+     *
      * @return true if the object is found
      */
     public boolean contains(Object object) {
@@ -165,7 +165,7 @@ public class TreeList extends AbstractList {
 
     /**
      * Converts the list into an array.
-     * 
+     *
      * @return the list as an array
      */
     public Object[] toArray() {
@@ -180,15 +180,15 @@ public class TreeList extends AbstractList {
     //-----------------------------------------------------------------------
     /**
      * Adds a new element to the list.
-     * 
+     *
      * @param index  the index to add before
      * @param obj  the element to add
      */
-    public void add(int index, Object obj) {
+    public void add(int index, E obj) {
         modCount++;
         checkInterval(index, 0, size());
         if (root == null) {
-            root = new AVLNode(index, obj, null, null);
+            root = new AVLNode<E>(index, obj, null, null);
         } else {
             root = root.insert(index, obj);
         }
@@ -197,30 +197,30 @@ public class TreeList extends AbstractList {
 
     /**
      * Sets the element at the specified index.
-     * 
+     *
      * @param index  the index to set
      * @param obj  the object to store at the specified index
      * @return the previous object at that index
      * @throws IndexOutOfBoundsException if the index is invalid
      */
-    public Object set(int index, Object obj) {
+    public E set(int index, E obj) {
         checkInterval(index, 0, size() - 1);
-        AVLNode node = root.get(index);
-        Object result = node.value;
+        AVLNode<E> node = root.get(index);
+        E result = node.value;
         node.setValue(obj);
         return result;
     }
 
     /**
      * Removes the element at the specified index.
-     * 
+     *
      * @param index  the index to remove
      * @return the previous object at that index
      */
-    public Object remove(int index) {
+    public E remove(int index) {
         modCount++;
         checkInterval(index, 0, size() - 1);
-        Object result = get(index);
+        E result = get(index);
         root = root.remove(index);
         size--;
         return result;
@@ -238,7 +238,7 @@ public class TreeList extends AbstractList {
     //-----------------------------------------------------------------------
     /**
      * Checks whether the index is valid.
-     * 
+     *
      * @param index  the index to check
      * @param startIndex  the first allowed index
      * @param endIndex  the last allowed index
@@ -263,13 +263,13 @@ public class TreeList extends AbstractList {
      * The Faedelung calculation stores a flag for both the left and right child
      * to indicate if they are a child (false) or a link as in linked list (true).
      */
-    static class AVLNode {
+    static class AVLNode<E> {
         /** The left child node or the predecessor if {@link #leftIsPrevious}.*/
-        private AVLNode left;
+        private AVLNode<E> left;
         /** Flag indicating that left reference is not a subtree but the predecessor. */
         private boolean leftIsPrevious;
         /** The right child node or the successor if {@link #rightIsNext}. */
-        private AVLNode right;
+        private AVLNode<E> right;
         /** Flag indicating that right reference is not a subtree but the successor. */
         private boolean rightIsNext;
         /** How many levels of left/right are below this one. */
@@ -277,17 +277,17 @@ public class TreeList extends AbstractList {
         /** The relative position, root holds absolute position. */
         private int relativePosition;
         /** The stored element. */
-        private Object value;
+        private E value;
 
         /**
          * Constructs a new node with a relative position.
-         * 
+         *
          * @param relativePosition  the relative position of the node
          * @param obj  the value for the ndoe
          * @param rightFollower the node with the value following this one
          * @param leftFollower the node with the value leading this one
          */
-        private AVLNode(int relativePosition, Object obj, AVLNode rightFollower, AVLNode leftFollower) {
+        private AVLNode(int relativePosition, E obj, AVLNode<E> rightFollower, AVLNode<E> leftFollower) {
             this.relativePosition = relativePosition;
             value = obj;
             rightIsNext = true;
@@ -298,19 +298,19 @@ public class TreeList extends AbstractList {
 
         /**
          * Gets the value.
-         * 
+         *
          * @return the value of this node
          */
-        Object getValue() {
+        E getValue() {
             return value;
         }
 
         /**
          * Sets the value.
-         * 
+         *
          * @param obj  the value to store
          */
-        void setValue(Object obj) {
+        void setValue(E obj) {
             this.value = obj;
         }
 
@@ -318,14 +318,14 @@ public class TreeList extends AbstractList {
          * Locate the element with the given index relative to the
          * offset of the parent of this node.
          */
-        AVLNode get(int index) {
+        AVLNode<E> get(int index) {
             int indexRelativeToMe = index - relativePosition;
 
             if (indexRelativeToMe == 0) {
                 return this;
             }
 
-            AVLNode nextNode = ((indexRelativeToMe < 0) ? getLeftSubTree() : getRightSubTree());
+            AVLNode<E> nextNode = ((indexRelativeToMe < 0) ? getLeftSubTree() : getRightSubTree());
             if (nextNode == null) {
                 return null;
             }
@@ -353,7 +353,7 @@ public class TreeList extends AbstractList {
 
         /**
          * Stores the node and its children into the array specified.
-         * 
+         *
          * @param array the array to be filled
          * @param index the index of this node
          */
@@ -369,10 +369,10 @@ public class TreeList extends AbstractList {
 
         /**
          * Gets the next node in the list after this one.
-         * 
+         *
          * @return the next node
          */
-        AVLNode next() {
+        AVLNode<E> next() {
             if (rightIsNext || right == null) {
                 return right;
             }
@@ -381,10 +381,10 @@ public class TreeList extends AbstractList {
 
         /**
          * Gets the node in the list before this one.
-         * 
+         *
          * @return the previous node
          */
-        AVLNode previous() {
+        AVLNode<E> previous() {
             if (leftIsPrevious || left == null) {
                 return left;
             }
@@ -392,27 +392,26 @@ public class TreeList extends AbstractList {
         }
 
         /**
-         * Inserts a node at the position index.  
-         * 
-         * @param index is the index of the position relative to the position of 
+         * Inserts a node at the position index.
+         *
+         * @param index is the index of the position relative to the position of
          * the parent node.
          * @param obj is the object to be stored in the position.
          */
-        AVLNode insert(int index, Object obj) {
+        AVLNode<E> insert(int index, E obj) {
             int indexRelativeToMe = index - relativePosition;
 
             if (indexRelativeToMe <= 0) {
                 return insertOnLeft(indexRelativeToMe, obj);
-            } else {
-                return insertOnRight(indexRelativeToMe, obj);
             }
+            return insertOnRight(indexRelativeToMe, obj);
         }
 
-        private AVLNode insertOnLeft(int indexRelativeToMe, Object obj) {
-            AVLNode ret = this;
+        private AVLNode<E> insertOnLeft(int indexRelativeToMe, E obj) {
+            AVLNode<E> ret = this;
 
             if (getLeftSubTree() == null) {
-                setLeft(new AVLNode(-1, obj, this, left), null);
+                setLeft(new AVLNode<E>(-1, obj, this, left), null);
             } else {
                 setLeft(left.insert(indexRelativeToMe, obj), null);
             }
@@ -425,11 +424,11 @@ public class TreeList extends AbstractList {
             return ret;
         }
 
-        private AVLNode insertOnRight(int indexRelativeToMe, Object obj) {
-            AVLNode ret = this;
+        private AVLNode<E> insertOnRight(int indexRelativeToMe, E obj) {
+            AVLNode<E> ret = this;
 
             if (getRightSubTree() == null) {
-                setRight(new AVLNode(+1, obj, right, this), null);
+                setRight(new AVLNode<E>(+1, obj, right, this), null);
             } else {
                 setRight(right.insert(indexRelativeToMe, obj), null);
             }
@@ -445,42 +444,42 @@ public class TreeList extends AbstractList {
         /**
          * Gets the left node, returning null if its a faedelung.
          */
-        private AVLNode getLeftSubTree() {
+        private AVLNode<E> getLeftSubTree() {
             return (leftIsPrevious ? null : left);
         }
 
         /**
          * Gets the right node, returning null if its a faedelung.
          */
-        private AVLNode getRightSubTree() {
+        private AVLNode<E> getRightSubTree() {
             return (rightIsNext ? null : right);
         }
 
         /**
          * Gets the rightmost child of this node.
-         * 
+         *
          * @return the rightmost child (greatest index)
          */
-        private AVLNode max() {
+        private AVLNode<E> max() {
             return (getRightSubTree() == null) ? this : right.max();
         }
 
         /**
          * Gets the leftmost child of this node.
-         * 
+         *
          * @return the leftmost child (smallest index)
          */
-        private AVLNode min() {
+        private AVLNode<E> min() {
             return (getLeftSubTree() == null) ? this : left.min();
         }
 
         /**
          * Removes the node at a given position.
-         * 
-         * @param index is the index of the element to be removed relative to the position of 
+         *
+         * @param index is the index of the element to be removed relative to the position of
          * the parent node of the current node.
          */
-        AVLNode remove(int index) {
+        AVLNode<E> remove(int index) {
             int indexRelativeToMe = index - relativePosition;
 
             if (indexRelativeToMe == 0) {
@@ -501,7 +500,7 @@ public class TreeList extends AbstractList {
             return balance();
         }
 
-        private AVLNode removeMax() {
+        private AVLNode<E> removeMax() {
             if (getRightSubTree() == null) {
                 return removeSelf();
             }
@@ -513,7 +512,7 @@ public class TreeList extends AbstractList {
             return balance();
         }
 
-        private AVLNode removeMin() {
+        private AVLNode<E> removeMin() {
             if (getLeftSubTree() == null) {
                 return removeSelf();
             }
@@ -530,7 +529,7 @@ public class TreeList extends AbstractList {
          *
          * @return the node that replaces this one in the parent
          */
-        private AVLNode removeSelf() {
+        private AVLNode<E> removeSelf() {
             if (getRightSubTree() == null && getLeftSubTree() == null) {
                 return null;
             }
@@ -549,7 +548,7 @@ public class TreeList extends AbstractList {
 
             if (heightRightMinusLeft() > 0) {
                 // more on the right, so delete from the right
-                AVLNode rightMin = right.min();
+                AVLNode<E> rightMin = right.min();
                 value = rightMin.value;
                 if (leftIsPrevious) {
                     left = rightMin.left;
@@ -560,12 +559,12 @@ public class TreeList extends AbstractList {
                 }
             } else {
                 // more on the left or equal, so delete from the left
-                AVLNode leftMax = left.max();
+                AVLNode<E> leftMax = left.max();
                 value = leftMax.value;
                 if (rightIsNext) {
                     right = leftMax.right;
                 }
-                AVLNode leftPrevious = left.left;
+                AVLNode<E> leftPrevious = left.left;
                 left = left.removeMax();
                 if (left == null) {
                     // special case where left that was deleted was a double link
@@ -585,7 +584,7 @@ public class TreeList extends AbstractList {
         /**
          * Balances according to the AVL algorithm.
          */
-        private AVLNode balance() {
+        private AVLNode<E> balance() {
             switch (heightRightMinusLeft()) {
                 case 1 :
                 case 0 :
@@ -609,7 +608,7 @@ public class TreeList extends AbstractList {
         /**
          * Gets the relative position.
          */
-        private int getOffset(AVLNode node) {
+        private int getOffset(AVLNode<E> node) {
             if (node == null) {
                 return 0;
             }
@@ -619,7 +618,7 @@ public class TreeList extends AbstractList {
         /**
          * Sets the relative position.
          */
-        private int setOffset(AVLNode node, int newOffest) {
+        private int setOffset(AVLNode<E> node, int newOffest) {
             if (node == null) {
                 return 0;
             }
@@ -640,7 +639,7 @@ public class TreeList extends AbstractList {
         /**
          * Returns the height of the node or -1 if the node is null.
          */
-        private int getHeight(AVLNode node) {
+        private int getHeight(AVLNode<E> node) {
             return (node == null ? -1 : node.height);
         }
 
@@ -651,9 +650,9 @@ public class TreeList extends AbstractList {
             return getHeight(getRightSubTree()) - getHeight(getLeftSubTree());
         }
 
-        private AVLNode rotateLeft() {
-            AVLNode newTop = right; // can't be faedelung!
-            AVLNode movedNode = getRightSubTree().getLeftSubTree();
+        private AVLNode<E> rotateLeft() {
+            AVLNode<E> newTop = right; // can't be faedelung!
+            AVLNode<E> movedNode = getRightSubTree().getLeftSubTree();
 
             int newTopPosition = relativePosition + getOffset(newTop);
             int myNewPosition = -newTop.relativePosition;
@@ -668,9 +667,9 @@ public class TreeList extends AbstractList {
             return newTop;
         }
 
-        private AVLNode rotateRight() {
-            AVLNode newTop = left; // can't be faedelung
-            AVLNode movedNode = getLeftSubTree().getRightSubTree();
+        private AVLNode<E> rotateRight() {
+            AVLNode<E> newTop = left; // can't be faedelung
+            AVLNode<E> movedNode = getLeftSubTree().getRightSubTree();
 
             int newTopPosition = relativePosition + getOffset(newTop);
             int myNewPosition = -newTop.relativePosition;
@@ -691,7 +690,7 @@ public class TreeList extends AbstractList {
          * @param node  the new left subtree node
          * @param previous  the previous node in the linked list
          */
-        private void setLeft(AVLNode node, AVLNode previous) {
+        private void setLeft(AVLNode<E> node, AVLNode<E> previous) {
             leftIsPrevious = (node == null);
             left = (leftIsPrevious ? previous : node);
             recalcHeight();
@@ -703,7 +702,7 @@ public class TreeList extends AbstractList {
          * @param node  the new left subtree node
          * @param next  the next node in the linked list
          */
-        private void setRight(AVLNode node, AVLNode next) {
+        private void setRight(AVLNode<E> node, AVLNode<E> next) {
             rightIsNext = (node == null);
             right = (rightIsNext ? next : node);
             recalcHeight();
@@ -747,7 +746,7 @@ public class TreeList extends AbstractList {
 //            }
 //            return count + left.checkLeftSubNode();
 //        }
-//        
+//
 //        private int checkRightSubNode() {
 //            AVLNode right = getRightSubTree();
 //            if (right == null) {
@@ -773,13 +772,13 @@ public class TreeList extends AbstractList {
     /**
      * A list iterator over the linked list.
      */
-    static class TreeListIterator implements ListIterator, OrderedIterator {
+    static class TreeListIterator<E> implements ListIterator<E>, OrderedIterator<E> {
         /** The parent list */
-        protected final TreeList parent;
+        protected final TreeList<E> parent;
         /**
          * Cache of the next node that will be returned by {@link #next()}.
          */
-        protected AVLNode next;
+        protected AVLNode<E> next;
         /**
          * The index of the next node to be returned.
          */
@@ -788,7 +787,7 @@ public class TreeList extends AbstractList {
          * Cache of the last node that was returned by {@link #next()}
          * or {@link #previous()}.
          */
-        protected AVLNode current;
+        protected AVLNode<E> current;
         /**
          * The index of the last node that was returned.
          */
@@ -803,11 +802,11 @@ public class TreeList extends AbstractList {
 
         /**
          * Create a ListIterator for a list.
-         * 
+         *
          * @param parent  the parent list
          * @param fromIndex  the index to start at
          */
-        protected TreeListIterator(TreeList parent, int fromIndex) throws IndexOutOfBoundsException {
+        protected TreeListIterator(TreeList<E> parent, int fromIndex) throws IndexOutOfBoundsException {
             super();
             this.parent = parent;
             this.expectedModCount = parent.modCount;
@@ -819,7 +818,7 @@ public class TreeList extends AbstractList {
         /**
          * Checks the modification count of the list is the value that this
          * object expects.
-         * 
+         *
          * @throws ConcurrentModificationException If the list's modification
          * count isn't the value that was expected.
          */
@@ -833,7 +832,7 @@ public class TreeList extends AbstractList {
             return (nextIndex < parent.size());
         }
 
-        public Object next() {
+        public E next() {
             checkModCount();
             if (!hasNext()) {
                 throw new NoSuchElementException("No element at index " + nextIndex + ".");
@@ -841,7 +840,7 @@ public class TreeList extends AbstractList {
             if (next == null) {
                 next = parent.root.get(nextIndex);
             }
-            Object value = next.getValue();
+            E value = next.getValue();
             current = next;
             currentIndex = nextIndex++;
             next = next.next();
@@ -852,7 +851,7 @@ public class TreeList extends AbstractList {
             return (nextIndex > 0);
         }
 
-        public Object previous() {
+        public E previous() {
             checkModCount();
             if (!hasPrevious()) {
                 throw new NoSuchElementException("Already at start of list.");
@@ -862,7 +861,7 @@ public class TreeList extends AbstractList {
             } else {
                 next = next.previous();
             }
-            Object value = next.getValue();
+            E value = next.getValue();
             current = next;
             currentIndex = --nextIndex;
             return value;
@@ -895,7 +894,7 @@ public class TreeList extends AbstractList {
             expectedModCount++;
         }
 
-        public void set(Object obj) {
+        public void set(E obj) {
             checkModCount();
             if (current == null) {
                 throw new IllegalStateException();
@@ -903,7 +902,7 @@ public class TreeList extends AbstractList {
             current.setValue(obj);
         }
 
-        public void add(Object obj) {
+        public void add(E obj) {
             checkModCount();
             parent.add(nextIndex, obj);
             current = null;

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/list/UnmodifiableList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/UnmodifiableList.java b/src/java/org/apache/commons/collections/list/UnmodifiableList.java
index 1a34886..f11b700 100644
--- a/src/java/org/apache/commons/collections/list/UnmodifiableList.java
+++ b/src/java/org/apache/commons/collections/list/UnmodifiableList.java
@@ -35,8 +35,8 @@ import org.apache.commons.collections.iterators.UnmodifiableListIterator;
  * 
  * @author Stephen Colebourne
  */
-public final class UnmodifiableList
-        extends AbstractSerializableListDecorator
+public final class UnmodifiableList<E>
+        extends AbstractSerializableListDecorator<E>
         implements Unmodifiable {
 
     /** Serialization version */
@@ -48,11 +48,11 @@ public final class UnmodifiableList
      * @param list  the list to decorate, must not be null
      * @throws IllegalArgumentException if list is null
      */
-    public static List decorate(List list) {
+    public static <E> List<E> decorate(List<E> list) {
         if (list instanceof Unmodifiable) {
             return list;
         }
-        return new UnmodifiableList(list);
+        return new UnmodifiableList<E>(list);
     }
 
     //-----------------------------------------------------------------------
@@ -61,13 +61,14 @@ public final class UnmodifiableList
      * 
      * @param list  the list to decorate, must not be null
      * @throws IllegalArgumentException if list is null
+     * @since Commons Collection 5
      */
-    private UnmodifiableList(List list) {
+    public UnmodifiableList(List<E> list) {
         super(list);
     }
 
     //-----------------------------------------------------------------------
-    public Iterator iterator() {
+    public Iterator<E> iterator() {
         return UnmodifiableIterator.decorate(decorated().iterator());
     }
 
@@ -75,7 +76,7 @@ public final class UnmodifiableList
         throw new UnsupportedOperationException();
     }
 
-    public boolean addAll(Collection coll) {
+    public boolean addAll(Collection<? extends E> coll) {
         throw new UnsupportedOperationException();
     }
 
@@ -87,42 +88,42 @@ public final class UnmodifiableList
         throw new UnsupportedOperationException();
     }
 
-    public boolean removeAll(Collection coll) {
+    public boolean removeAll(Collection<?> coll) {
         throw new UnsupportedOperationException();
     }
 
-    public boolean retainAll(Collection coll) {
+    public boolean retainAll(Collection<?> coll) {
         throw new UnsupportedOperationException();
     }
 
     //-----------------------------------------------------------------------
-    public ListIterator listIterator() {
+    public ListIterator<E> listIterator() {
         return UnmodifiableListIterator.decorate(decorated().listIterator());
     }
 
-    public ListIterator listIterator(int index) {
+    public ListIterator<E> listIterator(int index) {
         return UnmodifiableListIterator.decorate(decorated().listIterator(index));
     }
 
-    public void add(int index, Object object) {
+    public void add(int index, E object) {
         throw new UnsupportedOperationException();
     }
 
-    public boolean addAll(int index, Collection coll) {
+    public boolean addAll(int index, Collection<? extends E> coll) {
         throw new UnsupportedOperationException();
     }
 
-    public Object remove(int index) {
+    public E remove(int index) {
         throw new UnsupportedOperationException();
     }
 
-    public Object set(int index, Object object) {
+    public E set(int index, E object) {
         throw new UnsupportedOperationException();
     }
 
-    public List subList(int fromIndex, int toIndex) {
-        List sub = decorated().subList(fromIndex, toIndex);
-        return new UnmodifiableList(sub);
+    public List<E> subList(int fromIndex, int toIndex) {
+        List<E> sub = decorated().subList(fromIndex, toIndex);
+        return new UnmodifiableList<E>(sub);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/AbstractHashedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/AbstractHashedMap.java b/src/java/org/apache/commons/collections/map/AbstractHashedMap.java
index 1d0f196..b0d29a6 100644
--- a/src/java/org/apache/commons/collections/map/AbstractHashedMap.java
+++ b/src/java/org/apache/commons/collections/map/AbstractHashedMap.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.
@@ -51,7 +51,7 @@ import org.apache.commons.collections.iterators.EmptyMapIterator;
  * NOTE: From Commons Collections 3.1 this class extends AbstractMap.
  * This is to provide backwards compatibility for ReferenceMap between v3.0 and v3.1.
  * This extends clause will be removed in v4.0.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
@@ -59,15 +59,15 @@ import org.apache.commons.collections.iterators.EmptyMapIterator;
  * @author Stephen Colebourne
  * @author Christian Siefkes
  */
-public class AbstractHashedMap extends AbstractMap implements IterableMap {
-    
+public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements IterableMap<K, V> {
+
     protected static final String NO_NEXT_ENTRY = "No next() entry in the iteration";
     protected static final String NO_PREVIOUS_ENTRY = "No previous() entry in the iteration";
     protected static final String REMOVE_INVALID = "remove() can only be called once after next()";
     protected static final String GETKEY_INVALID = "getKey() can only be called after next() and before remove()";
     protected static final String GETVALUE_INVALID = "getValue() can only be called after next() and before remove()";
     protected static final String SETVALUE_INVALID = "setValue() can only be called after next() and before remove()";
-    
+
     /** The default capacity to use */
     protected static final int DEFAULT_CAPACITY = 16;
     /** The default threshold to use */
@@ -78,23 +78,23 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
     protected static final int MAXIMUM_CAPACITY = 1 << 30;
     /** An object for masking null */
     protected static final Object NULL = new Object();
-    
+
     /** Load factor, normally 0.75 */
     protected transient float loadFactor;
     /** The size of the map */
     protected transient int size;
     /** Map entries */
-    protected transient HashEntry[] data;
+    protected transient HashEntry<K, V>[] data;
     /** Size at which to rehash */
     protected transient int threshold;
     /** Modification count for iterators */
     protected transient int modCount;
     /** Entry set */
-    protected transient EntrySet entrySet;
+    protected transient EntrySet<K, V> entrySet;
     /** Key set */
-    protected transient KeySet keySet;
+    protected transient KeySet<K> keySet;
     /** Values */
-    protected transient Values values;
+    protected transient Values<V> values;
 
     /**
      * Constructor only used in deserialization, do not use otherwise.
@@ -105,11 +105,12 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
 
     /**
      * Constructor which performs no validation on the passed in parameters.
-     * 
+     *
      * @param initialCapacity  the initial capacity, must be a power of two
      * @param loadFactor  the load factor, must be &gt; 0.0f and generally &lt; 1.0f
      * @param threshold  the threshold, must be sensible
      */
+    @SuppressWarnings("unchecked")
     protected AbstractHashedMap(int initialCapacity, float loadFactor, int threshold) {
         super();
         this.loadFactor = loadFactor;
@@ -120,7 +121,7 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
 
     /**
      * Constructs a new, empty map with the specified initial capacity and
-     * default load factor. 
+     * default load factor.
      *
      * @param initialCapacity  the initial capacity
      * @throws IllegalArgumentException if the initial capacity is less than one
@@ -131,13 +132,14 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
 
     /**
      * Constructs a new, empty map with the specified initial capacity and
-     * load factor. 
+     * load factor.
      *
      * @param initialCapacity  the initial capacity
      * @param loadFactor  the load factor
      * @throws IllegalArgumentException if the initial capacity is less than one
      * @throws IllegalArgumentException if the load factor is less than or equal to zero
      */
+    @SuppressWarnings("unchecked")
     protected AbstractHashedMap(int initialCapacity, float loadFactor) {
         super();
         if (initialCapacity < 1) {
@@ -159,7 +161,7 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
      * @param map  the map to copy
      * @throws NullPointerException if the map is null
      */
-    protected AbstractHashedMap(Map map) {
+    protected AbstractHashedMap(Map<K, V> map) {
         this(Math.max(2 * map.size(), DEFAULT_CAPACITY), DEFAULT_LOAD_FACTOR);
         putAll(map);
     }
@@ -173,14 +175,14 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
     //-----------------------------------------------------------------------
     /**
      * Gets the value mapped to the key specified.
-     * 
+     *
      * @param key  the key
      * @return the mapped value, null if no match
      */
-    public Object get(Object key) {
+    public V get(Object key) {
         key = convertKey(key);
         int hashCode = hash(key);
-        HashEntry entry = data[hashIndex(hashCode, data.length)]; // no local for hash index
+        HashEntry<K, V> entry = data[hashIndex(hashCode, data.length)]; // no local for hash index
         while (entry != null) {
             if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) {
                 return entry.getValue();
@@ -192,7 +194,7 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
 
     /**
      * Gets the size of the map.
-     * 
+     *
      * @return the size
      */
     public int size() {
@@ -201,7 +203,7 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
 
     /**
      * Checks whether the map is currently empty.
-     * 
+     *
      * @return true if the map is currently size zero
      */
     public boolean isEmpty() {
@@ -211,14 +213,14 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
     //-----------------------------------------------------------------------
     /**
      * Checks whether the map contains the specified key.
-     * 
+     *
      * @param key  the key to search for
      * @return true if the map contains the key
      */
     public boolean containsKey(Object key) {
         key = convertKey(key);
         int hashCode = hash(key);
-        HashEntry entry = data[hashIndex(hashCode, data.length)]; // no local for hash index
+        HashEntry<K, V> entry = data[hashIndex(hashCode, data.length)]; // no local for hash index
         while (entry != null) {
             if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) {
                 return true;
@@ -230,14 +232,14 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
 
     /**
      * Checks whether the map contains the specified value.
-     * 
+     *
      * @param value  the value to search for
      * @return true if the map contains the value
      */
     public boolean containsValue(Object value) {
         if (value == null) {
             for (int i = 0, isize = data.length; i < isize; i++) {
-                HashEntry entry = data[i];
+                HashEntry<K, V> entry = data[i];
                 while (entry != null) {
                     if (entry.getValue() == null) {
                         return true;
@@ -247,7 +249,7 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
             }
         } else {
             for (int i = 0, isize = data.length; i < isize; i++) {
-                HashEntry entry = data[i];
+                HashEntry<K, V> entry = data[i];
                 while (entry != null) {
                     if (isEqualValue(value, entry.getValue())) {
                         return true;
@@ -262,25 +264,25 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
     //-----------------------------------------------------------------------
     /**
      * Puts a key-value mapping into this map.
-     * 
+     *
      * @param key  the key to add
      * @param value  the value to add
      * @return the value previously mapped to this key, null if none
      */
-    public Object put(Object key, Object value) {
-        key = convertKey(key);
-        int hashCode = hash(key);
+    public V put(K key, V value) {
+        Object convertedKey = convertKey(key);
+        int hashCode = hash(convertedKey);
         int index = hashIndex(hashCode, data.length);
-        HashEntry entry = data[index];
+        HashEntry<K, V> entry = data[index];
         while (entry != null) {
-            if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) {
-                Object oldValue = entry.getValue();
+            if (entry.hashCode == hashCode && isEqualKey(convertedKey, entry.key)) {
+                V oldValue = entry.getValue();
                 updateEntry(entry, value);
                 return oldValue;
             }
             entry = entry.next;
         }
-        
+
         addMapping(index, hashCode, key, value);
         return null;
     }
@@ -290,38 +292,37 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
      * <p>
      * This implementation iterates around the specified map and
      * uses {@link #put(Object, Object)}.
-     * 
+     *
      * @param map  the map to add
      * @throws NullPointerException if the map is null
      */
-    public void putAll(Map map) {
+    public void putAll(Map<? extends K, ? extends V> map) {
         int mapSize = map.size();
         if (mapSize == 0) {
             return;
         }
         int newSize = (int) ((size + mapSize) / loadFactor + 1);
         ensureCapacity(calculateNewCapacity(newSize));
-        for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
-            Map.Entry entry = (Map.Entry) it.next();
+        for (Map.Entry<? extends K, ? extends V> entry: map.entrySet()) {
             put(entry.getKey(), entry.getValue());
         }
     }
 
     /**
      * Removes the specified mapping from this map.
-     * 
+     *
      * @param key  the mapping to remove
      * @return the value mapped to the removed key, null if key not in map
      */
-    public Object remove(Object key) {
+    public V remove(Object key) {
         key = convertKey(key);
         int hashCode = hash(key);
         int index = hashIndex(hashCode, data.length);
-        HashEntry entry = data[index];
-        HashEntry previous = null;
+        HashEntry<K, V> entry = data[index];
+        HashEntry<K, V> previous = null;
         while (entry != null) {
             if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) {
-                Object oldValue = entry.getValue();
+                V oldValue = entry.getValue();
                 removeMapping(entry, index, previous);
                 return oldValue;
             }
@@ -337,7 +338,7 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
      */
     public void clear() {
         modCount++;
-        HashEntry[] data = this.data;
+        HashEntry<K, V>[] data = this.data;
         for (int i = data.length - 1; i >= 0; i--) {
             data[i] = null;
         }
@@ -352,19 +353,19 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
      * <p>
      * The reverse conversion can be changed, if required, by overriding the
      * getKey() method in the hash entry.
-     * 
+     *
      * @param key  the key convert
      * @return the converted key
      */
     protected Object convertKey(Object key) {
         return (key == null ? NULL : key);
     }
-    
+
     /**
      * Gets the hash code for the key specified.
      * This implementation uses the additional hashing routine from JDK1.4.
      * Subclasses can override this to return alternate hash codes.
-     * 
+     *
      * @param key  the key to get a hash code for
      * @return the hash code
      */
@@ -377,12 +378,12 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
         h ^=  (h >>> 10);
         return h;
     }
-    
+
     /**
      * Compares two keys, in internal converted form, to see if they are equal.
      * This implementation uses the equals method and assumes neither key is null.
      * Subclasses can override this to match differently.
-     * 
+     *
      * @param key1  the first key to compare passed in from outside
      * @param key2  the second key extracted from the entry via <code>entry.key</code>
      * @return true if equal
@@ -390,12 +391,12 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
     protected boolean isEqualKey(Object key1, Object key2) {
         return (key1 == key2 || key1.equals(key2));
     }
-    
+
     /**
      * Compares two values, in external form, to see if they are equal.
      * This implementation uses the equals method and assumes neither value is null.
      * Subclasses can override this to match differently.
-     * 
+     *
      * @param value1  the first value to compare passed in from outside
      * @param value2  the second value extracted from the entry via <code>getValue()</code>
      * @return true if equal
@@ -403,12 +404,12 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
     protected boolean isEqualValue(Object value1, Object value2) {
         return (value1 == value2 || value1.equals(value2));
     }
-    
+
     /**
      * Gets the index into the data storage for the hashCode specified.
      * This implementation uses the least significant bits of the hashCode.
      * Subclasses can override this to return alternate bucketing.
-     * 
+     *
      * @param hashCode  the hash code to use
      * @param dataSize  the size of the data to pick a bucket from
      * @return the bucket index
@@ -416,7 +417,7 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
     protected int hashIndex(int hashCode, int dataSize) {
         return hashCode & (dataSize - 1);
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Gets the entry mapped to the key specified.
@@ -424,14 +425,14 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
      * This method exists for subclasses that may need to perform a multi-step
      * process accessing the entry. The public methods in this class don't use this
      * method to gain a small performance boost.
-     * 
+     *
      * @param key  the key
      * @return the entry, null if no match
      */
-    protected HashEntry getEntry(Object key) {
+    protected HashEntry<K, V> getEntry(Object key) {
         key = convertKey(key);
         int hashCode = hash(key);
-        HashEntry entry = data[hashIndex(hashCode, data.length)]; // no local for hash index
+        HashEntry<K, V> entry = data[hashIndex(hashCode, data.length)]; // no local for hash index
         while (entry != null) {
             if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) {
                 return entry;
@@ -447,33 +448,33 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
      * <p>
      * This implementation calls <code>setValue()</code> on the entry.
      * Subclasses could override to handle changes to the map.
-     * 
+     *
      * @param entry  the entry to update
      * @param newValue  the new value to store
      */
-    protected void updateEntry(HashEntry entry, Object newValue) {
+    protected void updateEntry(HashEntry<K, V> entry, V newValue) {
         entry.setValue(newValue);
     }
-    
+
     /**
      * Reuses an existing key-value mapping, storing completely new data.
      * <p>
      * This implementation sets all the data fields on the entry.
      * Subclasses could populate additional entry fields.
-     * 
+     *
      * @param entry  the entry to update, not null
      * @param hashIndex  the index in the data array
      * @param hashCode  the hash code of the key to add
      * @param key  the key to add
      * @param value  the value to add
      */
-    protected void reuseEntry(HashEntry entry, int hashIndex, int hashCode, Object key, Object value) {
+    protected void reuseEntry(HashEntry<K, V> entry, int hashIndex, int hashCode, K key, V value) {
         entry.next = data[hashIndex];
         entry.hashCode = hashCode;
         entry.key = key;
         entry.value = value;
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Adds a new key-value mapping into this map.
@@ -482,37 +483,37 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
      * and <code>checkCapacity()</code>.
      * It also handles changes to <code>modCount</code> and <code>size</code>.
      * Subclasses could override to fully control adds to the map.
-     * 
+     *
      * @param hashIndex  the index into the data array to store at
      * @param hashCode  the hash code of the key to add
      * @param key  the key to add
      * @param value  the value to add
      */
-    protected void addMapping(int hashIndex, int hashCode, Object key, Object value) {
+    protected void addMapping(int hashIndex, int hashCode, K key, V value) {
         modCount++;
-        HashEntry entry = createEntry(data[hashIndex], hashCode, key, value);
+        HashEntry<K, V> entry = createEntry(data[hashIndex], hashCode, key, value);
         addEntry(entry, hashIndex);
         size++;
         checkCapacity();
     }
-    
+
     /**
      * Creates an entry to store the key-value data.
      * <p>
      * This implementation creates a new HashEntry instance.
      * Subclasses can override this to return a different storage class,
      * or implement caching.
-     * 
+     *
      * @param next  the next entry in sequence
      * @param hashCode  the hash code to use
      * @param key  the key to store
      * @param value  the value to store
      * @return the newly created entry
      */
-    protected HashEntry createEntry(HashEntry next, int hashCode, Object key, Object value) {
-        return new HashEntry(next, hashCode, key, value);
+    protected HashEntry<K, V> createEntry(HashEntry<K, V> next, int hashCode, K key, V value) {
+        return new HashEntry<K, V>(next, hashCode, convertKey(key), value);
     }
-    
+
     /**
      * Adds an entry into this map.
      * <p>
@@ -522,10 +523,10 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
      * @param entry  the entry to add
      * @param hashIndex  the index into the data array to store at
      */
-    protected void addEntry(HashEntry entry, int hashIndex) {
+    protected void addEntry(HashEntry<K, V> entry, int hashIndex) {
         data[hashIndex] = entry;
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Removes a mapping from the map.
@@ -533,51 +534,51 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
      * This implementation calls <code>removeEntry()</code> and <code>destroyEntry()</code>.
      * It also handles changes to <code>modCount</code> and <code>size</code>.
      * Subclasses could override to fully control removals from the map.
-     * 
+     *
      * @param entry  the entry to remove
      * @param hashIndex  the index into the data structure
      * @param previous  the previous entry in the chain
      */
-    protected void removeMapping(HashEntry entry, int hashIndex, HashEntry previous) {
+    protected void removeMapping(HashEntry<K, V> entry, int hashIndex, HashEntry<K, V> previous) {
         modCount++;
         removeEntry(entry, hashIndex, previous);
         size--;
         destroyEntry(entry);
     }
-    
+
     /**
      * Removes an entry from the chain stored in a particular index.
      * <p>
      * This implementation removes the entry from the data storage table.
      * The size is not updated.
      * Subclasses could override to handle changes to the map.
-     * 
+     *
      * @param entry  the entry to remove
      * @param hashIndex  the index into the data structure
      * @param previous  the previous entry in the chain
      */
-    protected void removeEntry(HashEntry entry, int hashIndex, HashEntry previous) {
+    protected void removeEntry(HashEntry<K, V> entry, int hashIndex, HashEntry<K, V> previous) {
         if (previous == null) {
             data[hashIndex] = entry.next;
         } else {
             previous.next = entry.next;
         }
     }
-    
+
     /**
      * Kills an entry ready for the garbage collector.
      * <p>
      * This implementation prepares the HashEntry for garbage collection.
      * Subclasses can override this to implement caching (override clear as well).
-     * 
+     *
      * @param entry  the entry to destroy
      */
-    protected void destroyEntry(HashEntry entry) {
+    protected void destroyEntry(HashEntry<K, V> entry) {
         entry.next = null;
         entry.key = null;
         entry.value = null;
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Checks the capacity of the map and enlarges it if necessary.
@@ -592,12 +593,13 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
             }
         }
     }
-    
+
     /**
      * Changes the size of the data structure to the capacity proposed.
-     * 
+     *
      * @param newCapacity  the new capacity of the array (a power of two, less or equal to max)
      */
+    @SuppressWarnings("unchecked")
     protected void ensureCapacity(int newCapacity) {
         int oldCapacity = data.length;
         if (newCapacity <= oldCapacity) {
@@ -617,7 +619,7 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
                     oldEntries[i] = null;  // gc
                     do {
                         HashEntry next = entry.next;
-                        int index = hashIndex(entry.hashCode, newCapacity);  
+                        int index = hashIndex(entry.hashCode, newCapacity);
                         entry.next = newEntries[index];
                         newEntries[index] = entry;
                         entry = next;
@@ -632,7 +634,7 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
     /**
      * Calculates the new capacity of the map.
      * This implementation normalizes the capacity to a power of two.
-     * 
+     *
      * @param proposedCapacity  the proposed capacity
      * @return the normalized new capacity
      */
@@ -650,11 +652,11 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
         }
         return newCapacity;
     }
-    
+
     /**
      * Calculates the new threshold of the map, where it will be resized.
      * This implementation uses the load factor.
-     * 
+     *
      * @param newCapacity  the new capacity
      * @param factor  the load factor
      * @return the new resize threshold
@@ -662,60 +664,60 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
     protected int calculateThreshold(int newCapacity, float factor) {
         return (int) (newCapacity * factor);
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Gets the <code>next</code> field from a <code>HashEntry</code>.
      * Used in subclasses that have no visibility of the field.
-     * 
+     *
      * @param entry  the entry to query, must not be null
      * @return the <code>next</code> field of the entry
      * @throws NullPointerException if the entry is null
      * @since Commons Collections 3.1
      */
-    protected HashEntry entryNext(HashEntry entry) {
+    protected HashEntry<K, V> entryNext(HashEntry<K, V> entry) {
         return entry.next;
     }
-    
+
     /**
      * Gets the <code>hashCode</code> field from a <code>HashEntry</code>.
      * Used in subclasses that have no visibility of the field.
-     * 
+     *
      * @param entry  the entry to query, must not be null
      * @return the <code>hashCode</code> field of the entry
      * @throws NullPointerException if the entry is null
      * @since Commons Collections 3.1
      */
-    protected int entryHashCode(HashEntry entry) {
+    protected int entryHashCode(HashEntry<K, V> entry) {
         return entry.hashCode;
     }
-    
+
     /**
      * Gets the <code>key</code> field from a <code>HashEntry</code>.
      * Used in subclasses that have no visibility of the field.
-     * 
+     *
      * @param entry  the entry to query, must not be null
      * @return the <code>key</code> field of the entry
      * @throws NullPointerException if the entry is null
      * @since Commons Collections 3.1
      */
-    protected Object entryKey(HashEntry entry) {
-        return entry.key;
+    protected K entryKey(HashEntry<K, V> entry) {
+        return entry.getKey();
     }
-    
+
     /**
      * Gets the <code>value</code> field from a <code>HashEntry</code>.
      * Used in subclasses that have no visibility of the field.
-     * 
+     *
      * @param entry  the entry to query, must not be null
      * @return the <code>value</code> field of the entry
      * @throws NullPointerException if the entry is null
      * @since Commons Collections 3.1
      */
-    protected Object entryValue(HashEntry entry) {
-        return entry.value;
+    protected V entryValue(HashEntry<K, V> entry) {
+        return entry.getValue();
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Gets an iterator over the map.
@@ -725,90 +727,90 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
      * methods to get the key and value, and set the value.
      * It avoids the need to create an entrySet/keySet/values object.
      * It also avoids creating the Map.Entry object.
-     * 
+     *
      * @return the map iterator
      */
-    public MapIterator mapIterator() {
+    public MapIterator<K, V> mapIterator() {
         if (size == 0) {
-            return EmptyMapIterator.INSTANCE;
+            return EmptyMapIterator.<K, V>getInstance();
         }
-        return new HashMapIterator(this);
+        return new HashMapIterator<K, V>(this);
     }
 
     /**
      * MapIterator implementation.
      */
-    protected static class HashMapIterator extends HashIterator implements MapIterator {
-        
-        protected HashMapIterator(AbstractHashedMap parent) {
+    protected static class HashMapIterator<K, V> extends HashIterator<K, V> implements MapIterator<K, V> {
+
+        protected HashMapIterator(AbstractHashedMap<K, V> parent) {
             super(parent);
         }
 
-        public Object next() {
+        public K next() {
             return super.nextEntry().getKey();
         }
 
-        public Object getKey() {
-            HashEntry current = currentEntry();
+        public K getKey() {
+            HashEntry<K, V> current = currentEntry();
             if (current == null) {
                 throw new IllegalStateException(AbstractHashedMap.GETKEY_INVALID);
             }
             return current.getKey();
         }
 
-        public Object getValue() {
-            HashEntry current = currentEntry();
+        public V getValue() {
+            HashEntry<K, V> current = currentEntry();
             if (current == null) {
                 throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID);
             }
             return current.getValue();
         }
 
-        public Object setValue(Object value) {
-            HashEntry current = currentEntry();
+        public V setValue(V value) {
+            HashEntry<K, V> current = currentEntry();
             if (current == null) {
                 throw new IllegalStateException(AbstractHashedMap.SETVALUE_INVALID);
             }
             return current.setValue(value);
         }
     }
-    
-    //-----------------------------------------------------------------------    
+
+    //-----------------------------------------------------------------------
     /**
      * Gets the entrySet view of the map.
      * Changes made to the view affect this map.
      * To simply iterate through the entries, use {@link #mapIterator()}.
-     * 
+     *
      * @return the entrySet view
      */
-    public Set entrySet() {
+    public Set<Map.Entry<K, V>> entrySet() {
         if (entrySet == null) {
-            entrySet = new EntrySet(this);
+            entrySet = new EntrySet<K, V>(this);
         }
         return entrySet;
     }
-    
+
     /**
      * Creates an entry set iterator.
      * Subclasses can override this to return iterators with different properties.
-     * 
+     *
      * @return the entrySet iterator
      */
-    protected Iterator createEntrySetIterator() {
+    protected Iterator<Map.Entry<K, V>> createEntrySetIterator() {
         if (size() == 0) {
-            return EmptyIterator.INSTANCE;
+            return EmptyIterator.<Map.Entry<K, V>>getInstance();
         }
-        return new EntrySetIterator(this);
+        return new EntrySetIterator<K, V>(this);
     }
 
     /**
      * EntrySet implementation.
      */
-    protected static class EntrySet extends AbstractSet {
+    protected static class EntrySet<K, V> extends AbstractSet<Map.Entry<K, V>> {
         /** The parent map */
-        protected final AbstractHashedMap parent;
-        
-        protected EntrySet(AbstractHashedMap parent) {
+        protected final AbstractHashedMap<K, V> parent;
+
+        protected EntrySet(AbstractHashedMap<K, V> parent) {
             super();
             this.parent = parent;
         }
@@ -816,20 +818,20 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
         public int size() {
             return parent.size();
         }
-        
+
         public void clear() {
             parent.clear();
         }
-        
+
         public boolean contains(Object entry) {
             if (entry instanceof Map.Entry) {
-                Map.Entry e = (Map.Entry) entry;
-                Entry match = parent.getEntry(e.getKey());
+                Map.Entry<?, ?> e = (Map.Entry<?, ?>) entry;
+                Entry<K, V> match = parent.getEntry(e.getKey());
                 return (match != null && match.equals(e));
             }
             return false;
         }
-        
+
         public boolean remove(Object obj) {
             if (obj instanceof Map.Entry == false) {
                 return false;
@@ -837,13 +839,12 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
             if (contains(obj) == false) {
                 return false;
             }
-            Map.Entry entry = (Map.Entry) obj;
-            Object key = entry.getKey();
-            parent.remove(key);
+            Map.Entry<?, ?> entry = (Map.Entry<?, ?>) obj;
+            parent.remove(entry.getKey());
             return true;
         }
 
-        public Iterator iterator() {
+        public Iterator<Map.Entry<K, V>> iterator() {
             return parent.createEntrySetIterator();
         }
     }
@@ -851,28 +852,28 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
     /**
      * EntrySet iterator.
      */
-    protected static class EntrySetIterator extends HashIterator {
-        
-        protected EntrySetIterator(AbstractHashedMap parent) {
+    protected static class EntrySetIterator<K, V> extends HashIterator<K, V> implements Iterator<Map.Entry<K, V>> {
+
+        protected EntrySetIterator(AbstractHashedMap<K, V> parent) {
             super(parent);
         }
 
-        public Object next() {
+        public Map.Entry<K, V> next() {
             return super.nextEntry();
         }
     }
 
-    //-----------------------------------------------------------------------    
+    //-----------------------------------------------------------------------
     /**
      * Gets the keySet view of the map.
      * Changes made to the view affect this map.
      * To simply iterate through the keys, use {@link #mapIterator()}.
-     * 
+     *
      * @return the keySet view
      */
-    public Set keySet() {
+    public Set<K> keySet() {
         if (keySet == null) {
-            keySet = new KeySet(this);
+            keySet = new KeySet<K>(this);
         }
         return keySet;
     }
@@ -880,24 +881,24 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
     /**
      * Creates a key set iterator.
      * Subclasses can override this to return iterators with different properties.
-     * 
+     *
      * @return the keySet iterator
      */
-    protected Iterator createKeySetIterator() {
+    protected Iterator<K> createKeySetIterator() {
         if (size() == 0) {
-            return EmptyIterator.INSTANCE;
+            return EmptyIterator.<K>getInstance();
         }
-        return new KeySetIterator(this);
+        return new KeySetIterator<K>(this);
     }
 
     /**
      * KeySet implementation.
      */
-    protected static class KeySet extends AbstractSet {
+    protected static class KeySet<K> extends AbstractSet<K> {
         /** The parent map */
-        protected final AbstractHashedMap parent;
-        
-        protected KeySet(AbstractHashedMap parent) {
+        protected final AbstractHashedMap<K, ?> parent;
+
+        protected KeySet(AbstractHashedMap<K, ?> parent) {
             super();
             this.parent = parent;
         }
@@ -905,22 +906,22 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
         public int size() {
             return parent.size();
         }
-        
+
         public void clear() {
             parent.clear();
         }
-        
+
         public boolean contains(Object key) {
             return parent.containsKey(key);
         }
-        
+
         public boolean remove(Object key) {
             boolean result = parent.containsKey(key);
             parent.remove(key);
             return result;
         }
 
-        public Iterator iterator() {
+        public Iterator<K> iterator() {
             return parent.createKeySetIterator();
         }
     }
@@ -928,28 +929,29 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
     /**
      * KeySet iterator.
      */
-    protected static class KeySetIterator extends EntrySetIterator {
-        
-        protected KeySetIterator(AbstractHashedMap parent) {
-            super(parent);
+    protected static class KeySetIterator<K> extends HashIterator<K, Object> implements Iterator<K> {
+
+        @SuppressWarnings("unchecked")
+        protected KeySetIterator(AbstractHashedMap<K, ?> parent) {
+            super((AbstractHashedMap<K, Object>) parent);
         }
 
-        public Object next() {
+        public K next() {
             return super.nextEntry().getKey();
         }
     }
-    
-    //-----------------------------------------------------------------------    
+
+    //-----------------------------------------------------------------------
     /**
      * Gets the values view of the map.
      * Changes made to the view affect this map.
      * To simply iterate through the values, use {@link #mapIterator()}.
-     * 
+     *
      * @return the values view
      */
-    public Collection values() {
+    public Collection<V> values() {
         if (values == null) {
-            values = new Values(this);
+            values = new Values<V>(this);
         }
         return values;
     }
@@ -957,24 +959,24 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
     /**
      * Creates a values iterator.
      * Subclasses can override this to return iterators with different properties.
-     * 
+     *
      * @return the values iterator
      */
-    protected Iterator createValuesIterator() {
+    protected Iterator<V> createValuesIterator() {
         if (size() == 0) {
-            return EmptyIterator.INSTANCE;
+            return EmptyIterator.<V>getInstance();
         }
-        return new ValuesIterator(this);
+        return new ValuesIterator<V>(this);
     }
 
     /**
      * Values implementation.
      */
-    protected static class Values extends AbstractCollection {
+    protected static class Values<V> extends AbstractCollection<V> {
         /** The parent map */
-        protected final AbstractHashedMap parent;
-        
-        protected Values(AbstractHashedMap parent) {
+        protected final AbstractHashedMap<?, V> parent;
+
+        protected Values(AbstractHashedMap<?, V> parent) {
             super();
             this.parent = parent;
         }
@@ -982,16 +984,16 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
         public int size() {
             return parent.size();
         }
-        
+
         public void clear() {
             parent.clear();
         }
-        
+
         public boolean contains(Object value) {
             return parent.containsValue(value);
         }
-        
-        public Iterator iterator() {
+
+        public Iterator<V> iterator() {
             return parent.createValuesIterator();
         }
     }
@@ -999,17 +1001,18 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
     /**
      * Values iterator.
      */
-    protected static class ValuesIterator extends HashIterator {
-        
-        protected ValuesIterator(AbstractHashedMap parent) {
-            super(parent);
+    protected static class ValuesIterator<V> extends HashIterator<Object, V> implements Iterator<V> {
+
+        @SuppressWarnings("unchecked")
+        protected ValuesIterator(AbstractHashedMap<?, V> parent) {
+            super((AbstractHashedMap<Object, V>) parent);
         }
 
-        public Object next() {
+        public V next() {
             return super.nextEntry().getValue();
         }
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * HashEntry used to store the data.
@@ -1019,38 +1022,44 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
      * The <code>entryXxx()</code> methods on <code>AbstractHashedMap</code> exist
      * to provide the necessary access.
      */
-    protected static class HashEntry implements Map.Entry, KeyValue {
+    protected static class HashEntry<K, V> implements Map.Entry<K, V>, KeyValue<K, V> {
         /** The next entry in the hash chain */
-        protected HashEntry next;
+        protected HashEntry<K, V> next;
         /** The hash code of the key */
         protected int hashCode;
         /** The key */
         protected Object key;
         /** The value */
         protected Object value;
-        
-        protected HashEntry(HashEntry next, int hashCode, Object key, Object value) {
+
+        protected HashEntry(HashEntry<K, V> next, int hashCode, Object key, V value) {
             super();
             this.next = next;
             this.hashCode = hashCode;
             this.key = key;
             this.value = value;
         }
-        
-        public Object getKey() {
-            return (key == NULL ? null : key);
+
+        @SuppressWarnings("unchecked")
+        public K getKey() {
+            if (key == NULL) {
+                return null;
+            }
+            return (K) key;
         }
-        
-        public Object getValue() {
-            return value;
+
+        @SuppressWarnings("unchecked")
+        public V getValue() {
+            return (V) value;
         }
-        
-        public Object setValue(Object value) {
+
+        @SuppressWarnings("unchecked")
+        public V setValue(V value) {
             Object old = this.value;
             this.value = value;
-            return old;
+            return (V) old;
         }
-        
+
         public boolean equals(Object obj) {
             if (obj == this) {
                 return true;
@@ -1058,44 +1067,44 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
             if (obj instanceof Map.Entry == false) {
                 return false;
             }
-            Map.Entry other = (Map.Entry) obj;
+            Map.Entry<?, ?> other = (Map.Entry<?, ?>) obj;
             return
                 (getKey() == null ? other.getKey() == null : getKey().equals(other.getKey())) &&
                 (getValue() == null ? other.getValue() == null : getValue().equals(other.getValue()));
         }
-        
+
         public int hashCode() {
             return (getKey() == null ? 0 : getKey().hashCode()) ^
-                   (getValue() == null ? 0 : getValue().hashCode()); 
+                   (getValue() == null ? 0 : getValue().hashCode());
         }
-        
+
         public String toString() {
             return new StringBuffer().append(getKey()).append('=').append(getValue()).toString();
         }
     }
-    
+
     /**
      * Base Iterator
      */
-    protected static abstract class HashIterator implements Iterator {
-        
+    protected static abstract class HashIterator<K, V> {
+
         /** The parent map */
-        protected final AbstractHashedMap parent;
+        protected final AbstractHashedMap<K, V> parent;
         /** The current index into the array of buckets */
         protected int hashIndex;
         /** The last returned entry */
-        protected HashEntry last;
+        protected HashEntry<K, V> last;
         /** The next entry */
-        protected HashEntry next;
+        protected HashEntry<K, V> next;
         /** The modification count expected */
         protected int expectedModCount;
-        
-        protected HashIterator(AbstractHashedMap parent) {
+
+        protected HashIterator(AbstractHashedMap<K, V> parent) {
             super();
             this.parent = parent;
-            HashEntry[] data = parent.data;
+            HashEntry<K, V>[] data = parent.data;
             int i = data.length;
-            HashEntry next = null;
+            HashEntry<K, V> next = null;
             while (i > 0 && next == null) {
                 next = data[--i];
             }
@@ -1108,17 +1117,17 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
             return (next != null);
         }
 
-        protected HashEntry nextEntry() { 
+        protected HashEntry<K, V> nextEntry() {
             if (parent.modCount != expectedModCount) {
                 throw new ConcurrentModificationException();
             }
-            HashEntry newCurrent = next;
+            HashEntry<K, V> newCurrent = next;
             if (newCurrent == null)  {
                 throw new NoSuchElementException(AbstractHashedMap.NO_NEXT_ENTRY);
             }
-            HashEntry[] data = parent.data;
+            HashEntry<K, V>[] data = parent.data;
             int i = hashIndex;
-            HashEntry n = newCurrent.next;
+            HashEntry<K, V> n = newCurrent.next;
             while (n == null && i > 0) {
                 n = data[--i];
             }
@@ -1128,10 +1137,10 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
             return newCurrent;
         }
 
-        protected HashEntry currentEntry() {
+        protected HashEntry<K, V> currentEntry() {
             return last;
         }
-        
+
         public void remove() {
             if (last == null) {
                 throw new IllegalStateException(AbstractHashedMap.REMOVE_INVALID);
@@ -1147,12 +1156,11 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
         public String toString() {
             if (last != null) {
                 return "Iterator[" + last.getKey() + "=" + last.getValue() + "]";
-            } else {
-                return "Iterator[]";
             }
+            return "Iterator[]";
         }
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Writes the map data to the stream. This method must be overridden if a
@@ -1170,14 +1178,14 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
      * Subclasses may override if they have a specific field that must be present
      * on read before this implementation will work. Generally, the read determines
      * what must be serialized here, if anything.
-     * 
+     *
      * @param out  the output stream
      */
     protected void doWriteObject(ObjectOutputStream out) throws IOException {
         out.writeFloat(loadFactor);
         out.writeInt(data.length);
         out.writeInt(size);
-        for (MapIterator it = mapIterator(); it.hasNext();) {
+        for (MapIterator<K, V> it = mapIterator(); it.hasNext();) {
             out.writeObject(it.next());
             out.writeObject(it.getValue());
         }
@@ -1198,9 +1206,10 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
      * <p>
      * Subclasses may override if the subclass has a specific field that must be present
      * before <code>put()</code> or <code>calculateThreshold()</code> will work correctly.
-     * 
+     *
      * @param in  the input stream
      */
+    @SuppressWarnings("unchecked")
     protected void doReadObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         loadFactor = in.readFloat();
         int capacity = in.readInt();
@@ -1209,12 +1218,12 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
         threshold = calculateThreshold(capacity, loadFactor);
         data = new HashEntry[capacity];
         for (int i = 0; i < size; i++) {
-            Object key = in.readObject();
-            Object value = in.readObject();
+            K key = (K) in.readObject();
+            V value = (V) in.readObject();
             put(key, value);
         }
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Clones the map without cloning the keys or values.
@@ -1224,9 +1233,10 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
      *
      * @return a shallow clone
      */
-    protected Object clone() {
+    @SuppressWarnings("unchecked")
+    protected AbstractHashedMap<K, V> clone() {
         try {
-            AbstractHashedMap cloned = (AbstractHashedMap) super.clone();
+            AbstractHashedMap<K, V> cloned = (AbstractHashedMap<K, V>) super.clone();
             cloned.data = new HashEntry[data.length];
             cloned.entrySet = null;
             cloned.keySet = null;
@@ -1236,18 +1246,18 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
             cloned.init();
             cloned.putAll(this);
             return cloned;
-            
         } catch (CloneNotSupportedException ex) {
             return null;  // should never happen
         }
     }
-    
+
     /**
      * Compares this map with another.
-     * 
+     *
      * @param obj  the object to compare to
      * @return true if equal
      */
+    @SuppressWarnings("unchecked")
     public boolean equals(Object obj) {
         if (obj == this) {
             return true;
@@ -1284,12 +1294,12 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
 
     /**
      * Gets the standard Map hashCode.
-     * 
+     *
      * @return the hash code defined in the Map interface
      */
     public int hashCode() {
         int total = 0;
-        Iterator it = createEntrySetIterator();
+        Iterator<Map.Entry<K, V>> it = createEntrySetIterator();
         while (it.hasNext()) {
             total += it.next().hashCode();
         }
@@ -1298,7 +1308,7 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
 
     /**
      * Gets the map as a String.
-     * 
+     *
      * @return a string version of the map
      */
     public String toString() {
@@ -1308,11 +1318,11 @@ public class AbstractHashedMap extends AbstractMap implements IterableMap {
         StringBuffer buf = new StringBuffer(32 * size());
         buf.append('{');
 
-        MapIterator it = mapIterator();
+        MapIterator<K, V> it = mapIterator();
         boolean hasNext = it.hasNext();
         while (hasNext) {
-            Object key = it.next();
-            Object value = it.getValue();
+            K key = it.next();
+            V value = it.getValue();
             buf.append(key == this ? "(this Map)" : key)
                .append('=')
                .append(value == this ? "(this Map)" : value);


[33/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/IteratorUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/IteratorUtils.java b/src/java/org/apache/commons/collections/IteratorUtils.java
index c84957f..eba8e37 100644
--- a/src/java/org/apache/commons/collections/IteratorUtils.java
+++ b/src/java/org/apache/commons/collections/IteratorUtils.java
@@ -81,26 +81,30 @@ public class IteratorUtils {
      * WARNING: This constant is binary incompatible with Commons Collections 2.1 and 2.1.1.
      * Use <code>EmptyIterator.INSTANCE</code> for compatability with Commons Collections 2.1.1.
      */
-    public static final ResettableIterator EMPTY_ITERATOR = EmptyIterator.RESETTABLE_INSTANCE;
+    public static final ResettableIterator<Object> EMPTY_ITERATOR = EmptyIterator.RESETTABLE_INSTANCE;
+
     /**
      * A list iterator over no elements.
      * <p>
      * WARNING: This constant is binary incompatible with Commons Collections 2.1 and 2.1.1.
      * Use <code>EmptyListIterator.INSTANCE</code> for compatability with Commons Collections 2.1.1.
      */
-    public static final ResettableListIterator EMPTY_LIST_ITERATOR = EmptyListIterator.RESETTABLE_INSTANCE;
+    public static final ResettableListIterator<Object> EMPTY_LIST_ITERATOR = EmptyListIterator.RESETTABLE_INSTANCE;
+
     /**
      * An ordered iterator over no elements.
      */    
-    public static final OrderedIterator EMPTY_ORDERED_ITERATOR = EmptyOrderedIterator.INSTANCE;
+    public static final OrderedIterator<Object> EMPTY_ORDERED_ITERATOR = EmptyOrderedIterator.INSTANCE;
+
     /**
      * A map iterator over no elements.
      */    
-    public static final MapIterator EMPTY_MAP_ITERATOR = EmptyMapIterator.INSTANCE;
+    public static final MapIterator<Object, Object> EMPTY_MAP_ITERATOR = EmptyMapIterator.INSTANCE;
+
     /**
      * An ordered map iterator over no elements.
      */    
-    public static final OrderedMapIterator EMPTY_ORDERED_MAP_ITERATOR = EmptyOrderedMapIterator.INSTANCE;
+    public static final OrderedMapIterator<Object, Object> EMPTY_ORDERED_MAP_ITERATOR = EmptyOrderedMapIterator.INSTANCE;
 
     /**
      * IteratorUtils is not normally instantiated.
@@ -121,8 +125,8 @@ public class IteratorUtils {
      *
      * @return  an iterator over nothing
      */
-    public static ResettableIterator emptyIterator() {
-        return EMPTY_ITERATOR;
+    public static <E> ResettableIterator<E> emptyIterator() {
+        return EmptyIterator.<E>getResettableInstance();
     }
 
     /**
@@ -136,8 +140,8 @@ public class IteratorUtils {
      *
      * @return  a list iterator over nothing
      */
-    public static ResettableListIterator emptyListIterator() {
-        return EMPTY_LIST_ITERATOR;
+    public static <E> ResettableListIterator<E> emptyListIterator() {
+        return EmptyListIterator.<E>getResettableInstance();
     }
 
     /**
@@ -148,8 +152,8 @@ public class IteratorUtils {
      *
      * @return  an ordered iterator over nothing
      */
-    public static OrderedIterator emptyOrderedIterator() {
-        return EMPTY_ORDERED_ITERATOR;
+    public static <E> OrderedIterator<E> emptyOrderedIterator() {
+        return EmptyOrderedIterator.<E>getInstance();
     }
 
     /**
@@ -160,8 +164,8 @@ public class IteratorUtils {
      *
      * @return  a map iterator over nothing
      */
-    public static MapIterator emptyMapIterator() {
-        return EMPTY_MAP_ITERATOR;
+    public static <K, V> MapIterator<K, V> emptyMapIterator() {
+        return EmptyMapIterator.<K, V>getInstance();
     }
 
     /**
@@ -172,8 +176,8 @@ public class IteratorUtils {
      *
      * @return  a map iterator over nothing
      */
-    public static OrderedMapIterator emptyOrderedMapIterator() {
-        return EMPTY_ORDERED_MAP_ITERATOR;
+    public static <K, V> OrderedMapIterator<K, V> emptyOrderedMapIterator() {
+        return EmptyOrderedMapIterator.<K, V>getInstance();
     }
 
     // Singleton
@@ -190,8 +194,8 @@ public class IteratorUtils {
      * @param object  the single object over which to iterate
      * @return  a singleton iterator over the object
      */
-    public static ResettableIterator singletonIterator(Object object) {
-        return new SingletonIterator(object);
+    public static <E> ResettableIterator<E> singletonIterator(E object) {
+        return new SingletonIterator<E>(object);
     }
 
     /**
@@ -203,8 +207,8 @@ public class IteratorUtils {
      * @param object  the single object over which to iterate
      * @return  a singleton list iterator over the object
      */
-    public static ListIterator singletonListIterator(Object object) {
-        return new SingletonListIterator(object);
+    public static <E> ListIterator<E> singletonListIterator(E object) {
+        return new SingletonListIterator<E>(object);
     }
 
     // Arrays
@@ -219,8 +223,8 @@ public class IteratorUtils {
      * @return  an iterator over the array
      * @throws NullPointerException if array is null
      */
-    public static ResettableIterator arrayIterator(Object[] array) {
-        return new ObjectArrayIterator(array);
+    public static <E> ResettableIterator<E> arrayIterator(E[] array) {
+        return new ObjectArrayIterator<E>(array);
     }
 
     /**
@@ -234,8 +238,8 @@ public class IteratorUtils {
      * @throws IllegalArgumentException if the array is not an array
      * @throws NullPointerException if array is null
      */
-    public static ResettableIterator arrayIterator(Object array) {
-        return new ArrayIterator(array);
+    public static <E> ResettableIterator<E> arrayIterator(Object array) {
+        return new ArrayIterator<E>(array);
     }
 
     /**
@@ -251,8 +255,8 @@ public class IteratorUtils {
      *  than the length of the array
      * @throws NullPointerException if array is null
      */
-    public static ResettableIterator arrayIterator(Object[] array, int start) {
-        return new ObjectArrayIterator(array, start);
+    public static <E> ResettableIterator<E> arrayIterator(E[] array, int start) {
+        return new ObjectArrayIterator<E>(array, start);
     }
 
     /**
@@ -269,8 +273,8 @@ public class IteratorUtils {
      *  than the length of the array
      * @throws NullPointerException if array is null
      */
-    public static ResettableIterator arrayIterator(Object array, int start) {
-        return new ArrayIterator(array, start);
+    public static <E> ResettableIterator<E> arrayIterator(Object array, int start) {
+        return new ArrayIterator<E>(array, start);
     }
 
     /**
@@ -287,8 +291,8 @@ public class IteratorUtils {
      * @throws IllegalArgumentException if end is before start
      * @throws NullPointerException if array is null
      */
-    public static ResettableIterator arrayIterator(Object[] array, int start, int end) {
-        return new ObjectArrayIterator(array, start, end);
+    public static <E> ResettableIterator<E> arrayIterator(E[] array, int start, int end) {
+        return new ObjectArrayIterator<E>(array, start, end);
     }
 
     /**
@@ -306,8 +310,8 @@ public class IteratorUtils {
      * @throws IllegalArgumentException if end is before start
      * @throws NullPointerException if array is null
      */
-    public static ResettableIterator arrayIterator(Object array, int start, int end) {
-        return new ArrayIterator(array, start, end);
+    public static <E> ResettableIterator<E> arrayIterator(Object array, int start, int end) {
+        return new ArrayIterator<E>(array, start, end);
     }
 
     //-----------------------------------------------------------------------
@@ -318,8 +322,8 @@ public class IteratorUtils {
      * @return  a list iterator over the array
      * @throws NullPointerException if array is null
      */
-    public static ResettableListIterator arrayListIterator(Object[] array) {
-        return new ObjectArrayListIterator(array);
+    public static <E> ResettableListIterator<E> arrayListIterator(E[] array) {
+        return new ObjectArrayListIterator<E>(array);
     }
 
     /**
@@ -333,8 +337,8 @@ public class IteratorUtils {
      * @throws IllegalArgumentException if the array is not an array
      * @throws NullPointerException if array is null
      */
-    public static ResettableListIterator arrayListIterator(Object array) {
-        return new ArrayListIterator(array);
+    public static <E> ResettableListIterator<E> arrayListIterator(Object array) {
+        return new ArrayListIterator<E>(array);
     }
 
     /**
@@ -346,8 +350,8 @@ public class IteratorUtils {
      * @throws IndexOutOfBoundsException if start is less than zero
      * @throws NullPointerException if array is null
      */
-    public static ResettableListIterator arrayListIterator(Object[] array, int start) {
-        return new ObjectArrayListIterator(array, start);
+    public static <E> ResettableListIterator<E> arrayListIterator(E[] array, int start) {
+        return new ObjectArrayListIterator<E>(array, start);
     }
 
     /**
@@ -363,8 +367,8 @@ public class IteratorUtils {
      * @throws IndexOutOfBoundsException if start is less than zero
      * @throws NullPointerException if array is null
      */
-    public static ResettableListIterator arrayListIterator(Object array, int start) {
-        return new ArrayListIterator(array, start);
+    public static <E> ResettableListIterator<E> arrayListIterator(Object array, int start) {
+        return new ArrayListIterator<E>(array, start);
     }
 
     /**
@@ -378,8 +382,8 @@ public class IteratorUtils {
      * @throws IllegalArgumentException if end is before start
      * @throws NullPointerException if array is null
      */
-    public static ResettableListIterator arrayListIterator(Object[] array, int start, int end) {
-        return new ObjectArrayListIterator(array, start, end);
+    public static <E> ResettableListIterator<E> arrayListIterator(E[] array, int start, int end) {
+        return new ObjectArrayListIterator<E>(array, start, end);
     }
     
     /**
@@ -397,8 +401,8 @@ public class IteratorUtils {
      * @throws IllegalArgumentException if end is before start
      * @throws NullPointerException if array is null
      */
-    public static ResettableListIterator arrayListIterator(Object array, int start, int end) {
-        return new ArrayListIterator(array, start, end);
+    public static <E> ResettableListIterator<E> arrayListIterator(Object array, int start, int end) {
+        return new ArrayListIterator<E>(array, start, end);
     }
     
     // Unmodifiable
@@ -411,7 +415,7 @@ public class IteratorUtils {
      * @param iterator  the iterator to make immutable
      * @return an immutable version of the iterator
      */
-    public static Iterator unmodifiableIterator(Iterator iterator) {
+    public static <E> Iterator<E> unmodifiableIterator(Iterator<E> iterator) {
         return UnmodifiableIterator.decorate(iterator);
     }
     
@@ -424,7 +428,7 @@ public class IteratorUtils {
      * @param listIterator  the iterator to make immutable
      * @return an immutable version of the iterator
      */
-    public static ListIterator unmodifiableListIterator(ListIterator listIterator) {
+    public static <E> ListIterator<E> unmodifiableListIterator(ListIterator<E> listIterator) {
         return UnmodifiableListIterator.decorate(listIterator);
     }
 
@@ -436,7 +440,7 @@ public class IteratorUtils {
      * @param mapIterator  the iterator to make immutable
      * @return an immutable version of the iterator
      */
-    public static MapIterator unmodifiableMapIterator(MapIterator mapIterator) {
+    public static <K, V> MapIterator<K, V> unmodifiableMapIterator(MapIterator<K, V> mapIterator) {
         return UnmodifiableMapIterator.decorate(mapIterator);
     }
 
@@ -451,8 +455,8 @@ public class IteratorUtils {
      * @return a combination iterator over the iterators
      * @throws NullPointerException if either iterator is null
      */
-    public static Iterator chainedIterator(Iterator iterator1, Iterator iterator2) {
-        return new IteratorChain(iterator1, iterator2);
+    public static <E> Iterator<E> chainedIterator(Iterator<? extends E> iterator1, Iterator<? extends E> iterator2) {
+        return new IteratorChain<E>(iterator1, iterator2);
     }
 
     /**
@@ -463,8 +467,8 @@ public class IteratorUtils {
      * @return a combination iterator over the iterators
      * @throws NullPointerException if iterators array is null or contains a null
      */
-    public static Iterator chainedIterator(Iterator[] iterators) {
-        return new IteratorChain(iterators);
+    public static <E> Iterator<E> chainedIterator(Iterator<? extends E>[] iterators) {
+        return new IteratorChain<E>(iterators);
     }
 
     /**
@@ -476,8 +480,8 @@ public class IteratorUtils {
      * @throws NullPointerException if iterators collection is null or contains a null
      * @throws ClassCastException if the iterators collection contains the wrong object type
      */
-    public static Iterator chainedIterator(Collection iterators) {
-        return new IteratorChain(iterators);
+    public static <E> Iterator<E> chainedIterator(Collection<Iterator<? extends E>> iterators) {
+        return new IteratorChain<E>(iterators);
     }
 
     // Collated
@@ -498,8 +502,8 @@ public class IteratorUtils {
      * @return a combination iterator over the iterators
      * @throws NullPointerException if either iterator is null
      */
-    public static Iterator collatedIterator(Comparator comparator, Iterator iterator1, Iterator iterator2) {
-        return new CollatingIterator(comparator, iterator1, iterator2);
+    public static <E> Iterator<E> collatedIterator(Comparator<? super E> comparator, Iterator<? extends E> iterator1, Iterator<? extends E> iterator2) {
+        return new CollatingIterator<E>(comparator, iterator1, iterator2);
     }
 
     /**
@@ -517,8 +521,8 @@ public class IteratorUtils {
      * @return a combination iterator over the iterators
      * @throws NullPointerException if iterators array is null or contains a null
      */
-    public static Iterator collatedIterator(Comparator comparator, Iterator[] iterators) {
-        return new CollatingIterator(comparator, iterators);
+    public static <E> Iterator<E> collatedIterator(Comparator<? super E> comparator, Iterator<? extends E>[] iterators) {
+        return new CollatingIterator<E>(comparator, iterators);
     }
 
     /**
@@ -537,8 +541,9 @@ public class IteratorUtils {
      * @throws NullPointerException if iterators collection is null or contains a null
      * @throws ClassCastException if the iterators collection contains the wrong object type
      */
-    public static Iterator collatedIterator(Comparator comparator, Collection iterators) {
-        return new CollatingIterator(comparator, iterators);
+    public static <E> Iterator<E> collatedIterator(Comparator<? super E> comparator,
+            Collection<Iterator<? extends E>> iterators) {
+        return new CollatingIterator<E>(comparator, iterators);
     }
     
     // Object Graph
@@ -596,8 +601,8 @@ public class IteratorUtils {
      * @return a new object graph iterator
      * @since Commons Collections 3.1
      */
-    public static Iterator objectGraphIterator(Object root, Transformer transformer) {
-        return new ObjectGraphIterator(root, transformer);
+    public static <E> Iterator<E> objectGraphIterator(E root, Transformer<? super E, ? extends E> transformer) {
+        return new ObjectGraphIterator<E>(root, transformer);
     }
     
     // Transformed
@@ -613,14 +618,14 @@ public class IteratorUtils {
      * @return a new transforming iterator
      * @throws NullPointerException if either parameter is null
      */
-    public static Iterator transformedIterator(Iterator iterator, Transformer transform) {
+    public static <I, O> Iterator<O> transformedIterator(Iterator<? extends I> iterator, Transformer<? super I, ? extends O> transform) {
         if (iterator == null) {
             throw new NullPointerException("Iterator must not be null");
         }
         if (transform == null) {
             throw new NullPointerException("Transformer must not be null");
         }
-        return new TransformIterator(iterator, transform);
+        return new TransformIterator<I, O>(iterator, transform);
     }
     
     // Filtered
@@ -636,14 +641,14 @@ public class IteratorUtils {
      * @return a new filtered iterator
      * @throws NullPointerException if either parameter is null
      */
-    public static Iterator filteredIterator(Iterator iterator, Predicate predicate) {
+    public static <E> Iterator<E> filteredIterator(Iterator<? extends E> iterator, Predicate<? super E> predicate) {
         if (iterator == null) {
             throw new NullPointerException("Iterator must not be null");
         }
         if (predicate == null) {
             throw new NullPointerException("Predicate must not be null");
         }
-        return new FilterIterator(iterator, predicate);
+        return new FilterIterator<E>(iterator, predicate);
     }
     
     /**
@@ -657,14 +662,14 @@ public class IteratorUtils {
      * @return a new filtered iterator
      * @throws NullPointerException if either parameter is null
      */
-    public static ListIterator filteredListIterator(ListIterator listIterator, Predicate predicate) {
+    public static <E> ListIterator<E> filteredListIterator(ListIterator<? extends E> listIterator, Predicate<? super E> predicate) {
         if (listIterator == null) {
             throw new NullPointerException("ListIterator must not be null");
         }
         if (predicate == null) {
             throw new NullPointerException("Predicate must not be null");
         }
-        return new FilterListIterator(listIterator, predicate);
+        return new FilterListIterator<E>(listIterator, predicate);
     }
     
     // Looping
@@ -680,11 +685,11 @@ public class IteratorUtils {
      * @return a new looping iterator
      * @throws NullPointerException if the collection is null
      */
-    public static ResettableIterator loopingIterator(Collection coll) {
+    public static <E> ResettableIterator<E> loopingIterator(Collection<? extends E> coll) {
         if (coll == null) {
             throw new NullPointerException("Collection must not be null");
         }
-        return new LoopingIterator(coll);
+        return new LoopingIterator<E>(coll);
     }
     
     /**
@@ -698,13 +703,13 @@ public class IteratorUtils {
      * @throws NullPointerException if the list is null
      * @since Commons Collections 3.2
      */
-    public static ResettableListIterator loopingListIterator(List list) {
+    public static <E> ResettableListIterator<E> loopingListIterator(List<E> list) {
         if (list == null) {
             throw new NullPointerException("List must not be null");
         }
-        return new LoopingListIterator(list);
+        return new LoopingListIterator<E>(list);
     }
-    
+
     // Views
     //-----------------------------------------------------------------------
     /**
@@ -713,11 +718,11 @@ public class IteratorUtils {
      * @param enumeration  the enumeration to use
      * @return a new iterator
      */
-    public static Iterator asIterator(Enumeration enumeration) {
+    public static <E> Iterator<E> asIterator(Enumeration<? extends E> enumeration) {
         if (enumeration == null) {
             throw new NullPointerException("Enumeration must not be null");
         }
-        return new EnumerationIterator(enumeration);
+        return new EnumerationIterator<E>(enumeration);
     }
 
     /**
@@ -728,14 +733,14 @@ public class IteratorUtils {
      * @param removeCollection  the collection to remove elements from
      * @return a new iterator
      */
-    public static Iterator asIterator(Enumeration enumeration, Collection removeCollection) {
+    public static <E> Iterator<E> asIterator(Enumeration<? extends E> enumeration, Collection<? super E> removeCollection) {
         if (enumeration == null) {
             throw new NullPointerException("Enumeration must not be null");
         }
         if (removeCollection == null) {
             throw new NullPointerException("Collection must not be null");
         }
-        return new EnumerationIterator(enumeration, removeCollection);
+        return new EnumerationIterator<E>(enumeration, removeCollection);
     }
     
     /**
@@ -745,11 +750,11 @@ public class IteratorUtils {
      * @return a new enumeration
      * @throws NullPointerException if iterator is null
      */
-    public static Enumeration asEnumeration(Iterator iterator) {
+    public static <E> Enumeration<E> asEnumeration(Iterator<? extends E> iterator) {
         if (iterator == null) {
             throw new NullPointerException("Iterator must not be null");
         }
-        return new IteratorEnumeration(iterator);
+        return new IteratorEnumeration<E>(iterator);
     }
     
     /**
@@ -762,11 +767,11 @@ public class IteratorUtils {
      * @return a new iterator
      * @throws NullPointerException if iterator parameter is null
      */
-    public static ListIterator toListIterator(Iterator iterator) {
+    public static <E> ListIterator<E> toListIterator(Iterator<? extends E> iterator) {
         if (iterator == null) {
             throw new NullPointerException("Iterator must not be null");
         }
-        return new ListIteratorWrapper(iterator);
+        return new ListIteratorWrapper<E>(iterator);
     }
     
     /**
@@ -779,14 +784,14 @@ public class IteratorUtils {
      * @return an array of the iterator contents
      * @throws NullPointerException if iterator parameter is null
      */
-    public static Object[] toArray(Iterator iterator) {
+    public static Object[] toArray(Iterator<?> iterator) {
         if (iterator == null) {
             throw new NullPointerException("Iterator must not be null");
         }
-        List list = toList(iterator, 100);
+        List<?> list = toList(iterator, 100);
         return list.toArray();
     }
-    
+
     /**
      * Gets an array based on an iterator.
      * <p>
@@ -800,15 +805,16 @@ public class IteratorUtils {
      * @throws NullPointerException if arrayClass is null
      * @throws ClassCastException if the arrayClass is invalid
      */
-    public static Object[] toArray(Iterator iterator, Class arrayClass) {
+    @SuppressWarnings("unchecked")
+    public static <E> E[] toArray(Iterator<? extends E> iterator, Class<E> arrayClass) {
         if (iterator == null) {
             throw new NullPointerException("Iterator must not be null");
         }
         if (arrayClass == null) {
             throw new NullPointerException("Array class must not be null");
         }
-        List list = toList(iterator, 100);
-        return list.toArray((Object[]) Array.newInstance(arrayClass, list.size()));
+        List<E> list = toList(iterator, 100);
+        return list.toArray((E[]) Array.newInstance(arrayClass, list.size()));
     }
     
     /**
@@ -821,10 +827,10 @@ public class IteratorUtils {
      * @return a list of the iterator contents
      * @throws NullPointerException if iterator parameter is null
      */
-    public static List toList(Iterator iterator) {
+    public static <E> List<E> toList(Iterator<? extends E> iterator) {
         return toList(iterator, 10);
     }
-    
+
     /**
      * Gets a list based on an iterator.
      * <p>
@@ -837,14 +843,14 @@ public class IteratorUtils {
      * @throws NullPointerException if iterator parameter is null
      * @throws IllegalArgumentException if the size is less than 1
      */
-    public static List toList(Iterator iterator, int estimatedSize) {
+    public static <E> List<E> toList(Iterator<? extends E> iterator, int estimatedSize) {
         if (iterator == null) {
             throw new NullPointerException("Iterator must not be null");
         }
         if (estimatedSize < 1) {
             throw new IllegalArgumentException("Estimated size must be greater than 0");
         }
-        List list = new ArrayList(estimatedSize);
+        List<E> list = new ArrayList<E>(estimatedSize);
         while (iterator.hasNext()) {
             list.add(iterator.next());
         }
@@ -854,7 +860,7 @@ public class IteratorUtils {
     /** 
      * Gets a suitable Iterator for the given object.
      * <p>
-     * This method can handles objects as follows
+     * This method can handle objects as follows
      * <ul>
      * <li>null - empty iterator
      * <li>Iterator - returned directly
@@ -870,45 +876,44 @@ public class IteratorUtils {
      * @param obj  the object to convert to an iterator
      * @return a suitable iterator, never null
      */
-    public static Iterator getIterator(Object obj) {
+    @SuppressWarnings("unchecked")
+    public static Iterator<?> getIterator(Object obj) {
         if (obj == null) {
             return emptyIterator();
-            
-        } else if (obj instanceof Iterator) {
+        }
+        if (obj instanceof Iterator) {
             return (Iterator) obj;
-            
-        } else if (obj instanceof Collection) {
+        }
+        if (obj instanceof Collection) {
             return ((Collection) obj).iterator();
-            
-        } else if (obj instanceof Object[]) {
+        }
+        if (obj instanceof Object[]) {
             return new ObjectArrayIterator((Object[]) obj);
-            
-        } else if (obj instanceof Enumeration) {
+        }
+        if (obj instanceof Enumeration) {
             return new EnumerationIterator((Enumeration) obj);
-            
-        } else if (obj instanceof Map) {
+        }
+        if (obj instanceof Map) {
             return ((Map) obj).values().iterator();
-            
-        } else if (obj instanceof Dictionary) {
+        }
+        if (obj instanceof Dictionary) {
             return new EnumerationIterator(((Dictionary) obj).elements());
-            
-        } else if (obj != null && obj.getClass().isArray()) {
+        }
+        if (obj != null && obj.getClass().isArray()) {
             return new ArrayIterator(obj);
-            
-        } else {
-            try {
-                Method method = obj.getClass().getMethod("iterator", (Class[]) null);
-                if (Iterator.class.isAssignableFrom(method.getReturnType())) {
-                    Iterator it = (Iterator) method.invoke(obj, (Object[]) null);
-                    if (it != null) {
-                        return it;
-                    }
+        }
+        try {
+            Method method = obj.getClass().getMethod("iterator", (Class[]) null);
+            if (Iterator.class.isAssignableFrom(method.getReturnType())) {
+                Iterator it = (Iterator) method.invoke(obj, (Object[]) null);
+                if (it != null) {
+                    return it;
                 }
-            } catch (Exception ex) {
-                // ignore
             }
-            return singletonIterator(obj);
+        } catch (Exception ex) {
+            // ignore
         }
+        return singletonIterator(obj);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/ListUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/ListUtils.java b/src/java/org/apache/commons/collections/ListUtils.java
index b138717..fc5868d 100644
--- a/src/java/org/apache/commons/collections/ListUtils.java
+++ b/src/java/org/apache/commons/collections/ListUtils.java
@@ -49,8 +49,8 @@ public class ListUtils {
      * This uses the {@link Collections Collections} implementation 
      * and is provided for completeness.
      */
-    public static final List EMPTY_LIST = Collections.EMPTY_LIST;
-    
+    public static final List<Object> EMPTY_LIST = Collections.<Object>emptyList();
+
     /**
      * <code>ListUtils</code> should not normally be instantiated.
      */
@@ -67,18 +67,14 @@ public class ListUtils {
      * @return  the intersection of those two lists
      * @throws NullPointerException if either list is null
      */
-    public static List intersection(final List list1, final List list2) {
-        final List result = new ArrayList();
-        final Iterator iterator = list2.iterator();
-
-        while (iterator.hasNext()) {
-            final Object o = iterator.next();
+    public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) {
+        final List<E> result = new ArrayList<E>();
 
-            if (list1.contains(o)) {
-                result.add(o);
+        for (E e : list2) {
+            if (list1.contains(e)) {
+                result.add(e);
             }
         }
-
         return result;
     }
 
@@ -97,14 +93,11 @@ public class ListUtils {
      * @return  a new list containing the results
      * @throws NullPointerException if either list is null
      */
-    public static List subtract(final List list1, final List list2) {
-        final ArrayList result = new ArrayList(list1);
-        final Iterator iterator = list2.iterator();
-
-        while (iterator.hasNext()) {
-            result.remove(iterator.next());
+    public static <E> List<E> subtract(final List<E> list1, final List<? extends E> list2) {
+        final ArrayList<E> result = new ArrayList<E>(list1);
+        for (E e : list2) {
+            result.remove(e);
         }
-
         return result;
     }
 
@@ -117,7 +110,7 @@ public class ListUtils {
      * @return  a new list containing the sum of those lists
      * @throws NullPointerException if either list is null
      */ 
-    public static List sum(final List list1, final List list2) {
+    public static <E> List<E> sum(final List<? extends E> list1, final List<? extends E> list2) {
         return subtract(union(list1, list2), intersection(list1, list2));
     }
 
@@ -131,8 +124,8 @@ public class ListUtils {
      * @return  a new list containing the union of those lists
      * @throws NullPointerException if either list is null
      */
-    public static List union(final List list1, final List list2) {
-        final ArrayList result = new ArrayList(list1);
+    public static <E> List<E> union(final List<? extends E> list1, final List<? extends E> list2) {
+        final ArrayList<E> result = new ArrayList<E>(list1);
         result.addAll(list2);
         return result;
     }
@@ -166,7 +159,7 @@ public class ListUtils {
      * @param list2  the second list, may be null
      * @return whether the lists are equal by value comparison
      */
-    public static boolean isEqualList(final Collection list1, final Collection list2) {
+    public static boolean isEqualList(final Collection<?> list1, final Collection<?> list2) {
         if (list1 == list2) {
             return true;
         }
@@ -174,8 +167,8 @@ public class ListUtils {
             return false;
         }
 
-        Iterator it1 = list1.iterator();
-        Iterator it2 = list2.iterator();
+        Iterator<?> it1 = list1.iterator();
+        Iterator<?> it2 = list2.iterator();
         Object obj1 = null;
         Object obj2 = null;
 
@@ -306,7 +299,7 @@ public class ListUtils {
      * @return an unmodifiable list backed by the given list
      * @throws IllegalArgumentException  if the list is null
      */
-    public static <E> List unmodifiableList(List<E> list) {
+    public static <E> List<E> unmodifiableList(List<E> list) {
         return UnmodifiableList.decorate(list);
     }
 
@@ -339,7 +332,7 @@ public class ListUtils {
      * @return a transformed list backed by the given list
      * @throws IllegalArgumentException  if the List or Transformer is null
      */
-    public static List transformedList(List list, Transformer transformer) {
+    public static <E> List<E> transformedList(List<E> list, Transformer<? super E, ? extends E> transformer) {
         return TransformedList.decorate(list, transformer);
     }
     
@@ -372,7 +365,7 @@ public class ListUtils {
      * @return a lazy list backed by the given list
      * @throws IllegalArgumentException  if the List or Factory is null
      */
-    public static List lazyList(List list, Factory factory) {
+    public static <E> List<E> lazyList(List<E> list, Factory<? extends E> factory) {
         return LazyList.decorate(list, factory);
     }
 
@@ -386,7 +379,7 @@ public class ListUtils {
      * @return a fixed-size list backed by that list
      * @throws IllegalArgumentException  if the List is null
      */
-    public static List fixedSizeList(List list) {
+    public static <E> List<E> fixedSizeList(List<E> list) {
         return FixedSizeList.decorate(list);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/MapUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/MapUtils.java b/src/java/org/apache/commons/collections/MapUtils.java
index 6ea9434..b3c33a9 100644
--- a/src/java/org/apache/commons/collections/MapUtils.java
+++ b/src/java/org/apache/commons/collections/MapUtils.java
@@ -19,6 +19,7 @@ package org.apache.commons.collections;
 import java.io.PrintStream;
 import java.text.NumberFormat;
 import java.text.ParseException;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
@@ -91,12 +92,14 @@ public class MapUtils {
      * An empty unmodifiable map.
      * This was not provided in JDK1.2.
      */
-    public static final Map EMPTY_MAP = UnmodifiableMap.decorate(new HashMap(1));
+    public static final Map<Object, Object> EMPTY_MAP = UnmodifiableMap.decorate(new HashMap<Object, Object>(1));
+
     /**
      * An empty unmodifiable sorted map.
      * This is not provided in the JDK.
      */
-    public static final SortedMap EMPTY_SORTED_MAP = UnmodifiableSortedMap.decorate(new TreeMap());
+    public static final SortedMap<Object, Object> EMPTY_SORTED_MAP = UnmodifiableSortedMap.decorate(new TreeMap<Object, Object>());
+
     /**
      * String used to indent the verbose and debug Map prints.
      */
@@ -107,7 +110,7 @@ public class MapUtils {
      */
     public MapUtils() {
     }    
-    
+
     // Type safe getters
     //-------------------------------------------------------------------------
     /**
@@ -117,7 +120,7 @@ public class MapUtils {
      * @param key  the key to look up
      * @return the value in the Map, <code>null</code> if null map input
      */
-    public static Object getObject(final Map map, final Object key) {
+    public static <K, V> V getObject(final Map<? super K, V> map, final K key) {
         if (map != null) {
             return map.get(key);
         }
@@ -133,7 +136,7 @@ public class MapUtils {
      * @param key  the key to look up
      * @return the value in the Map as a String, <code>null</code> if null map input
      */
-    public static String getString(final Map map, final Object key) {
+    public static <K> String getString(final Map<? super K, ?> map, final K key) {
         if (map != null) {
             Object answer = map.get(key);
             if (answer != null) {
@@ -157,17 +160,17 @@ public class MapUtils {
      * @param key  the key to look up
      * @return the value in the Map as a Boolean, <code>null</code> if null map input
      */
-    public static Boolean getBoolean(final Map map, final Object key) {
+    public static <K> Boolean getBoolean(final Map<? super K, ?> map, final K key) {
         if (map != null) {
             Object answer = map.get(key);
             if (answer != null) {
                 if (answer instanceof Boolean) {
                     return (Boolean) answer;
-                    
-                } else if (answer instanceof String) {
+                }
+                if (answer instanceof String) {
                     return new Boolean((String) answer);
-                    
-                } else if (answer instanceof Number) {
+                }
+                if (answer instanceof Number) {
                     Number n = (Number) answer;
                     return (n.intValue() != 0) ? Boolean.TRUE : Boolean.FALSE;
                 }
@@ -189,18 +192,17 @@ public class MapUtils {
      * @param key  the key to look up
      * @return the value in the Map as a Number, <code>null</code> if null map input
      */
-    public static Number getNumber(final Map map, final Object key) {
+    public static <K> Number getNumber(final Map<? super K, ?> map, final K key) {
         if (map != null) {
             Object answer = map.get(key);
             if (answer != null) {
                 if (answer instanceof Number) {
                     return (Number) answer;
-                    
-                } else if (answer instanceof String) {
+                }
+                if (answer instanceof String) {
                     try {
                         String text = (String) answer;
                         return NumberFormat.getInstance().parse(text);
-                        
                     } catch (ParseException e) {
                         logInfo(e);
                     }
@@ -219,11 +221,12 @@ public class MapUtils {
      * @param key  the key to look up
      * @return the value in the Map as a Byte, <code>null</code> if null map input
      */
-    public static Byte getByte(final Map map, final Object key) {
+    public static <K> Byte getByte(final Map<? super K, ?> map, final K key) {
         Number answer = getNumber(map, key);
         if (answer == null) {
             return null;
-        } else if (answer instanceof Byte) {
+        }
+        if (answer instanceof Byte) {
             return (Byte) answer;
         }
         return new Byte(answer.byteValue());
@@ -238,11 +241,12 @@ public class MapUtils {
      * @param key  the key to look up
      * @return the value in the Map as a Short, <code>null</code> if null map input
      */
-    public static Short getShort(final Map map, final Object key) {
+    public static <K> Short getShort(final Map<? super K, ?> map, final K key) {
         Number answer = getNumber(map, key);
         if (answer == null) {
             return null;
-        } else if (answer instanceof Short) {
+        }
+        if (answer instanceof Short) {
             return (Short) answer;
         }
         return new Short(answer.shortValue());
@@ -257,11 +261,12 @@ public class MapUtils {
      * @param key  the key to look up
      * @return the value in the Map as a Integer, <code>null</code> if null map input
      */
-    public static Integer getInteger(final Map map, final Object key) {
+    public static <K> Integer getInteger(final Map<? super K, ?> map, final K key) {
         Number answer = getNumber(map, key);
         if (answer == null) {
             return null;
-        } else if (answer instanceof Integer) {
+        }
+        if (answer instanceof Integer) {
             return (Integer) answer;
         }
         return new Integer(answer.intValue());
@@ -276,11 +281,12 @@ public class MapUtils {
      * @param key  the key to look up
      * @return the value in the Map as a Long, <code>null</code> if null map input
      */
-    public static Long getLong(final Map map, final Object key) {
+    public static <K> Long getLong(final Map<? super K, ?> map, final K key) {
         Number answer = getNumber(map, key);
         if (answer == null) {
             return null;
-        } else if (answer instanceof Long) {
+        }
+        if (answer instanceof Long) {
             return (Long) answer;
         }
         return new Long(answer.longValue());
@@ -295,11 +301,12 @@ public class MapUtils {
      * @param key  the key to look up
      * @return the value in the Map as a Float, <code>null</code> if null map input
      */
-    public static Float getFloat(final Map map, final Object key) {
+    public static <K> Float getFloat(final Map<? super K, ?> map, final K key) {
         Number answer = getNumber(map, key);
         if (answer == null) {
             return null;
-        } else if (answer instanceof Float) {
+        }
+        if (answer instanceof Float) {
             return (Float) answer;
         }
         return new Float(answer.floatValue());
@@ -314,11 +321,12 @@ public class MapUtils {
      * @param key  the key to look up
      * @return the value in the Map as a Double, <code>null</code> if null map input
      */
-    public static Double getDouble(final Map map, final Object key) {
+    public static <K> Double getDouble(final Map<? super K, ?> map, final K key) {
         Number answer = getNumber(map, key);
         if (answer == null) {
             return null;
-        } else if (answer instanceof Double) {
+        }
+        if (answer instanceof Double) {
             return (Double) answer;
         }
         return new Double(answer.doubleValue());
@@ -334,11 +342,11 @@ public class MapUtils {
      * @param key  the key to look up
      * @return the value in the Map as a Map, <code>null</code> if null map input
      */
-    public static Map getMap(final Map map, final Object key) {
+    public static <K> Map<?, ?> getMap(final Map<? super K, ?> map, final K key) {
         if (map != null) {
             Object answer = map.get(key);
             if (answer != null && answer instanceof Map) {
-                return (Map) answer;
+                return (Map<?, ?>) answer;
             }
         }
         return null;
@@ -356,10 +364,10 @@ public class MapUtils {
      *  @return  the value in the map, or defaultValue if the original value
      *    is null or the map is null
      */
-    public static Object getObject( Map map, Object key, Object defaultValue ) {
-        if ( map != null ) {
-            Object answer = map.get( key );
-            if ( answer != null ) {
+    public static <K, V> V getObject(Map<K, V> map, K key, V defaultValue) {
+        if (map != null) {
+            V answer = map.get(key);
+            if (answer != null) {
                 return answer;
             }
         }
@@ -378,9 +386,9 @@ public class MapUtils {
      *    original value is null, the map is null or the string conversion
      *    fails
      */
-    public static String getString( Map map, Object key, String defaultValue ) {
-        String answer = getString( map, key );
-        if ( answer == null ) {
+    public static <K> String getString(Map<? super K, ?> map, K key, String defaultValue) {
+        String answer = getString(map, key);
+        if (answer == null) {
             answer = defaultValue;
         }
         return answer;
@@ -398,9 +406,9 @@ public class MapUtils {
      *    original value is null, the map is null or the boolean conversion
      *    fails
      */
-    public static Boolean getBoolean( Map map, Object key, Boolean defaultValue ) {
-        Boolean answer = getBoolean( map, key );
-        if ( answer == null ) {
+    public static <K> Boolean getBoolean(Map<? super K, ?> map, K key, Boolean defaultValue) {
+        Boolean answer = getBoolean(map, key);
+        if (answer == null) {
             answer = defaultValue;
         }
         return answer;
@@ -418,9 +426,9 @@ public class MapUtils {
      *    original value is null, the map is null or the number conversion
      *    fails
      */
-    public static Number getNumber( Map map, Object key, Number defaultValue ) {
-        Number answer = getNumber( map, key );
-        if ( answer == null ) {
+    public static <K> Number getNumber(Map<? super K, ?> map, K key, Number defaultValue) {
+        Number answer = getNumber(map, key);
+        if (answer == null) {
             answer = defaultValue;
         }
         return answer;
@@ -438,9 +446,9 @@ public class MapUtils {
      *    original value is null, the map is null or the number conversion
      *    fails
      */
-    public static Byte getByte( Map map, Object key, Byte defaultValue ) {
-        Byte answer = getByte( map, key );
-        if ( answer == null ) {
+    public static <K> Byte getByte(Map<? super K, ?> map, K key, Byte defaultValue) {
+        Byte answer = getByte(map, key);
+        if (answer == null) {
             answer = defaultValue;
         }
         return answer;
@@ -458,9 +466,9 @@ public class MapUtils {
      *    original value is null, the map is null or the number conversion
      *    fails
      */
-    public static Short getShort( Map map, Object key, Short defaultValue ) {
-        Short answer = getShort( map, key );
-        if ( answer == null ) {
+    public static <K> Short getShort(Map<? super K, ?> map, K key, Short defaultValue) {
+        Short answer = getShort(map, key);
+        if (answer == null) {
             answer = defaultValue;
         }
         return answer;
@@ -478,9 +486,9 @@ public class MapUtils {
      *    original value is null, the map is null or the number conversion
      *    fails
      */
-    public static Integer getInteger( Map map, Object key, Integer defaultValue ) {
-        Integer answer = getInteger( map, key );
-        if ( answer == null ) {
+    public static <K> Integer getInteger(Map<? super K, ?> map, K key, Integer defaultValue) {
+        Integer answer = getInteger(map, key);
+        if (answer == null) {
             answer = defaultValue;
         }
         return answer;
@@ -498,9 +506,9 @@ public class MapUtils {
      *    original value is null, the map is null or the number conversion
      *    fails
      */
-    public static Long getLong( Map map, Object key, Long defaultValue ) {
-        Long answer = getLong( map, key );
-        if ( answer == null ) {
+    public static <K> Long getLong(Map<? super K, ?> map, K key, Long defaultValue) {
+        Long answer = getLong(map, key);
+        if (answer == null) {
             answer = defaultValue;
         }
         return answer;
@@ -518,9 +526,9 @@ public class MapUtils {
      *    original value is null, the map is null or the number conversion
      *    fails
      */
-    public static Float getFloat( Map map, Object key, Float defaultValue ) {
-        Float answer = getFloat( map, key );
-        if ( answer == null ) {
+    public static <K> Float getFloat(Map<? super K, ?> map, K key, Float defaultValue) {
+        Float answer = getFloat(map, key);
+        if (answer == null) {
             answer = defaultValue;
         }
         return answer;
@@ -538,9 +546,9 @@ public class MapUtils {
      *    original value is null, the map is null or the number conversion
      *    fails
      */
-    public static Double getDouble( Map map, Object key, Double defaultValue ) {
-        Double answer = getDouble( map, key );
-        if ( answer == null ) {
+    public static <K> Double getDouble(Map<? super K, ?> map, K key, Double defaultValue) {
+        Double answer = getDouble(map, key);
+        if (answer == null) {
             answer = defaultValue;
         }
         return answer;
@@ -558,14 +566,13 @@ public class MapUtils {
      *    original value is null, the map is null or the map conversion
      *    fails
      */
-    public static Map getMap( Map map, Object key, Map defaultValue ) {
-        Map answer = getMap( map, key );
-        if ( answer == null ) {
+    public static <K> Map<?, ?> getMap(Map<? super K, ?> map, K key, Map<?, ?> defaultValue) {
+        Map<?, ?> answer = getMap(map, key);
+        if (answer == null) {
             answer = defaultValue;
         }
         return answer;
     }
-    
 
     // Type safe primitive getters
     //-------------------------------------------------------------------------
@@ -583,12 +590,8 @@ public class MapUtils {
      * @param key  the key to look up
      * @return the value in the Map as a Boolean, <code>false</code> if null map input
      */
-    public static boolean getBooleanValue(final Map map, final Object key) {
-        Boolean booleanObject = getBoolean(map, key);
-        if (booleanObject == null) {
-            return false;
-        }
-        return booleanObject.booleanValue();
+    public static <K> boolean getBooleanValue(final Map<? super K, ?> map, final K key) {
+        return Boolean.TRUE.equals(getBoolean(map, key));
     }
 
     /**
@@ -600,7 +603,7 @@ public class MapUtils {
      * @param key  the key to look up
      * @return the value in the Map as a byte, <code>0</code> if null map input
      */
-    public static byte getByteValue(final Map map, final Object key) {
+    public static <K> byte getByteValue(final Map<? super K, ?> map, final K key) {
         Byte byteObject = getByte(map, key);
         if (byteObject == null) {
             return 0;
@@ -617,7 +620,7 @@ public class MapUtils {
      * @param key  the key to look up
      * @return the value in the Map as a short, <code>0</code> if null map input
      */
-    public static short getShortValue(final Map map, final Object key) {
+    public static <K> short getShortValue(final Map<? super K, ?> map, final K key) {
         Short shortObject = getShort(map, key);
         if (shortObject == null) {
             return 0;
@@ -634,7 +637,7 @@ public class MapUtils {
      * @param key  the key to look up
      * @return the value in the Map as an int, <code>0</code> if null map input
      */
-    public static int getIntValue(final Map map, final Object key) {
+    public static <K> int getIntValue(final Map<? super K, ?> map, final K key) {
         Integer integerObject = getInteger(map, key);
         if (integerObject == null) {
             return 0;
@@ -651,7 +654,7 @@ public class MapUtils {
      * @param key  the key to look up
      * @return the value in the Map as a long, <code>0L</code> if null map input
      */
-    public static long getLongValue(final Map map, final Object key) {
+    public static <K> long getLongValue(final Map<? super K, ?> map, final K key) {
         Long longObject = getLong(map, key);
         if (longObject == null) {
             return 0L;
@@ -668,7 +671,7 @@ public class MapUtils {
      * @param key  the key to look up
      * @return the value in the Map as a float, <code>0.0F</code> if null map input
      */
-    public static float getFloatValue(final Map map, final Object key) {
+    public static <K> float getFloatValue(final Map<? super K, ?> map, final K key) {
         Float floatObject = getFloat(map, key);
         if (floatObject == null) {
             return 0f;
@@ -685,7 +688,7 @@ public class MapUtils {
      * @param key  the key to look up
      * @return the value in the Map as a double, <code>0.0</code> if null map input
      */
-    public static double getDoubleValue(final Map map, final Object key) {
+    public static <K> double getDoubleValue(final Map<? super K, ?> map, final K key) {
         Double doubleObject = getDouble(map, key);
         if (doubleObject == null) {
             return 0d;
@@ -712,7 +715,7 @@ public class MapUtils {
      *     conversion fails
      * @return the value in the Map as a Boolean, <code>defaultValue</code> if null map input
      */
-    public static boolean getBooleanValue(final Map map, final Object key, boolean defaultValue) {
+    public static <K> boolean getBooleanValue(final Map<? super K, ?> map, final K key, boolean defaultValue) {
         Boolean booleanObject = getBoolean(map, key);
         if (booleanObject == null) {
             return defaultValue;
@@ -732,7 +735,7 @@ public class MapUtils {
      *     conversion fails
      * @return the value in the Map as a byte, <code>defaultValue</code> if null map input
      */
-    public static byte getByteValue(final Map map, final Object key, byte defaultValue) {
+    public static <K> byte getByteValue(final Map<? super K, ?> map, final K key, byte defaultValue) {
         Byte byteObject = getByte(map, key);
         if (byteObject == null) {
             return defaultValue;
@@ -752,7 +755,7 @@ public class MapUtils {
      *     conversion fails
      * @return the value in the Map as a short, <code>defaultValue</code> if null map input
      */
-    public static short getShortValue(final Map map, final Object key, short defaultValue) {
+    public static <K> short getShortValue(final Map<? super K, ?> map, final K key, short defaultValue) {
         Short shortObject = getShort(map, key);
         if (shortObject == null) {
             return defaultValue;
@@ -772,7 +775,7 @@ public class MapUtils {
      *     conversion fails
      * @return the value in the Map as an int, <code>defaultValue</code> if null map input
      */
-    public static int getIntValue(final Map map, final Object key, int defaultValue) {
+    public static <K> int getIntValue(final Map<? super K, ?> map, final K key, int defaultValue) {
         Integer integerObject = getInteger(map, key);
         if (integerObject == null) {
             return defaultValue;
@@ -792,7 +795,7 @@ public class MapUtils {
      *     conversion fails
      * @return the value in the Map as a long, <code>defaultValue</code> if null map input
      */
-    public static long getLongValue(final Map map, final Object key, long defaultValue) {
+    public static <K> long getLongValue(final Map<? super K, ?> map, final K key, long defaultValue) {
         Long longObject = getLong(map, key);
         if (longObject == null) {
             return defaultValue;
@@ -812,7 +815,7 @@ public class MapUtils {
      *     conversion fails
      * @return the value in the Map as a float, <code>defaultValue</code> if null map input
      */
-    public static float getFloatValue(final Map map, final Object key, float defaultValue) {
+    public static <K> float getFloatValue(final Map<? super K, ?> map, final K key, float defaultValue) {
         Float floatObject = getFloat(map, key);
         if (floatObject == null) {
             return defaultValue;
@@ -832,7 +835,7 @@ public class MapUtils {
      *     conversion fails
      * @return the value in the Map as a double, <code>defaultValue</code> if null map input
      */
-    public static double getDoubleValue(final Map map, final Object key, double defaultValue) {
+    public static <K> double getDoubleValue(final Map<? super K, ?> map, final K key, double defaultValue) {
         Double doubleObject = getDouble(map, key);
         if (doubleObject == null) {
             return defaultValue;
@@ -849,11 +852,11 @@ public class MapUtils {
      * @param map  the map to convert to a Properties object, may not be null
      * @return the properties object
      */
-    public static Properties toProperties(final Map map) {
+    public static <K, V> Properties toProperties(final Map<K, V> map) {
         Properties answer = new Properties();
         if (map != null) {
-            for (Iterator iter = map.entrySet().iterator(); iter.hasNext();) {
-                Map.Entry entry = (Map.Entry) iter.next();
+            for (Iterator<Map.Entry<K, V>> iter = map.entrySet().iterator(); iter.hasNext();) {
+                Map.Entry<?, ?> entry = iter.next();
                 Object key = entry.getKey();
                 Object value = entry.getValue();
                 answer.put(key, value);
@@ -869,16 +872,16 @@ public class MapUtils {
      * @return the hashmap containing the data
      * @throws NullPointerException if the bundle is null
      */
-    public static Map toMap(final ResourceBundle resourceBundle) {
-        Enumeration enumeration = resourceBundle.getKeys();
-        Map map = new HashMap();
+    public static Map<String, Object> toMap(final ResourceBundle resourceBundle) {
+        Enumeration<String> enumeration = resourceBundle.getKeys();
+        Map<String, Object> map = new HashMap<String, Object>();
 
         while (enumeration.hasMoreElements()) {
             String key = (String) enumeration.nextElement();
             Object value = resourceBundle.getObject(key);
             map.put(key, value);
         }
-        
+
         return map;
     }
  
@@ -905,9 +908,9 @@ public class MapUtils {
     public static void verbosePrint(
         final PrintStream out,
         final Object label,
-        final Map map) {
+        final Map<?, ?> map) {
 
-        verbosePrintInternal(out, label, map, new ArrayStack(), false);
+        verbosePrintInternal(out, label, map, new ArrayStack<Map<?, ?>>(), false);
     }
 
     /**
@@ -931,9 +934,9 @@ public class MapUtils {
     public static void debugPrint(
         final PrintStream out,
         final Object label,
-        final Map map) {
+        final Map<?, ?> map) {
 
-        verbosePrintInternal(out, label, map, new ArrayStack(), true);
+        verbosePrintInternal(out, label, map, new ArrayStack<Map<?, ?>>(), true);
     }
 
     // Implementation methods
@@ -975,8 +978,8 @@ public class MapUtils {
     private static void verbosePrintInternal(
         final PrintStream out,
         final Object label,
-        final Map map,
-        final ArrayStack lineage,
+        final Map<?, ?> map,
+        final ArrayStack<Map<?, ?>> lineage,
         final boolean debug) {
         
         printIndent(out, lineage.size());
@@ -999,15 +1002,14 @@ public class MapUtils {
 
         lineage.push(map);
 
-        for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
-            Map.Entry entry = (Map.Entry) it.next();
+        for (Map.Entry<?, ?> entry : map.entrySet()) {
             Object childKey = entry.getKey();
             Object childValue = entry.getValue();
             if (childValue instanceof Map && !lineage.contains(childValue)) {
                 verbosePrintInternal(
                     out,
                     (childKey == null ? "null" : childKey),
-                    (Map) childValue,
+                    (Map<?, ?>) childValue,
                     lineage,
                     debug);
             } else {
@@ -1026,7 +1028,7 @@ public class MapUtils {
                             + (lineage.size() - 1 - lineageIndex - 1)
                             + "] Map)");
                 }
-                
+
                 if (debug && childValue != null) {
                     out.print(' ');
                     out.println(childValue.getClass().getName());
@@ -1035,7 +1037,7 @@ public class MapUtils {
                 }
             }
         }
-        
+
         lineage.pop();
 
         printIndent(out, lineage.size());
@@ -1052,7 +1054,7 @@ public class MapUtils {
             out.print(INDENT_STRING);
         }
     }
-    
+
     // Misc
     //-----------------------------------------------------------------------
     /**
@@ -1068,15 +1070,15 @@ public class MapUtils {
      * @return a new HashMap containing the inverted data
      * @throws NullPointerException if the map is null
      */
-    public static Map invertMap(Map map) {
-        Map out = new HashMap(map.size());
-        for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
-            Map.Entry entry = (Map.Entry) it.next();
+    public static <K, V> Map<V, K> invertMap(Map<K, V> map) {
+        Map<V, K> out = new HashMap<V, K>(map.size());
+        for (Iterator<Map.Entry<K, V>> it = map.entrySet().iterator(); it.hasNext();) {
+            Map.Entry<K, V> entry = it.next();
             out.put(entry.getValue(), entry.getKey());
         }
         return out;
     }
-     
+
     //-----------------------------------------------------------------------
     /**
      * Protects against adding null values to a map.
@@ -1089,18 +1091,16 @@ public class MapUtils {
      * which should be held in the same way in the map.
      * <p>
      * Keys are not validated.
+     * Note that this method can be used to circumvent the map's
+     * value type at runtime.
      * 
      * @param map  the map to add to, may not be null
      * @param key  the key
      * @param value  the value, null converted to ""
      * @throws NullPointerException if the map is null
      */
-    public static void safeAddToMap(Map map, Object key, Object value) throws NullPointerException {
-        if (value == null) {
-            map.put(key, "");
-        } else {
-            map.put(key, value);
-        }
+    public static <K> void safeAddToMap(Map<? super K, Object> map, K key, Object value) throws NullPointerException {
+        map.put(key, value == null ? "" : value);
     }
 
     //-----------------------------------------------------------------------
@@ -1151,7 +1151,8 @@ public class MapUtils {
      * @throws ClassCastException if the array contents is mixed
      * @since Commons Collections 3.2
      */
-    public static Map putAll(Map map, Object[] array) {
+    @SuppressWarnings("unchecked")
+    public static <K, V> Map<K, V> putAll(Map<K, V> map, Object[] array) {
         map.size();  // force NPE
         if (array == null || array.length == 0) {
             return map;
@@ -1159,12 +1160,12 @@ public class MapUtils {
         Object obj = array[0];
         if (obj instanceof Map.Entry) {
             for (int i = 0; i < array.length; i++) {
-                Map.Entry entry = (Map.Entry) array[i];
+                Map.Entry<K, V> entry = (Map.Entry<K, V>) array[i];
                 map.put(entry.getKey(), entry.getValue());
             }
         } else if (obj instanceof KeyValue) {
             for (int i = 0; i < array.length; i++) {
-                KeyValue keyval = (KeyValue) array[i];
+                KeyValue<K, V> keyval = (KeyValue<K, V>) array[i];
                 map.put(keyval.getKey(), keyval.getValue());
             }
         } else if (obj instanceof Object[]) {
@@ -1173,11 +1174,11 @@ public class MapUtils {
                 if (sub == null || sub.length < 2) {
                     throw new IllegalArgumentException("Invalid array element: " + i);
                 }
-                map.put(sub[0], sub[1]);
+                map.put((K) sub[0], (V) sub[1]);
             }
         } else {
             for (int i = 0; i < array.length - 1;) {
-                map.put(array[i++], array[i++]);
+                map.put((K) array[i++], (V) array[i++]);
             }
         }
         return map;
@@ -1193,6 +1194,7 @@ public class MapUtils {
      * @return true if empty or null
      * @since Commons Collections 3.2
      */
+    @SuppressWarnings("unchecked")
     public static boolean isEmpty(Map map) {
         return (map == null || map.isEmpty());
     }
@@ -1206,6 +1208,7 @@ public class MapUtils {
      * @return true if non-null and non-empty
      * @since Commons Collections 3.2
      */
+    @SuppressWarnings("unchecked")
     public static boolean isNotEmpty(Map map) {
         return !MapUtils.isEmpty(map);
     }
@@ -1235,7 +1238,7 @@ public class MapUtils {
      * @return a synchronized map backed by the given map
      * @throws IllegalArgumentException  if the map is null
      */
-    public static Map synchronizedMap(Map map) {
+    public static <K, V> Map<K, V> synchronizedMap(Map<K, V> map) {
         return Collections.synchronizedMap(map);
     }
 
@@ -1248,7 +1251,7 @@ public class MapUtils {
      * @return an unmodifiable map backed by the given map
      * @throws IllegalArgumentException  if the map is null
      */
-    public static Map unmodifiableMap(Map map) {
+    public static <K, V> Map<K, V> unmodifiableMap(Map<K, V> map) {
         return UnmodifiableMap.decorate(map);
     }
 
@@ -1267,7 +1270,7 @@ public class MapUtils {
      * @return a predicated map backed by the given map
      * @throws IllegalArgumentException  if the Map is null
      */
-    public static Map predicatedMap(Map map, Predicate keyPred, Predicate valuePred) {
+    public static <K, V> Map<K, V> predicatedMap(Map<K, V> map, Predicate<? super K> keyPred, Predicate<? super V> valuePred) {
         return PredicatedMap.decorate(map, keyPred, valuePred);
     }
 
@@ -1292,7 +1295,9 @@ public class MapUtils {
      * @return a transformed map backed by the given map
      * @throws IllegalArgumentException  if the Map is null
      */
-    public static Map transformedMap(Map map, Transformer keyTransformer, Transformer valueTransformer) {
+    public static <K, V> Map<K, V> transformedMap(Map<K, V> map,
+            Transformer<? super K, ? extends K> keyTransformer,
+            Transformer<? super V, ? extends V> valueTransformer) {
         return TransformedMap.decorate(map, keyTransformer, valueTransformer);
     }
     
@@ -1306,7 +1311,7 @@ public class MapUtils {
      * @return a fixed-size map backed by that map
      * @throws IllegalArgumentException  if the Map is null
      */
-    public static Map fixedSizeMap(Map map) {
+    public static <K, V> Map<K, V> fixedSizeMap(Map<K, V> map) {
         return FixedSizeMap.decorate(map);
     }
 
@@ -1338,8 +1343,8 @@ public class MapUtils {
      * @return a lazy map backed by the given map
      * @throws IllegalArgumentException  if the Map or Factory is null
      */
-    public static Map lazyMap(Map map, Factory factory) {
-        return LazyMap.decorate(map, factory);
+    public static <K, V> Map<K, V> lazyMap(Map<K, V> map, Factory<? extends V> factory) {
+        return LazyMap.getLazyMap(map, factory);
     }
 
     /**
@@ -1377,8 +1382,8 @@ public class MapUtils {
      * @return a lazy map backed by the given map
      * @throws IllegalArgumentException  if the Map or Transformer is null
      */
-    public static Map lazyMap(Map map, Transformer transformerFactory) {
-        return LazyMap.decorate(map, transformerFactory);
+    public static <K, V> Map<K, V> lazyMap(Map<K, V> map, Transformer<? super K, ? extends V> transformerFactory) {
+        return LazyMap.getLazyMap(map, transformerFactory);
     }
 
     /**
@@ -1392,7 +1397,7 @@ public class MapUtils {
      * @return an ordered map backed by the given map
      * @throws IllegalArgumentException  if the Map is null
      */
-    public static Map orderedMap(Map map) {
+    public static <K, V> Map<K, V> orderedMap(Map<K, V> map) {
         return ListOrderedMap.decorate(map);
     }
 
@@ -1405,8 +1410,8 @@ public class MapUtils {
      * @see MultiValueMap
      * @since Commons Collections 3.2
      */
-    public static Map multiValueMap(Map map) {
-        return MultiValueMap.decorate(map);
+    public static <K, V> MultiValueMap<K, V> multiValueMap(Map<K, ? super Collection<V>> map) {
+        return MultiValueMap.<K, V>decorate(map);
     }
 
     /**
@@ -1420,7 +1425,7 @@ public class MapUtils {
      * @see MultiValueMap
      * @since Commons Collections 3.2
      */
-    public static Map multiValueMap(Map map, Class collectionClass) {
+    public static <K, V, C extends Collection<V>> MultiValueMap<K, V> multiValueMap(Map<K, C> map, Class<C> collectionClass) {
         return MultiValueMap.decorate(map, collectionClass);
     }
 
@@ -1435,7 +1440,7 @@ public class MapUtils {
      * @see MultiValueMap
      * @since Commons Collections 3.2
      */
-    public static Map multiValueMap(Map map, Factory collectionFactory) {
+    public static <K, V, C extends Collection<V>> MultiValueMap<K, V> multiValueMap(Map<K, C> map, Factory<C> collectionFactory) {
         return MultiValueMap.decorate(map, collectionFactory);
     }
 
@@ -1464,7 +1469,7 @@ public class MapUtils {
      * @return a synchronized map backed by the given map
      * @throws IllegalArgumentException  if the map is null
      */
-    public static Map synchronizedSortedMap(SortedMap map) {
+    public static <K, V> SortedMap<K, V> synchronizedSortedMap(SortedMap<K, V> map) {
         return Collections.synchronizedSortedMap(map);
     }
 
@@ -1477,7 +1482,7 @@ public class MapUtils {
      * @return an unmodifiable map backed by the given map
      * @throws IllegalArgumentException  if the map is null
      */
-    public static Map unmodifiableSortedMap(SortedMap map) {
+    public static <K, V> SortedMap<K, V> unmodifiableSortedMap(SortedMap<K, V> map) {
         return UnmodifiableSortedMap.decorate(map);
     }
 
@@ -1496,7 +1501,8 @@ public class MapUtils {
      * @return a predicated map backed by the given map
      * @throws IllegalArgumentException  if the SortedMap is null
      */
-    public static SortedMap predicatedSortedMap(SortedMap map, Predicate keyPred, Predicate valuePred) {
+    public static <K, V> SortedMap<K, V> predicatedSortedMap(SortedMap<K, V> map,
+            Predicate<? super K> keyPred, Predicate<? super V> valuePred) {
         return PredicatedSortedMap.decorate(map, keyPred, valuePred);
     }
 
@@ -1521,7 +1527,9 @@ public class MapUtils {
      * @return a transformed map backed by the given map
      * @throws IllegalArgumentException  if the SortedMap is null
      */
-    public static SortedMap transformedSortedMap(SortedMap map, Transformer keyTransformer, Transformer valueTransformer) {
+    public static <K, V> SortedMap<K, V> transformedSortedMap(SortedMap<K, V> map,
+            Transformer<? super K, ? extends K> keyTransformer,
+            Transformer<? super V, ? extends V> valueTransformer) {
         return TransformedSortedMap.decorate(map, keyTransformer, valueTransformer);
     }
     
@@ -1535,7 +1543,7 @@ public class MapUtils {
      * @return a fixed-size map backed by that map
      * @throws IllegalArgumentException  if the SortedMap is null
      */
-    public static SortedMap fixedSizeSortedMap(SortedMap map) {
+    public static <K, V> SortedMap<K, V> fixedSizeSortedMap(SortedMap<K, V> map) {
         return FixedSizeSortedMap.decorate(map);
     }
 
@@ -1568,8 +1576,9 @@ public class MapUtils {
      * @return a lazy map backed by the given map
      * @throws IllegalArgumentException  if the SortedMap or Factory is null
      */
-    public static SortedMap lazySortedMap(SortedMap map, Factory factory) {
-        return LazySortedMap.decorate(map, factory);
+    public static <K, V> SortedMap<K, V> lazySortedMap(SortedMap<K, V> map,
+            Factory<? extends V> factory) {
+        return LazySortedMap.getLazySortedMap(map, factory);
     }
     
     /**
@@ -1607,8 +1616,9 @@ public class MapUtils {
      * @return a lazy map backed by the given map
      * @throws IllegalArgumentException  if the Map or Transformer is null
      */
-    public static SortedMap lazySortedMap(SortedMap map, Transformer transformerFactory) {
-        return LazySortedMap.decorate(map, transformerFactory);
+    public static <K, V> SortedMap<K, V> lazySortedMap(SortedMap<K, V> map,
+            Transformer<? super K, ? extends V> transformerFactory) {
+        return LazySortedMap.getLazySortedMap(map, transformerFactory);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/MultiMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/MultiMap.java b/src/java/org/apache/commons/collections/MultiMap.java
index fa2d727..388b56a 100644
--- a/src/java/org/apache/commons/collections/MultiMap.java
+++ b/src/java/org/apache/commons/collections/MultiMap.java
@@ -47,7 +47,7 @@ import java.util.Map;
  * @author James Strachan
  * @author Stephen Colebourne
  */
-public interface MultiMap extends Map {
+public interface MultiMap<K, V> extends Map<K, Object> {
 
     /**
      * Removes a specific value from map.
@@ -66,7 +66,7 @@ public interface MultiMap extends Map {
      * @throws ClassCastException if the key or value is of an invalid type
      * @throws NullPointerException if the key or value is null and null is invalid
      */
-    public Object remove(Object key, Object item);
+    public V remove(K key, V item);
 
     //-----------------------------------------------------------------------
     /**
@@ -98,7 +98,7 @@ public interface MultiMap extends Map {
      * @throws ClassCastException if the key is of an invalid type
      * @throws NullPointerException if the key is null and null keys are invalid
      */
-    Object get(Object key);
+    Object get(K key);
 
     /**
      * Checks whether the map contains the value specified.
@@ -129,7 +129,7 @@ public interface MultiMap extends Map {
      * @throws NullPointerException if the key or value is null and null is invalid
      * @throws IllegalArgumentException if the key or value is invalid
      */
-    Object put(Object key, Object value);
+    Object put(K key, Object value);
 
     /**
      * Removes all values associated with the specified key.
@@ -144,7 +144,7 @@ public interface MultiMap extends Map {
      * @throws ClassCastException if the key is of an invalid type
      * @throws NullPointerException if the key is null and null keys are invalid
      */
-    Object remove(Object key);
+    Object remove(K key);
 
     /**
      * Gets a collection containing all the values in the map.
@@ -155,6 +155,6 @@ public interface MultiMap extends Map {
      *
      * @return a collection view of the values contained in this map
      */
-    Collection values();
+    Collection<Object> values();
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/OrderedBidiMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/OrderedBidiMap.java b/src/java/org/apache/commons/collections/OrderedBidiMap.java
index 70f6ca2..642d9df 100644
--- a/src/java/org/apache/commons/collections/OrderedBidiMap.java
+++ b/src/java/org/apache/commons/collections/OrderedBidiMap.java
@@ -47,20 +47,6 @@ public interface OrderedBidiMap<K, V> extends BidiMap<K, V>, OrderedMap<K, V> {
      *
      * @return an inverted bidirectional map
      */
-    public BidiMap<V, K> inverseBidiMap();
-
-    /**
-     * Gets a view of this map where the keys and values are reversed.
-     * <p>
-     * Changes to one map will be visible in the other and vice versa.
-     * This enables both directions of the map to be accessed equally.
-     * <p>
-     * Implementations should seek to avoid creating a new object every time this
-     * method is called. See <code>AbstractMap.values()</code> etc. Calling this
-     * method on the inverse map should return the original.
-     *
-     * @return an inverted bidirectional map
-     */
-    public OrderedBidiMap<V, K> inverseOrderedBidiMap();
+    public OrderedBidiMap<V, K> inverseBidiMap();
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/OrderedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/OrderedMap.java b/src/java/org/apache/commons/collections/OrderedMap.java
index 83e34cd..7a45392 100644
--- a/src/java/org/apache/commons/collections/OrderedMap.java
+++ b/src/java/org/apache/commons/collections/OrderedMap.java
@@ -37,7 +37,7 @@ public interface OrderedMap<K, V> extends IterableMap<K, V> {
      * 
      * @return a map iterator
      */
-    OrderedMapIterator<K, V> orderedMapIterator();
+    OrderedMapIterator<K, V> mapIterator();
 
     /**
      * Gets the first key currently in this map.


[31/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/bidimap/AbstractBidiMapDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bidimap/AbstractBidiMapDecorator.java b/src/java/org/apache/commons/collections/bidimap/AbstractBidiMapDecorator.java
index e725668..393cc4e 100644
--- a/src/java/org/apache/commons/collections/bidimap/AbstractBidiMapDecorator.java
+++ b/src/java/org/apache/commons/collections/bidimap/AbstractBidiMapDecorator.java
@@ -37,9 +37,8 @@ import org.apache.commons.collections.map.AbstractMapDecorator;
  * 
  * @author Stephen Colebourne
  */
-public abstract class AbstractBidiMapDecorator
-        extends AbstractMapDecorator
-        implements BidiMap {
+public abstract class AbstractBidiMapDecorator<K, V> extends AbstractMapDecorator<K, V> implements
+        BidiMap<K, V> {
 
     /**
      * Constructor that wraps (not copies).
@@ -47,7 +46,7 @@ public abstract class AbstractBidiMapDecorator
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if the collection is null
      */
-    protected AbstractBidiMapDecorator(BidiMap map) {
+    protected AbstractBidiMapDecorator(BidiMap<K, V> map) {
         super(map);
     }
 
@@ -55,35 +54,25 @@ public abstract class AbstractBidiMapDecorator
      * Gets the map being decorated.
      * 
      * @return the decorated map
-     * @deprecated use decorated()
      */
-    protected BidiMap getBidiMap() {
-        return decorated();
-    }
-
-    /**
-     * Gets the map being decorated.
-     * 
-     * @return the decorated map
-     */
-    protected BidiMap decorated() {
-        return (BidiMap) super.decorated();
+    protected BidiMap<K, V> decorated() {
+        return (BidiMap<K, V>) super.decorated();
     }
 
     //-----------------------------------------------------------------------
-    public MapIterator mapIterator() {
+    public MapIterator<K, V> mapIterator() {
         return decorated().mapIterator();
     }
 
-    public Object getKey(Object value) {
+    public K getKey(Object value) {
         return decorated().getKey(value);
     }
 
-    public Object removeValue(Object value) {
+    public K removeValue(Object value) {
         return decorated().removeValue(value);
     }
 
-    public BidiMap inverseBidiMap() {
+    public BidiMap<V, K> inverseBidiMap() {
         return decorated().inverseBidiMap();
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/bidimap/AbstractDualBidiMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bidimap/AbstractDualBidiMap.java b/src/java/org/apache/commons/collections/bidimap/AbstractDualBidiMap.java
index a07ffcb..b69049d 100644
--- a/src/java/org/apache/commons/collections/bidimap/AbstractDualBidiMap.java
+++ b/src/java/org/apache/commons/collections/bidimap/AbstractDualBidiMap.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,38 +33,46 @@ import org.apache.commons.collections.keyvalue.AbstractMapEntryDecorator;
  * <p>
  * An implementation can be written simply by implementing the
  * <code>createMap</code> method.
- * 
+ *
  * @see DualHashBidiMap
  * @see DualTreeBidiMap
  * @since Commons Collections 3.0
  * @version $Id$
- * 
+ *
  * @author Matthew Hawthorne
  * @author Stephen Colebourne
  */
-public abstract class AbstractDualBidiMap implements BidiMap {
+public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
 
     /**
-     * Delegate map array.  The first map contains standard entries, and the 
-     * second contains inverses.
+     * Normal delegate map.
      */
-    protected transient final Map[] maps = new Map[2];
+    protected transient Map<K, V> normalMap;
+
+    /**
+     * Reverse delegate map.
+     */
+    protected transient Map<V, K> reverseMap;
+
     /**
      * Inverse view of this map.
      */
-    protected transient BidiMap inverseBidiMap = null;
+    protected transient BidiMap<V, K> inverseBidiMap = null;
+
     /**
      * View of the keys.
      */
-    protected transient Set keySet = null;
+    protected transient Set<K> keySet = null;
+
     /**
      * View of the values.
      */
-    protected transient Collection values = null;
+    protected transient Collection<V> values = null;
+
     /**
      * View of the entries.
      */
-    protected transient Set entrySet = null;
+    protected transient Set<Map.Entry<K, V>> entrySet = null;
 
     /**
      * Creates an empty map, initialised by <code>createMap</code>.
@@ -86,18 +94,18 @@ public abstract class AbstractDualBidiMap implements BidiMap {
      * Neither map is validated, so nulls may be passed in.
      * If you choose to do this then the subclass constructor must populate
      * the <code>maps[]</code> instance variable itself.
-     * 
+     *
      * @param normalMap  the normal direction map
      * @param reverseMap  the reverse direction map
      * @since Commons Collections 3.1
      */
-    protected AbstractDualBidiMap(Map normalMap, Map reverseMap) {
+    protected AbstractDualBidiMap(Map<K, V> normalMap, Map<V, K> reverseMap) {
         super();
-        maps[0] = normalMap;
-        maps[1] = reverseMap;
+        this.normalMap = normalMap;
+        this.reverseMap = reverseMap;
     }
 
-    /** 
+    /**
      * Constructs a map that decorates the specified maps,
      * used by the subclass <code>createBidiMap</code> implementation.
      *
@@ -105,90 +113,89 @@ public abstract class AbstractDualBidiMap implements BidiMap {
      * @param reverseMap  the reverse direction map
      * @param inverseBidiMap  the inverse BidiMap
      */
-    protected AbstractDualBidiMap(Map normalMap, Map reverseMap, BidiMap inverseBidiMap) {
+    protected AbstractDualBidiMap(Map<K, V> normalMap, Map<V, K> reverseMap, BidiMap<V, K> inverseBidiMap) {
         super();
-        maps[0] = normalMap;
-        maps[1] = reverseMap;
+        this.normalMap = normalMap;
+        this.reverseMap = reverseMap;
         this.inverseBidiMap = inverseBidiMap;
     }
 
     /**
      * Creates a new instance of the subclass.
-     * 
+     *
      * @param normalMap  the normal direction map
      * @param reverseMap  the reverse direction map
      * @param inverseMap  this map, which is the inverse in the new map
      * @return the inverse map
      */
-    protected abstract BidiMap createBidiMap(Map normalMap, Map reverseMap, BidiMap inverseMap);
+    protected abstract BidiMap<V, K> createBidiMap(Map<V, K> normalMap, Map<K, V> reverseMap, BidiMap<K, V> inverseMap);
 
     // Map delegation
     //-----------------------------------------------------------------------
-    public Object get(Object key) {
-        return maps[0].get(key);
+    public V get(Object key) {
+        return normalMap.get(key);
     }
 
     public int size() {
-        return maps[0].size();
+        return normalMap.size();
     }
 
     public boolean isEmpty() {
-        return maps[0].isEmpty();
+        return normalMap.isEmpty();
     }
 
     public boolean containsKey(Object key) {
-        return maps[0].containsKey(key);
+        return normalMap.containsKey(key);
     }
 
     public boolean equals(Object obj) {
-        return maps[0].equals(obj);
+        return normalMap.equals(obj);
     }
 
     public int hashCode() {
-        return maps[0].hashCode();
+        return normalMap.hashCode();
     }
 
     public String toString() {
-        return maps[0].toString();
+        return normalMap.toString();
     }
 
     // BidiMap changes
     //-----------------------------------------------------------------------
-    public Object put(Object key, Object value) {
-        if (maps[0].containsKey(key)) {
-            maps[1].remove(maps[0].get(key));
+    public V put(K key, V value) {
+        if (normalMap.containsKey(key)) {
+            reverseMap.remove(normalMap.get(key));
         }
-        if (maps[1].containsKey(value)) {
-            maps[0].remove(maps[1].get(value));
+        if (reverseMap.containsKey(value)) {
+            normalMap.remove(reverseMap.get(value));
         }
-        final Object obj = maps[0].put(key, value);
-        maps[1].put(value, key);
+        final V obj = normalMap.put(key, value);
+        reverseMap.put(value, key);
         return obj;
     }
-    
-    public void putAll(Map map) {
-        for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
-            Map.Entry entry = (Map.Entry) it.next();
+
+    public void putAll(Map<? extends K, ? extends V> map) {
+        for (Map.Entry<? extends K, ? extends V> entry : map.entrySet()) {
             put(entry.getKey(), entry.getValue());
         }
     }
 
-    public Object remove(Object key) {
-        Object value = null;
-        if (maps[0].containsKey(key)) {
-            value = maps[0].remove(key);
-            maps[1].remove(value);
+    public V remove(Object key) {
+        V value = null;
+        if (normalMap.containsKey(key)) {
+            value = normalMap.remove(key);
+            reverseMap.remove(value);
         }
         return value;
     }
 
     public void clear() {
-        maps[0].clear();
-        maps[1].clear();
+        normalMap.clear();
+        reverseMap.clear();
     }
 
     public boolean containsValue(Object value) {
-        return maps[1].containsKey(value);
+        return reverseMap.containsKey(value);
     }
 
     // BidiMap
@@ -201,45 +208,45 @@ public abstract class AbstractDualBidiMap implements BidiMap {
      * The setValue() methods only allow a new value to be set.
      * If the value being set is already in the map, an IllegalArgumentException
      * is thrown (as setValue cannot change the size of the map).
-     * 
+     *
      * @return a map iterator
      */
-    public MapIterator mapIterator() {
-        return new BidiMapIterator(this);
+    public MapIterator<K, V> mapIterator() {
+        return new BidiMapIterator<K, V>(this);
     }
-    
-    public Object getKey(Object value) {
-        return maps[1].get(value);
+
+    public K getKey(Object value) {
+        return reverseMap.get(value);
     }
 
-    public Object removeValue(Object value) {
-        Object key = null;
-        if (maps[1].containsKey(value)) {
-            key = maps[1].remove(value);
-            maps[0].remove(key);
+    public K removeValue(Object value) {
+        K key = null;
+        if (reverseMap.containsKey(value)) {
+            key = reverseMap.remove(value);
+            normalMap.remove(key);
         }
         return key;
     }
 
-    public BidiMap inverseBidiMap() {
+    public BidiMap<V, K> inverseBidiMap() {
         if (inverseBidiMap == null) {
-            inverseBidiMap = createBidiMap(maps[1], maps[0], this);
+            inverseBidiMap = createBidiMap(reverseMap, normalMap, this);
         }
         return inverseBidiMap;
     }
-    
+
     // Map views
     //-----------------------------------------------------------------------
     /**
      * Gets a keySet view of the map.
      * Changes made on the view are reflected in the map.
      * The set supports remove and clear but not add.
-     * 
+     *
      * @return the keySet view
      */
-    public Set keySet() {
+    public Set<K> keySet() {
         if (keySet == null) {
-            keySet = new KeySet(this);
+            keySet = new KeySet<K>(this);
         }
         return keySet;
     }
@@ -247,24 +254,24 @@ public abstract class AbstractDualBidiMap implements BidiMap {
     /**
      * Creates a key set iterator.
      * Subclasses can override this to return iterators with different properties.
-     * 
+     *
      * @param iterator  the iterator to decorate
      * @return the keySet iterator
      */
-    protected Iterator createKeySetIterator(Iterator iterator) {
-        return new KeySetIterator(iterator, this);
+    protected Iterator<K> createKeySetIterator(Iterator<K> iterator) {
+        return new KeySetIterator<K>(iterator, this);
     }
 
     /**
      * Gets a values view of the map.
      * Changes made on the view are reflected in the map.
      * The set supports remove and clear but not add.
-     * 
+     *
      * @return the values view
      */
-    public Collection values() {
+    public Collection<V> values() {
         if (values == null) {
-            values = new Values(this);
+            values = new Values<V>(this);
         }
         return values;
     }
@@ -272,12 +279,12 @@ public abstract class AbstractDualBidiMap implements BidiMap {
     /**
      * Creates a values iterator.
      * Subclasses can override this to return iterators with different properties.
-     * 
+     *
      * @param iterator  the iterator to decorate
      * @return the values iterator
      */
-    protected Iterator createValuesIterator(Iterator iterator) {
-        return new ValuesIterator(iterator, this);
+    protected Iterator<V> createValuesIterator(Iterator<V> iterator) {
+        return new ValuesIterator<V>(iterator, this);
     }
 
     /**
@@ -288,53 +295,54 @@ public abstract class AbstractDualBidiMap implements BidiMap {
      * The Map Entry setValue() method only allow a new value to be set.
      * If the value being set is already in the map, an IllegalArgumentException
      * is thrown (as setValue cannot change the size of the map).
-     * 
+     *
      * @return the entrySet view
      */
-    public Set entrySet() {
+    public Set<Map.Entry<K, V>> entrySet() {
         if (entrySet == null) {
-            entrySet = new EntrySet(this);
+            entrySet = new EntrySet<K, V>(this);
         }
         return entrySet;
     }
-    
+
     /**
      * Creates an entry set iterator.
      * Subclasses can override this to return iterators with different properties.
-     * 
+     *
      * @param iterator  the iterator to decorate
      * @return the entrySet iterator
      */
-    protected Iterator createEntrySetIterator(Iterator iterator) {
-        return new EntrySetIterator(iterator, this);
+    protected Iterator<Map.Entry<K, V>> createEntrySetIterator(Iterator<Map.Entry<K, V>> iterator) {
+        return new EntrySetIterator<K, V>(iterator, this);
     }
 
     //-----------------------------------------------------------------------
     /**
      * Inner class View.
      */
-    protected static abstract class View extends AbstractCollectionDecorator {
-        
+    @SuppressWarnings("serial")
+    protected static abstract class View<K, V, E> extends AbstractCollectionDecorator<E> {
+
         /** The parent map */
-        protected final AbstractDualBidiMap parent;
-        
+        protected final AbstractDualBidiMap<K, V> parent;
+
         /**
          * Constructs a new view of the BidiMap.
-         * 
+         *
          * @param coll  the collection view being decorated
          * @param parent  the parent BidiMap
          */
-        protected View(Collection coll, AbstractDualBidiMap parent) {
+        protected View(Collection<E> coll, AbstractDualBidiMap<K, V> parent) {
             super(coll);
             this.parent = parent;
         }
 
-        public boolean removeAll(Collection coll) {
+        public boolean removeAll(Collection<?> coll) {
             if (parent.isEmpty() || coll.isEmpty()) {
                 return false;
             }
             boolean modified = false;
-            Iterator it = iterator();
+            Iterator<E> it = iterator();
             while (it.hasNext()) {
                 if (coll.contains(it.next())) {
                     it.remove();
@@ -344,7 +352,7 @@ public abstract class AbstractDualBidiMap implements BidiMap {
             return modified;
         }
 
-        public boolean retainAll(Collection coll) {
+        public boolean retainAll(Collection<?> coll) {
             if (parent.isEmpty()) {
                 return false;
             }
@@ -353,7 +361,7 @@ public abstract class AbstractDualBidiMap implements BidiMap {
                 return true;
             }
             boolean modified = false;
-            Iterator it = iterator();
+            Iterator<E> it = iterator();
             while (it.hasNext()) {
                 if (coll.contains(it.next()) == false) {
                     it.remove();
@@ -362,80 +370,86 @@ public abstract class AbstractDualBidiMap implements BidiMap {
             }
             return modified;
         }
-        
+
         public void clear() {
             parent.clear();
         }
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Inner class KeySet.
      */
-    protected static class KeySet extends View implements Set {
-        
+    protected static class KeySet<K> extends View<K, Object, K> implements Set<K> {
+
+        /** Serialization version */
+        private static final long serialVersionUID = -7107935777385040694L;
+
         /**
          * Constructs a new view of the BidiMap.
-         * 
+         *
          * @param parent  the parent BidiMap
          */
-        protected KeySet(AbstractDualBidiMap parent) {
-            super(parent.maps[0].keySet(), parent);
+        @SuppressWarnings("unchecked")
+        protected KeySet(AbstractDualBidiMap<K, ?> parent) {
+            super(parent.normalMap.keySet(), (AbstractDualBidiMap<K, Object>) parent);
         }
 
-        public Iterator iterator() {
+        public Iterator<K> iterator() {
             return parent.createKeySetIterator(super.iterator());
         }
-        
+
         public boolean contains(Object key) {
-            return parent.maps[0].containsKey(key);
+            return parent.normalMap.containsKey(key);
         }
 
         public boolean remove(Object key) {
-            if (parent.maps[0].containsKey(key)) {
-                Object value = parent.maps[0].remove(key);
-                parent.maps[1].remove(value);
+            if (parent.normalMap.containsKey(key)) {
+                Object value = parent.normalMap.remove(key);
+                parent.reverseMap.remove(value);
                 return true;
             }
             return false;
         }
     }
-    
+
     /**
      * Inner class KeySetIterator.
      */
-    protected static class KeySetIterator extends AbstractIteratorDecorator {
-        
+    protected static class KeySetIterator<K> extends AbstractIteratorDecorator<K> {
+
         /** The parent map */
-        protected final AbstractDualBidiMap parent;
+        protected final AbstractDualBidiMap<K, ?> parent;
+
         /** The last returned key */
-        protected Object lastKey = null;
+        protected K lastKey = null;
+
         /** Whether remove is allowed at present */
         protected boolean canRemove = false;
-        
+
         /**
          * Constructor.
          * @param iterator  the iterator to decorate
          * @param parent  the parent map
          */
-        protected KeySetIterator(Iterator iterator, AbstractDualBidiMap parent) {
+        protected KeySetIterator(Iterator<K> iterator, AbstractDualBidiMap<K, ?> parent) {
             super(iterator);
             this.parent = parent;
         }
-        
-        public Object next() {
+
+        public K next() {
             lastKey = super.next();
             canRemove = true;
             return lastKey;
         }
-        
+
         public void remove() {
             if (canRemove == false) {
                 throw new IllegalStateException("Iterator remove() can only be called once after next()");
             }
-            Object value = parent.maps[0].get(lastKey);
+            Object value = parent.normalMap.get(lastKey);
             super.remove();
-            parent.maps[1].remove(value);
+            parent.reverseMap.remove(value);
             lastKey = null;
             canRemove = false;
         }
@@ -445,69 +459,76 @@ public abstract class AbstractDualBidiMap implements BidiMap {
     /**
      * Inner class Values.
      */
-    protected static class Values extends View implements Set {
-        
+    protected static class Values<V> extends View<Object, V, V> implements Set<V> {
+
+        /** Serialization version */
+        private static final long serialVersionUID = 4023777119829639864L;
+
         /**
          * Constructs a new view of the BidiMap.
-         * 
+         *
          * @param parent  the parent BidiMap
          */
-        protected Values(AbstractDualBidiMap parent) {
-            super(parent.maps[0].values(), parent);
+        @SuppressWarnings("unchecked")
+        protected Values(AbstractDualBidiMap<?, V> parent) {
+            super(parent.normalMap.values(), (AbstractDualBidiMap<Object, V>) parent);
         }
 
-        public Iterator iterator() {
+        public Iterator<V> iterator() {
             return parent.createValuesIterator(super.iterator());
         }
-        
+
         public boolean contains(Object value) {
-            return parent.maps[1].containsKey(value);
+            return parent.reverseMap.containsKey(value);
         }
 
         public boolean remove(Object value) {
-            if (parent.maps[1].containsKey(value)) {
-                Object key = parent.maps[1].remove(value);
-                parent.maps[0].remove(key);
+            if (parent.reverseMap.containsKey(value)) {
+                Object key = parent.reverseMap.remove(value);
+                parent.normalMap.remove(key);
                 return true;
             }
             return false;
         }
     }
-    
+
     /**
      * Inner class ValuesIterator.
      */
-    protected static class ValuesIterator extends AbstractIteratorDecorator {
-        
+    protected static class ValuesIterator<V> extends AbstractIteratorDecorator<V> {
+
         /** The parent map */
-        protected final AbstractDualBidiMap parent;
+        protected final AbstractDualBidiMap<Object, V> parent;
+
         /** The last returned value */
-        protected Object lastValue = null;
+        protected V lastValue = null;
+
         /** Whether remove is allowed at present */
         protected boolean canRemove = false;
-        
+
         /**
          * Constructor.
          * @param iterator  the iterator to decorate
          * @param parent  the parent map
          */
-        protected ValuesIterator(Iterator iterator, AbstractDualBidiMap parent) {
+        @SuppressWarnings("unchecked")
+        protected ValuesIterator(Iterator<V> iterator, AbstractDualBidiMap<?, V> parent) {
             super(iterator);
-            this.parent = parent;
+            this.parent = (AbstractDualBidiMap<Object, V>) parent;
         }
-        
-        public Object next() {
+
+        public V next() {
             lastValue = super.next();
             canRemove = true;
             return lastValue;
         }
-        
+
         public void remove() {
             if (canRemove == false) {
                 throw new IllegalStateException("Iterator remove() can only be called once after next()");
             }
             super.remove(); // removes from maps[0]
-            parent.maps[1].remove(lastValue);
+            parent.reverseMap.remove(lastValue);
             lastValue = null;
             canRemove = false;
         }
@@ -517,67 +538,72 @@ public abstract class AbstractDualBidiMap implements BidiMap {
     /**
      * Inner class EntrySet.
      */
-    protected static class EntrySet extends View implements Set {
-        
+    protected static class EntrySet<K, V> extends View<K, V, Map.Entry<K, V>> implements Set<Map.Entry<K, V>> {
+
+        /** Serialization version */
+        private static final long serialVersionUID = 4040410962603292348L;
+
         /**
          * Constructs a new view of the BidiMap.
-         * 
+         *
          * @param parent  the parent BidiMap
          */
-        protected EntrySet(AbstractDualBidiMap parent) {
-            super(parent.maps[0].entrySet(), parent);
+        protected EntrySet(AbstractDualBidiMap<K, V> parent) {
+            super(parent.normalMap.entrySet(), parent);
         }
 
-        public Iterator iterator() {
+        public Iterator<Map.Entry<K, V>> iterator() {
             return parent.createEntrySetIterator(super.iterator());
         }
-        
+
         public boolean remove(Object obj) {
             if (obj instanceof Map.Entry == false) {
                 return false;
             }
-            Map.Entry entry = (Map.Entry) obj;
+            Map.Entry<?, ?> entry = (Map.Entry<?, ?>) obj;
             Object key = entry.getKey();
             if (parent.containsKey(key)) {
-                Object value = parent.maps[0].get(key);
+                V value = parent.normalMap.get(key);
                 if (value == null ? entry.getValue() == null : value.equals(entry.getValue())) {
-                    parent.maps[0].remove(key);
-                    parent.maps[1].remove(value);
+                    parent.normalMap.remove(key);
+                    parent.reverseMap.remove(value);
                     return true;
                 }
             }
             return false;
         }
     }
-    
+
     /**
      * Inner class EntrySetIterator.
      */
-    protected static class EntrySetIterator extends AbstractIteratorDecorator {
-        
+    protected static class EntrySetIterator<K, V> extends AbstractIteratorDecorator<Map.Entry<K, V>> {
+
         /** The parent map */
-        protected final AbstractDualBidiMap parent;
+        protected final AbstractDualBidiMap<K, V> parent;
+
         /** The last returned entry */
-        protected Map.Entry last = null;
+        protected Map.Entry<K, V> last = null;
+
         /** Whether remove is allowed at present */
         protected boolean canRemove = false;
-        
+
         /**
          * Constructor.
          * @param iterator  the iterator to decorate
          * @param parent  the parent map
          */
-        protected EntrySetIterator(Iterator iterator, AbstractDualBidiMap parent) {
+        protected EntrySetIterator(Iterator<Map.Entry<K, V>> iterator, AbstractDualBidiMap<K, V> parent) {
             super(iterator);
             this.parent = parent;
         }
-        
-        public Object next() {
-            last = new MapEntry((Map.Entry) super.next(), parent);
+
+        public Map.Entry<K, V> next() {
+            last = new MapEntry<K, V>(super.next(), parent);
             canRemove = true;
             return last;
         }
-        
+
         public void remove() {
             if (canRemove == false) {
                 throw new IllegalStateException("Iterator remove() can only be called once after next()");
@@ -585,7 +611,7 @@ public abstract class AbstractDualBidiMap implements BidiMap {
             // store value as remove may change the entry in the decorator (eg.TreeMap)
             Object value = last.getValue();
             super.remove();
-            parent.maps[1].remove(value);
+            parent.reverseMap.remove(value);
             last = null;
             canRemove = false;
         }
@@ -594,117 +620,119 @@ public abstract class AbstractDualBidiMap implements BidiMap {
     /**
      * Inner class MapEntry.
      */
-    protected static class MapEntry extends AbstractMapEntryDecorator {
+    protected static class MapEntry<K, V> extends AbstractMapEntryDecorator<K, V> {
+
+        /** The parent map */
+        protected final AbstractDualBidiMap<K, V> parent;
 
-        /** The parent map */        
-        protected final AbstractDualBidiMap parent;
-        
         /**
          * Constructor.
          * @param entry  the entry to decorate
          * @param parent  the parent map
          */
-        protected MapEntry(Map.Entry entry, AbstractDualBidiMap parent) {
+        protected MapEntry(Map.Entry<K, V> entry, AbstractDualBidiMap<K, V> parent) {
             super(entry);
             this.parent = parent;
         }
-        
-        public Object setValue(Object value) {
-            Object key = MapEntry.this.getKey();
-            if (parent.maps[1].containsKey(value) &&
-                parent.maps[1].get(value) != key) {
+
+        public V setValue(V value) {
+            K key = MapEntry.this.getKey();
+            if (parent.reverseMap.containsKey(value) &&
+                parent.reverseMap.get(value) != key) {
                 throw new IllegalArgumentException("Cannot use setValue() when the object being set is already in the map");
             }
             parent.put(key, value);
-            final Object oldValue = super.setValue(value);
+            final V oldValue = super.setValue(value);
             return oldValue;
         }
     }
-    
+
     /**
      * Inner class MapIterator.
      */
-    protected static class BidiMapIterator implements MapIterator, ResettableIterator {
-        
+    protected static class BidiMapIterator<K, V> implements MapIterator<K, V>, ResettableIterator<K> {
+
         /** The parent map */
-        protected final AbstractDualBidiMap parent;
+        protected final AbstractDualBidiMap<K, V> parent;
+
         /** The iterator being wrapped */
-        protected Iterator iterator;
+        protected Iterator<Map.Entry<K, V>> iterator;
+
         /** The last returned entry */
-        protected Map.Entry last = null;
+        protected Map.Entry<K, V> last = null;
+
         /** Whether remove is allowed at present */
         protected boolean canRemove = false;
-        
+
         /**
          * Constructor.
          * @param parent  the parent map
          */
-        protected BidiMapIterator(AbstractDualBidiMap parent) {
+        protected BidiMapIterator(AbstractDualBidiMap<K, V> parent) {
             super();
             this.parent = parent;
-            this.iterator = parent.maps[0].entrySet().iterator();
+            this.iterator = parent.normalMap.entrySet().iterator();
         }
-        
+
         public boolean hasNext() {
             return iterator.hasNext();
         }
-        
-        public Object next() {
-            last = (Map.Entry) iterator.next();
+
+        public K next() {
+            last = iterator.next();
             canRemove = true;
             return last.getKey();
         }
-        
+
         public void remove() {
             if (canRemove == false) {
                 throw new IllegalStateException("Iterator remove() can only be called once after next()");
             }
             // store value as remove may change the entry in the decorator (eg.TreeMap)
-            Object value = last.getValue();
+            V value = last.getValue();
             iterator.remove();
-            parent.maps[1].remove(value);
+            parent.reverseMap.remove(value);
             last = null;
             canRemove = false;
         }
-        
-        public Object getKey() {
+
+        public K getKey() {
             if (last == null) {
                 throw new IllegalStateException("Iterator getKey() can only be called after next() and before remove()");
             }
             return last.getKey();
         }
 
-        public Object getValue() {
+        public V getValue() {
             if (last == null) {
                 throw new IllegalStateException("Iterator getValue() can only be called after next() and before remove()");
             }
             return last.getValue();
         }
-        
-        public Object setValue(Object value) {
+
+        public V setValue(V value) {
             if (last == null) {
                 throw new IllegalStateException("Iterator setValue() can only be called after next() and before remove()");
             }
-            if (parent.maps[1].containsKey(value) &&
-                parent.maps[1].get(value) != last.getKey()) {
+            if (parent.reverseMap.containsKey(value) &&
+                parent.reverseMap.get(value) != last.getKey()) {
                 throw new IllegalArgumentException("Cannot use setValue() when the object being set is already in the map");
             }
             return parent.put(last.getKey(), value);
         }
-        
+
         public void reset() {
-            iterator = parent.maps[0].entrySet().iterator();
+            iterator = parent.normalMap.entrySet().iterator();
             last = null;
             canRemove = false;
         }
-        
+
         public String toString() {
             if (last != null) {
                 return "MapIterator[" + getKey() + "=" + getValue() + "]";
-            } else {
-                return "MapIterator[]";
             }
+            return "MapIterator[]";
         }
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/bidimap/AbstractOrderedBidiMapDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bidimap/AbstractOrderedBidiMapDecorator.java b/src/java/org/apache/commons/collections/bidimap/AbstractOrderedBidiMapDecorator.java
index 7a96af6..1602ef8 100644
--- a/src/java/org/apache/commons/collections/bidimap/AbstractOrderedBidiMapDecorator.java
+++ b/src/java/org/apache/commons/collections/bidimap/AbstractOrderedBidiMapDecorator.java
@@ -36,9 +36,9 @@ import org.apache.commons.collections.OrderedMapIterator;
  * 
  * @author Stephen Colebourne
  */
-public abstract class AbstractOrderedBidiMapDecorator
-        extends AbstractBidiMapDecorator
-        implements OrderedBidiMap {
+public abstract class AbstractOrderedBidiMapDecorator<K, V>
+        extends AbstractBidiMapDecorator<K, V>
+        implements OrderedBidiMap<K, V> {
 
     /**
      * Constructor that wraps (not copies).
@@ -46,7 +46,7 @@ public abstract class AbstractOrderedBidiMapDecorator
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if the collection is null
      */
-    protected AbstractOrderedBidiMapDecorator(OrderedBidiMap map) {
+    protected AbstractOrderedBidiMapDecorator(OrderedBidiMap<K, V> map) {
         super(map);
     }
 
@@ -54,44 +54,35 @@ public abstract class AbstractOrderedBidiMapDecorator
      * Gets the map being decorated.
      * 
      * @return the decorated map
-     * @deprecated use decorated()
      */
-    protected OrderedBidiMap getOrderedBidiMap() {
-        return decorated();
-    }
-
-    /**
-     * Gets the map being decorated.
-     * 
-     * @return the decorated map
-     */
-    protected OrderedBidiMap decorated() {
-        return (OrderedBidiMap) super.decorated();
+    protected OrderedBidiMap<K, V> decorated() {
+        return (OrderedBidiMap<K, V>) super.decorated();
     }
 
     //-----------------------------------------------------------------------
-    public OrderedMapIterator orderedMapIterator() {
-        return decorated().orderedMapIterator();
+    public OrderedMapIterator<K, V> mapIterator() {
+        return decorated().mapIterator();
     }
 
-    public Object firstKey() {
+    public K firstKey() {
         return decorated().firstKey();
     }
 
-    public Object lastKey() {
+    public K lastKey() {
         return decorated().lastKey();
     }
 
-    public Object nextKey(Object key) {
+    public K nextKey(K key) {
         return decorated().nextKey(key);
     }
 
-    public Object previousKey(Object key) {
+    public K previousKey(K key) {
         return decorated().previousKey(key);
     }
 
-    public OrderedBidiMap inverseOrderedBidiMap() {
-        return decorated().inverseOrderedBidiMap();
+    @Override
+    public OrderedBidiMap<V, K> inverseBidiMap() {
+        return decorated().inverseBidiMap();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/bidimap/AbstractSortedBidiMapDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bidimap/AbstractSortedBidiMapDecorator.java b/src/java/org/apache/commons/collections/bidimap/AbstractSortedBidiMapDecorator.java
index af56d2d..3fec108 100644
--- a/src/java/org/apache/commons/collections/bidimap/AbstractSortedBidiMapDecorator.java
+++ b/src/java/org/apache/commons/collections/bidimap/AbstractSortedBidiMapDecorator.java
@@ -38,9 +38,8 @@ import org.apache.commons.collections.SortedBidiMap;
  * 
  * @author Stephen Colebourne
  */
-public abstract class AbstractSortedBidiMapDecorator
-        extends AbstractOrderedBidiMapDecorator
-        implements SortedBidiMap {
+public abstract class AbstractSortedBidiMapDecorator<K, V> extends
+        AbstractOrderedBidiMapDecorator<K, V> implements SortedBidiMap<K, V> {
 
     /**
      * Constructor that wraps (not copies).
@@ -48,7 +47,7 @@ public abstract class AbstractSortedBidiMapDecorator
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if the collection is null
      */
-    public AbstractSortedBidiMapDecorator(SortedBidiMap map) {
+    public AbstractSortedBidiMapDecorator(SortedBidiMap<K, V> map) {
         super(map);
     }
 
@@ -56,39 +55,34 @@ public abstract class AbstractSortedBidiMapDecorator
      * Gets the map being decorated.
      * 
      * @return the decorated map
-     * @deprecated use decorated()
      */
-    protected SortedBidiMap getSortedBidiMap() {
-        return decorated();
-    }
-
-    /**
-     * Gets the map being decorated.
-     * 
-     * @return the decorated map
-     */
-    protected SortedBidiMap decorated() {
-        return (SortedBidiMap) super.decorated();
+    protected SortedBidiMap<K, V> decorated() {
+        return (SortedBidiMap<K, V>) super.decorated();
     }
 
     //-----------------------------------------------------------------------
-    public SortedBidiMap inverseSortedBidiMap() {
-        return getSortedBidiMap().inverseSortedBidiMap();
+    @Override
+    public SortedBidiMap<V, K> inverseBidiMap() {
+        return decorated().inverseBidiMap();
     }
 
-    public Comparator comparator() {
+    public Comparator<? super K> comparator() {
         return decorated().comparator();
     }
 
-    public SortedMap subMap(Object fromKey, Object toKey) {
+    public Comparator<? super V> valueComparator() {
+        return decorated().valueComparator();
+    }
+
+    public SortedMap<K, V> subMap(K fromKey, K toKey) {
         return decorated().subMap(fromKey, toKey);
     }
 
-    public SortedMap headMap(Object toKey) {
+    public SortedMap<K, V> headMap(K toKey) {
         return decorated().headMap(toKey);
     }
 
-    public SortedMap tailMap(Object fromKey) {
+    public SortedMap<K, V> tailMap(K fromKey) {
         return decorated().tailMap(fromKey);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/bidimap/DualHashBidiMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bidimap/DualHashBidiMap.java b/src/java/org/apache/commons/collections/bidimap/DualHashBidiMap.java
index 067b2a6..b0927aa 100644
--- a/src/java/org/apache/commons/collections/bidimap/DualHashBidiMap.java
+++ b/src/java/org/apache/commons/collections/bidimap/DualHashBidiMap.java
@@ -42,8 +42,7 @@ import org.apache.commons.collections.BidiMap;
  * @author Matthew Hawthorne
  * @author Stephen Colebourne
  */
-public class DualHashBidiMap
-        extends AbstractDualBidiMap implements Serializable {
+public class DualHashBidiMap<K, V> extends AbstractDualBidiMap<K, V> implements Serializable {
 
     /** Ensure serialization compatibility */
     private static final long serialVersionUID = 721969328361808L;
@@ -52,7 +51,7 @@ public class DualHashBidiMap
      * Creates an empty <code>HashBidiMap</code>.
      */
     public DualHashBidiMap() {
-        super(new HashMap(), new HashMap());
+        super(new HashMap<K, V>(), new HashMap<V, K>());
     }
 
     /** 
@@ -61,8 +60,8 @@ public class DualHashBidiMap
      *
      * @param map  the map whose mappings are to be placed in this map
      */
-    public DualHashBidiMap(Map map) {
-        super(new HashMap(), new HashMap());
+    public DualHashBidiMap(Map<K, V> map) {
+        super(new HashMap<K, V>(), new HashMap<V, K>());
         putAll(map);
     }
     
@@ -73,7 +72,7 @@ public class DualHashBidiMap
      * @param reverseMap  the reverse direction map
      * @param inverseBidiMap  the inverse BidiMap
      */
-    protected DualHashBidiMap(Map normalMap, Map reverseMap, BidiMap inverseBidiMap) {
+    protected DualHashBidiMap(Map<K, V> normalMap, Map<V, K> reverseMap, BidiMap<V, K> inverseBidiMap) {
         super(normalMap, reverseMap, inverseBidiMap);
     }
 
@@ -85,21 +84,22 @@ public class DualHashBidiMap
      * @param inverseBidiMap  the inverse BidiMap
      * @return new bidi map
      */
-    protected BidiMap createBidiMap(Map normalMap, Map reverseMap, BidiMap inverseBidiMap) {
-        return new DualHashBidiMap(normalMap, reverseMap, inverseBidiMap);
+    protected BidiMap<V, K> createBidiMap(Map<V, K> normalMap, Map<K, V> reverseMap, BidiMap<K, V> inverseBidiMap) {
+        return new DualHashBidiMap<V, K>(normalMap, reverseMap, inverseBidiMap);
     }
 
     // Serialization
     //-----------------------------------------------------------------------
     private void writeObject(ObjectOutputStream out) throws IOException {
         out.defaultWriteObject();
-        out.writeObject(maps[0]);
+        out.writeObject(normalMap);
     }
 
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
-        maps[0] = new HashMap();
-        maps[1] = new HashMap();
+        normalMap = new HashMap();
+        reverseMap = new HashMap();
         Map map = (Map) in.readObject();
         putAll(map);
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/bidimap/DualTreeBidiMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bidimap/DualTreeBidiMap.java b/src/java/org/apache/commons/collections/bidimap/DualTreeBidiMap.java
index fb8aef0..5ced759 100644
--- a/src/java/org/apache/commons/collections/bidimap/DualTreeBidiMap.java
+++ b/src/java/org/apache/commons/collections/bidimap/DualTreeBidiMap.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.
@@ -48,97 +48,110 @@ import org.apache.commons.collections.map.AbstractSortedMapDecorator;
  * <p>
  * NOTE: From Commons Collections 3.1, all subclasses will use <code>TreeMap</code>
  * and the flawed <code>createMap</code> method is ignored.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Id$
- * 
+ *
  * @author Matthew Hawthorne
  * @author Stephen Colebourne
  */
-public class DualTreeBidiMap
-        extends AbstractDualBidiMap implements SortedBidiMap, Serializable {
+public class DualTreeBidiMap<K, V> extends AbstractDualBidiMap<K, V> implements
+        SortedBidiMap<K, V>, Serializable {
 
     /** Ensure serialization compatibility */
     private static final long serialVersionUID = 721969328361809L;
-    /** The comparator to use */
-    protected final Comparator comparator;
+
+    /** The key comparator to use */
+    protected final Comparator<? super K> comparator;
+
+    /** The value comparator to use */
+    protected final Comparator<? super V> valueComparator;
     
     /**
      * Creates an empty <code>DualTreeBidiMap</code>
      */
     public DualTreeBidiMap() {
-        super(new TreeMap(), new TreeMap());
+        super(new TreeMap<K, V>(), new TreeMap<V, K>());
         this.comparator = null;
+        this.valueComparator = null;
     }
 
-    /** 
+    /**
      * Constructs a <code>DualTreeBidiMap</code> and copies the mappings from
-     * specified <code>Map</code>.  
+     * specified <code>Map</code>.
      *
      * @param map  the map whose mappings are to be placed in this map
      */
-    public DualTreeBidiMap(Map map) {
-        super(new TreeMap(), new TreeMap());
+    public DualTreeBidiMap(Map<K, V> map) {
+        super(new TreeMap<K, V>(), new TreeMap<V, K>());
         putAll(map);
         this.comparator = null;
+        this.valueComparator = null;
     }
 
-    /** 
+    /**
      * Constructs a <code>DualTreeBidiMap</code> using the specified Comparator.
      *
-     * @param comparator  the Comparator
+     * @param keyComparator  the Comparator
      */
-    public DualTreeBidiMap(Comparator comparator) {
-        super(new TreeMap(comparator), new TreeMap(comparator));
-        this.comparator = comparator;
+    public DualTreeBidiMap(Comparator<? super K> keyComparator, Comparator<? super V> valueComparator) {
+        super(new TreeMap<K, V>(keyComparator), new TreeMap<V, K>(valueComparator));
+        this.comparator = keyComparator;
+        this.valueComparator = valueComparator;
     }
 
-    /** 
+    /**
      * Constructs a <code>DualTreeBidiMap</code> that decorates the specified maps.
      *
      * @param normalMap  the normal direction map
      * @param reverseMap  the reverse direction map
      * @param inverseBidiMap  the inverse BidiMap
      */
-    protected DualTreeBidiMap(Map normalMap, Map reverseMap, BidiMap inverseBidiMap) {
+    protected DualTreeBidiMap(Map<K, V> normalMap, Map<V, K> reverseMap, BidiMap<V, K> inverseBidiMap) {
         super(normalMap, reverseMap, inverseBidiMap);
-        this.comparator = ((SortedMap) normalMap).comparator();
+        this.comparator = ((SortedMap<K, V>) normalMap).comparator();
+        this.valueComparator = ((SortedMap<V, K>) reverseMap).comparator();
     }
 
     /**
      * Creates a new instance of this object.
-     * 
+     *
      * @param normalMap  the normal direction map
      * @param reverseMap  the reverse direction map
      * @param inverseMap  the inverse BidiMap
      * @return new bidi map
      */
-    protected BidiMap createBidiMap(Map normalMap, Map reverseMap, BidiMap inverseMap) {
-        return new DualTreeBidiMap(normalMap, reverseMap, inverseMap);
+    protected DualTreeBidiMap<V, K> createBidiMap(Map<V, K> normalMap, Map<K, V> reverseMap, BidiMap<K, V> inverseMap) {
+        return new DualTreeBidiMap<V, K>(normalMap, reverseMap, inverseMap);
     }
 
     //-----------------------------------------------------------------------
-    public Comparator comparator() {
-        return ((SortedMap) maps[0]).comparator();
+    public Comparator<? super K> comparator() {
+        return ((SortedMap<K, V>) normalMap).comparator();
     }
 
-    public Object firstKey() {
-        return ((SortedMap) maps[0]).firstKey();
+    public Comparator<? super V> valueComparator() {
+        return ((SortedMap<V, K>) reverseMap).comparator();
+        
     }
 
-    public Object lastKey() {
-        return ((SortedMap) maps[0]).lastKey();
+    public K firstKey() {
+        return ((SortedMap<K, V>) normalMap).firstKey();
     }
 
-    public Object nextKey(Object key) {
+    public K lastKey() {
+        return ((SortedMap<K, V>) normalMap).lastKey();
+    }
+
+    public K nextKey(K key) {
         if (isEmpty()) {
             return null;
         }
-        if (maps[0] instanceof OrderedMap) {
-            return ((OrderedMap) maps[0]).nextKey(key);
+        if (normalMap instanceof OrderedMap) {
+            return ((OrderedMap<K, ?>) normalMap).nextKey(key);
         }
-        SortedMap sm = (SortedMap) maps[0];
-        Iterator it = sm.tailMap(key).keySet().iterator();
+        SortedMap<K, V> sm = (SortedMap<K, V>) normalMap;
+        Iterator<K> it = sm.tailMap(key).keySet().iterator();
         it.next();
         if (it.hasNext()) {
             return it.next();
@@ -146,15 +159,15 @@ public class DualTreeBidiMap
         return null;
     }
 
-    public Object previousKey(Object key) {
+    public K previousKey(K key) {
         if (isEmpty()) {
             return null;
         }
-        if (maps[0] instanceof OrderedMap) {
-            return ((OrderedMap) maps[0]).previousKey(key);
+        if (normalMap instanceof OrderedMap) {
+            return ((OrderedMap<K, V>) normalMap).previousKey(key);
         }
-        SortedMap sm = (SortedMap) maps[0];
-        SortedMap hm = sm.headMap(key);
+        SortedMap<K, V> sm = (SortedMap<K, V>) normalMap;
+        SortedMap<K, V> hm = sm.headMap(key);
         if (hm.isEmpty()) {
             return null;
         }
@@ -167,81 +180,94 @@ public class DualTreeBidiMap
      * <p>
      * This implementation copies the elements to an ArrayList in order to
      * provide the forward/backward behaviour.
-     * 
+     *
      * @return a new ordered map iterator
      */
-    public OrderedMapIterator orderedMapIterator() {
-        return new BidiOrderedMapIterator(this);
+    public OrderedMapIterator<K, V> mapIterator() {
+        return new BidiOrderedMapIterator<K, V>(this);
     }
 
-    public SortedBidiMap inverseSortedBidiMap() {
-        return (SortedBidiMap) inverseBidiMap();
+    public SortedBidiMap<V, K> inverseSortedBidiMap() {
+        return (SortedBidiMap<V, K>) inverseBidiMap();
     }
 
-    public OrderedBidiMap inverseOrderedBidiMap() {
-        return (OrderedBidiMap) inverseBidiMap();
+    public OrderedBidiMap<V, K> inverseOrderedBidiMap() {
+        return (OrderedBidiMap<V, K>) inverseBidiMap();
     }
 
     //-----------------------------------------------------------------------
-    public SortedMap headMap(Object toKey) {
-        SortedMap sub = ((SortedMap) maps[0]).headMap(toKey);
-        return new ViewMap(this, sub);
+    public SortedMap<K, V> headMap(K toKey) {
+        SortedMap<K, V> sub = ((SortedMap<K, V>) normalMap).headMap(toKey);
+        return new ViewMap<K, V>(this, sub);
     }
 
-    public SortedMap tailMap(Object fromKey) {
-        SortedMap sub = ((SortedMap) maps[0]).tailMap(fromKey);
-        return new ViewMap(this, sub);
+    public SortedMap<K, V> tailMap(K fromKey) {
+        SortedMap<K, V> sub = ((SortedMap<K, V>) normalMap).tailMap(fromKey);
+        return new ViewMap<K, V>(this, sub);
     }
 
-    public SortedMap subMap(Object fromKey, Object toKey) {
-        SortedMap sub = ((SortedMap) maps[0]).subMap(fromKey, toKey);
-        return new ViewMap(this, sub);
+    public SortedMap<K, V> subMap(K fromKey, K toKey) {
+        SortedMap<K, V> sub = ((SortedMap<K, V>) normalMap).subMap(fromKey, toKey);
+        return new ViewMap<K, V>(this, sub);
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public SortedBidiMap<V, K> inverseBidiMap() {
+        return (SortedBidiMap<V, K>) super.inverseBidiMap();
+    }
+
     //-----------------------------------------------------------------------
     /**
      * Internal sorted map view.
      */
-    protected static class ViewMap extends AbstractSortedMapDecorator {
+    protected static class ViewMap<K, V> extends AbstractSortedMapDecorator<K, V> {
         /** The parent bidi map. */
-        final DualTreeBidiMap bidi;
-        
+        final DualTreeBidiMap<K, V> bidi;
+
         /**
          * Constructor.
          * @param bidi  the parent bidi map
          * @param sm  the subMap sorted map
          */
-        protected ViewMap(DualTreeBidiMap bidi, SortedMap sm) {
+        protected ViewMap(DualTreeBidiMap<K, V> bidi, SortedMap<K, V> sm) {
             // the implementation is not great here...
-            // use the maps[0] as the filtered map, but maps[1] as the full map
+            // use the normalMap as the filtered map, but reverseMap as the full map
             // this forces containsValue and clear to be overridden
-            super((SortedMap) bidi.createBidiMap(sm, bidi.maps[1], bidi.inverseBidiMap));
-            this.bidi = (DualTreeBidiMap) map;
+            super(new DualTreeBidiMap<K, V>(sm, bidi.reverseMap, bidi.inverseBidiMap));
+            this.bidi = (DualTreeBidiMap<K, V>) decorated();
         }
-        
+
         public boolean containsValue(Object value) {
-            // override as default implementation jumps to [1]
-            return bidi.maps[0].containsValue(value);
+            // override as default implementation uses reverseMap
+            return decorated().normalMap.containsValue(value);
         }
-        
+
         public void clear() {
-            // override as default implementation jumps to [1]
-            for (Iterator it = keySet().iterator(); it.hasNext();) {
+            // override as default implementation uses reverseMap
+            for (Iterator<K> it = keySet().iterator(); it.hasNext();) {
                 it.next();
                 it.remove();
             }
         }
-        
-        public SortedMap headMap(Object toKey) {
-            return new ViewMap(bidi, super.headMap(toKey));
+
+        public SortedMap<K, V> headMap(K toKey) {
+            return new ViewMap<K, V>(decorated(), super.headMap(toKey));
+        }
+
+        public SortedMap<K, V> tailMap(K fromKey) {
+            return new ViewMap<K, V>(decorated(), super.tailMap(fromKey));
         }
 
-        public SortedMap tailMap(Object fromKey) {
-            return new ViewMap(bidi, super.tailMap(fromKey));
+        public SortedMap<K, V> subMap(K fromKey, K toKey) {
+            return new ViewMap<K, V>(decorated(), super.subMap(fromKey, toKey));
         }
 
-        public SortedMap subMap(Object fromKey, Object toKey) {
-            return new ViewMap(bidi, super.subMap(fromKey, toKey));
+        @Override
+        protected DualTreeBidiMap<K, V> decorated() {
+            return (DualTreeBidiMap<K, V>) super.decorated();
         }
     }
 
@@ -249,99 +275,101 @@ public class DualTreeBidiMap
     /**
      * Inner class MapIterator.
      */
-    protected static class BidiOrderedMapIterator implements OrderedMapIterator, ResettableIterator {
-        
+    protected static class BidiOrderedMapIterator<K, V> implements OrderedMapIterator<K, V>, ResettableIterator<K> {
+
         /** The parent map */
-        protected final AbstractDualBidiMap parent;
+        protected final AbstractDualBidiMap<K, V> parent;
+
         /** The iterator being decorated */
-        protected ListIterator iterator;
+        protected ListIterator<Map.Entry<K, V>> iterator;
+
         /** The last returned entry */
-        private Map.Entry last = null;
-        
+        private Map.Entry<K, V> last = null;
+
         /**
          * Constructor.
          * @param parent  the parent map
          */
-        protected BidiOrderedMapIterator(AbstractDualBidiMap parent) {
+        protected BidiOrderedMapIterator(AbstractDualBidiMap<K, V> parent) {
             super();
             this.parent = parent;
-            iterator = new ArrayList(parent.entrySet()).listIterator();
+            iterator = new ArrayList<Map.Entry<K, V>>(parent.entrySet()).listIterator();
         }
-        
+
         public boolean hasNext() {
             return iterator.hasNext();
         }
-        
-        public Object next() {
-            last = (Map.Entry) iterator.next();
+
+        public K next() {
+            last = iterator.next();
             return last.getKey();
         }
-        
+
         public boolean hasPrevious() {
             return iterator.hasPrevious();
         }
-        
-        public Object previous() {
-            last = (Map.Entry) iterator.previous();
+
+        public K previous() {
+            last = iterator.previous();
             return last.getKey();
         }
-        
+
         public void remove() {
             iterator.remove();
             parent.remove(last.getKey());
             last = null;
         }
-        
-        public Object getKey() {
+
+        public K getKey() {
             if (last == null) {
                 throw new IllegalStateException("Iterator getKey() can only be called after next() and before remove()");
             }
             return last.getKey();
         }
 
-        public Object getValue() {
+        public V getValue() {
             if (last == null) {
                 throw new IllegalStateException("Iterator getValue() can only be called after next() and before remove()");
             }
             return last.getValue();
         }
-        
-        public Object setValue(Object value) {
+
+        public V setValue(V value) {
             if (last == null) {
                 throw new IllegalStateException("Iterator setValue() can only be called after next() and before remove()");
             }
-            if (parent.maps[1].containsKey(value) &&
-                parent.maps[1].get(value) != last.getKey()) {
+            if (parent.reverseMap.containsKey(value) &&
+                parent.reverseMap.get(value) != last.getKey()) {
                 throw new IllegalArgumentException("Cannot use setValue() when the object being set is already in the map");
             }
             return parent.put(last.getKey(), value);
         }
-        
+
         public void reset() {
-            iterator = new ArrayList(parent.entrySet()).listIterator();
+            iterator = new ArrayList<Map.Entry<K, V>>(parent.entrySet()).listIterator();
             last = null;
         }
-        
+
         public String toString() {
             if (last != null) {
                 return "MapIterator[" + getKey() + "=" + getValue() + "]";
-            } else {
-                return "MapIterator[]";
             }
+            return "MapIterator[]";
         }
     }
-    
+
     // Serialization
     //-----------------------------------------------------------------------
     private void writeObject(ObjectOutputStream out) throws IOException {
         out.defaultWriteObject();
-        out.writeObject(maps[0]);
+        out.writeObject(normalMap);
     }
 
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
-        maps[0] = new TreeMap(comparator);
-        maps[1] = new TreeMap(comparator);
+        normalMap = new TreeMap(comparator);
+        reverseMap = new TreeMap(comparator);
         Map map = (Map) in.readObject();
         putAll(map);
     }


[19/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/SingletonMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/SingletonMap.java b/src/java/org/apache/commons/collections/map/SingletonMap.java
index 12372f1..a3ae8c0 100644
--- a/src/java/org/apache/commons/collections/map/SingletonMap.java
+++ b/src/java/org/apache/commons/collections/map/SingletonMap.java
@@ -27,7 +27,6 @@ import java.util.Set;
 
 import org.apache.commons.collections.BoundedMap;
 import org.apache.commons.collections.KeyValue;
-import org.apache.commons.collections.MapIterator;
 import org.apache.commons.collections.OrderedMap;
 import org.apache.commons.collections.OrderedMapIterator;
 import org.apache.commons.collections.ResettableIterator;
@@ -59,16 +58,16 @@ import org.apache.commons.collections.keyvalue.TiedMapEntry;
  *
  * @author Stephen Colebourne
  */
-public class SingletonMap
-        implements OrderedMap, BoundedMap, KeyValue, Serializable, Cloneable {
+public class SingletonMap<K, V>
+        implements OrderedMap<K, V>, BoundedMap<K, V>, KeyValue<K, V>, Serializable, Cloneable {
 
     /** Serialization version */
     private static final long serialVersionUID = -8931271118676803261L;
 
     /** Singleton key */
-    private final Object key;
+    private final K key;
     /** Singleton value */
-    private Object value;
+    private V value;
 
     /**
      * Constructor that creates a map of <code>null</code> to <code>null</code>.
@@ -84,7 +83,7 @@ public class SingletonMap
      * @param key  the key to use
      * @param value  the value to use
      */
-    public SingletonMap(Object key, Object value) {
+    public SingletonMap(K key, V value) {
         super();
         this.key = key;
         this.value = value;
@@ -95,7 +94,7 @@ public class SingletonMap
      *
      * @param keyValue  the key value pair to use
      */
-    public SingletonMap(KeyValue keyValue) {
+    public SingletonMap(KeyValue<K, V> keyValue) {
         super();
         this.key = keyValue.getKey();
         this.value = keyValue.getValue();
@@ -106,7 +105,7 @@ public class SingletonMap
      *
      * @param mapEntry  the mapEntry to use
      */
-    public SingletonMap(Map.Entry mapEntry) {
+    public SingletonMap(Map.Entry<K, V> mapEntry) {
         super();
         this.key = mapEntry.getKey();
         this.value = mapEntry.getValue();
@@ -119,12 +118,12 @@ public class SingletonMap
      * @throws NullPointerException if the map is null
      * @throws IllegalArgumentException if the size is not 1
      */
-    public SingletonMap(Map map) {
+    public SingletonMap(Map<K, V> map) {
         super();
         if (map.size() != 1) {
             throw new IllegalArgumentException("The map size must be 1");
         }
-        Map.Entry entry = (Map.Entry) map.entrySet().iterator().next();
+        Map.Entry<K, V> entry = map.entrySet().iterator().next();
         this.key = entry.getKey();
         this.value = entry.getValue();
     }
@@ -136,7 +135,7 @@ public class SingletonMap
      *
      * @return the key 
      */
-    public Object getKey() {
+    public K getKey() {
         return key;
     }
 
@@ -145,7 +144,7 @@ public class SingletonMap
      *
      * @return the value
      */
-    public Object getValue() {
+    public V getValue() {
         return value;
     }
 
@@ -155,8 +154,8 @@ public class SingletonMap
      * @param value  the new value to set
      * @return the old value
      */
-    public Object setValue(Object value) {
-        Object old = this.value;
+    public V setValue(V value) {
+        V old = this.value;
         this.value = value;
         return old;
     }
@@ -189,7 +188,7 @@ public class SingletonMap
      * @param key  the key
      * @return the mapped value, null if no match
      */
-    public Object get(Object key) {
+    public V get(Object key) {
         if (isEqualKey(key)) {
             return value;
         }
@@ -247,7 +246,7 @@ public class SingletonMap
      * @return the value previously mapped to this key, null if none
      * @throws IllegalArgumentException if the key does not match
      */
-    public Object put(Object key, Object value) {
+    public V put(K key, V value) {
         if (isEqualKey(key)) {
             return setValue(value);
         }
@@ -265,21 +264,21 @@ public class SingletonMap
      * @throws NullPointerException if the map is null
      * @throws IllegalArgumentException if the key does not match
      */
-    public void putAll(Map map) {
+    public void putAll(Map<? extends K, ? extends V> map) {
         switch (map.size()) {
             case 0:
                 return;
-            
+
             case 1:
-                Map.Entry entry = (Map.Entry) map.entrySet().iterator().next();
+                Map.Entry<? extends K, ? extends V> entry = map.entrySet().iterator().next();
                 put(entry.getKey(), entry.getValue());
                 return;
-            
+
             default:
                 throw new IllegalArgumentException("The map size must be 0 or 1");
         }
     }
-
+    
     /**
      * Unsupported operation.
      * 
@@ -287,7 +286,7 @@ public class SingletonMap
      * @return the value mapped to the removed key, null if key not in map
      * @throws UnsupportedOperationException always
      */
-    public Object remove(Object key) {
+    public V remove(Object key) {
         throw new UnsupportedOperationException();
     }
 
@@ -306,8 +305,8 @@ public class SingletonMap
      * 
      * @return the entrySet view
      */
-    public Set entrySet() {
-        Map.Entry entry = new TiedMapEntry(this, getKey());
+    public Set<Map.Entry<K, V>> entrySet() {
+        Map.Entry<K, V> entry = new TiedMapEntry<K, V>(this, getKey());
         return Collections.singleton(entry);
     }
     
@@ -318,7 +317,7 @@ public class SingletonMap
      * 
      * @return the keySet view
      */
-    public Set keySet() {
+    public Set<K> keySet() {
         return Collections.singleton(key);
     }
 
@@ -329,38 +328,15 @@ public class SingletonMap
      * 
      * @return the values view
      */
-    public Collection values() {
-        return new SingletonValues(this);
+    public Collection<V> values() {
+        return new SingletonValues<V>(this);
     }
 
     /**
-     * Gets an iterator over the map.
-     * Changes made to the iterator using <code>setValue</code> affect this map.
-     * The <code>remove</code> method is unsupported.
-     * <p>
-     * A MapIterator returns the keys in the map. It also provides convenient
-     * methods to get the key and value, and set the value.
-     * It avoids the need to create an entrySet/keySet/values object.
-     * It also avoids creating the Map Entry object.
-     * 
-     * @return the map iterator
-     */
-    public MapIterator mapIterator() {
-        return new SingletonMapIterator(this);
-    }
-
-    // OrderedMap
-    //-----------------------------------------------------------------------
-    /**
-     * Obtains an <code>OrderedMapIterator</code> over the map.
-     * <p>
-     * A ordered map iterator is an efficient way of iterating over maps
-     * in both directions.
-     * 
-     * @return an ordered map iterator
+     * {@inheritDoc}
      */
-    public OrderedMapIterator orderedMapIterator() {
-        return new SingletonMapIterator(this);
+    public OrderedMapIterator<K, V> mapIterator() {
+        return new SingletonMapIterator<K, V>(this);
     }
 
     /**
@@ -368,7 +344,7 @@ public class SingletonMap
      * 
      * @return the key
      */
-    public Object firstKey() {
+    public K firstKey() {
         return getKey();
     }
 
@@ -377,7 +353,7 @@ public class SingletonMap
      * 
      * @return the key
      */
-    public Object lastKey() {
+    public K lastKey() {
         return getKey();
     }
 
@@ -387,7 +363,7 @@ public class SingletonMap
      * @param key  the next key
      * @return null always
      */
-    public Object nextKey(Object key) {
+    public K nextKey(K key) {
         return null;
     }
 
@@ -397,7 +373,7 @@ public class SingletonMap
      * @param key  the next key
      * @return null always
      */
-    public Object previousKey(Object key) {
+    public K previousKey(K key) {
         return null;
     }
 
@@ -426,12 +402,12 @@ public class SingletonMap
     /**
      * SingletonMapIterator.
      */
-    static class SingletonMapIterator implements OrderedMapIterator, ResettableIterator {
-        private final SingletonMap parent;
+    static class SingletonMapIterator<K, V> implements OrderedMapIterator<K, V>, ResettableIterator<K> {
+        private final SingletonMap<K, V> parent;
         private boolean hasNext = true;
         private boolean canGetSet = false;
         
-        SingletonMapIterator(SingletonMap parent) {
+        SingletonMapIterator(SingletonMap<K, V> parent) {
             super();
             this.parent = parent;
         }
@@ -440,7 +416,7 @@ public class SingletonMap
             return hasNext;
         }
 
-        public Object next() {
+        public K next() {
             if (hasNext == false) {
                 throw new NoSuchElementException(AbstractHashedMap.NO_NEXT_ENTRY);
             }
@@ -453,7 +429,7 @@ public class SingletonMap
             return (hasNext == false);
         }
 
-        public Object previous() {
+        public K previous() {
             if (hasNext == true) {
                 throw new NoSuchElementException(AbstractHashedMap.NO_PREVIOUS_ENTRY);
             }
@@ -465,21 +441,21 @@ public class SingletonMap
             throw new UnsupportedOperationException();
         }
 
-        public Object getKey() {
+        public K getKey() {
             if (canGetSet == false) {
                 throw new IllegalStateException(AbstractHashedMap.GETKEY_INVALID);
             }
             return parent.getKey();
         }
 
-        public Object getValue() {
+        public V getValue() {
             if (canGetSet == false) {
                 throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID);
             }
             return parent.getValue();
         }
 
-        public Object setValue(Object value) {
+        public V setValue(V value) {
             if (canGetSet == false) {
                 throw new IllegalStateException(AbstractHashedMap.SETVALUE_INVALID);
             }
@@ -493,9 +469,8 @@ public class SingletonMap
         public String toString() {
             if (hasNext) {
                 return "Iterator[]";
-            } else {
-                return "Iterator[" + getKey() + "=" + getValue() + "]";
             }
+            return "Iterator[" + getKey() + "=" + getValue() + "]";
         }
     }
     
@@ -503,11 +478,11 @@ public class SingletonMap
      * Values implementation for the SingletonMap.
      * This class is needed as values is a view that must update as the map updates.
      */
-    static class SingletonValues extends AbstractSet implements Serializable {
+    static class SingletonValues<V> extends AbstractSet<V> implements Serializable {
         private static final long serialVersionUID = -3689524741863047872L;
-        private final SingletonMap parent;
+        private final SingletonMap<?, V> parent;
 
-        SingletonValues(SingletonMap parent) {
+        SingletonValues(SingletonMap<?, V> parent) {
             super();
             this.parent = parent;
         }
@@ -524,8 +499,8 @@ public class SingletonMap
         public void clear() {
             throw new UnsupportedOperationException();
         }
-        public Iterator iterator() {
-            return new SingletonIterator(parent.getValue(), false);
+        public Iterator<V> iterator() {
+            return new SingletonIterator<V>(parent.getValue(), false);
         }
     }
     
@@ -535,10 +510,10 @@ public class SingletonMap
      *
      * @return a shallow clone
      */
-    public Object clone() {
+    @SuppressWarnings("unchecked")
+    public SingletonMap<K, V> clone() {
         try {
-            SingletonMap cloned = (SingletonMap) super.clone();
-            return cloned;
+            return (SingletonMap<K, V>) super.clone();
         } catch (CloneNotSupportedException ex) {
             throw new InternalError();
         }
@@ -550,6 +525,7 @@ public class SingletonMap
      * @param obj  the object to compare to
      * @return true if equal
      */
+    @SuppressWarnings("unchecked")
     public boolean equals(Object obj) {
         if (obj == this) {
             return true;

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/StaticBucketMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/StaticBucketMap.java b/src/java/org/apache/commons/collections/map/StaticBucketMap.java
index 461ff10..7486d70 100644
--- a/src/java/org/apache/commons/collections/map/StaticBucketMap.java
+++ b/src/java/org/apache/commons/collections/map/StaticBucketMap.java
@@ -101,12 +101,12 @@ import org.apache.commons.collections.KeyValue;
  * @author Janek Bogucki
  * @author Kazuya Ujihara
  */
-public final class StaticBucketMap implements Map {
+public final class StaticBucketMap<K, V> implements Map<K, V> {
 
     /** The default number of buckets to use */
     private static final int DEFAULT_BUCKETS = 255;
     /** The array of buckets, where the actual data is held */
-    private Node[] buckets;
+    private Node<K, V>[] buckets;
     /** The matching array of locks */
     private Lock[] locks;
 
@@ -127,6 +127,7 @@ public final class StaticBucketMap implements Map {
      *
      * @param numBuckets  the number of buckets for this map
      */
+    @SuppressWarnings("unchecked")
     public StaticBucketMap(int numBuckets) {
         int size = Math.max(17, numBuckets);
 
@@ -202,11 +203,11 @@ public final class StaticBucketMap implements Map {
      * @param key  the key to retrieve
      * @return the associated value
      */
-    public Object get(final Object key) {
+    public V get(final Object key) {
         int hash = getHash(key);
 
         synchronized (locks[hash]) {
-            Node n = buckets[hash];
+            Node<K, V> n = buckets[hash];
 
             while (n != null) {
                 if (n.key == key || (n.key != null && n.key.equals(key))) {
@@ -229,7 +230,7 @@ public final class StaticBucketMap implements Map {
         int hash = getHash(key);
 
         synchronized (locks[hash]) {
-            Node n = buckets[hash];
+            Node<K, V> n = buckets[hash];
 
             while (n != null) {
                 if (n.key == key || (n.key != null && n.key.equals(key))) {
@@ -251,7 +252,7 @@ public final class StaticBucketMap implements Map {
     public boolean containsValue(final Object value) {
         for (int i = 0; i < buckets.length; i++) {
             synchronized (locks[i]) {
-                Node n = buckets[i];
+                Node<K, V> n = buckets[i];
 
                 while (n != null) {
                     if (n.value == value || (n.value != null && n.value.equals(value))) {
@@ -273,14 +274,14 @@ public final class StaticBucketMap implements Map {
      * @param value  the value to use
      * @return the previous mapping for the key
      */
-    public Object put(final Object key, final Object value) {
+    public V put(final K key, final V value) {
         int hash = getHash(key);
 
         synchronized (locks[hash]) {
-            Node n = buckets[hash];
+            Node<K, V> n = buckets[hash];
 
             if (n == null) {
-                n = new Node();
+                n = new Node<K, V>();
                 n.key = key;
                 n.value = value;
                 buckets[hash] = n;
@@ -291,11 +292,11 @@ public final class StaticBucketMap implements Map {
             // Set n to the last node in the linked list.  Check each key along the way
             //  If the key is found, then change the value of that node and return
             //  the old value.
-            for (Node next = n; next != null; next = next.next) {
+            for (Node<K, V> next = n; next != null; next = next.next) {
                 n = next;
 
                 if (n.key == key || (n.key != null && n.key.equals(key))) {
-                    Object returnVal = n.value;
+                    V returnVal = n.value;
                     n.value = value;
                     return returnVal;
                 }
@@ -303,7 +304,7 @@ public final class StaticBucketMap implements Map {
 
             // The key was not found in the current list of nodes, add it to the end
             //  in a new node.
-            Node newNode = new Node();
+            Node<K, V> newNode = new Node<K, V>();
             newNode.key = key;
             newNode.value = value;
             n.next = newNode;
@@ -318,12 +319,12 @@ public final class StaticBucketMap implements Map {
      * @param key  the key to remove
      * @return the previous value at this key
      */
-    public Object remove(Object key) {
+    public V remove(Object key) {
         int hash = getHash(key);
 
         synchronized (locks[hash]) {
-            Node n = buckets[hash];
-            Node prev = null;
+            Node<K, V> n = buckets[hash];
+            Node<K, V> prev = null;
 
             while (n != null) {
                 if (n.key == key || (n.key != null && n.key.equals(key))) {
@@ -345,14 +346,14 @@ public final class StaticBucketMap implements Map {
         }
         return null;
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Gets the key set.
      * 
      * @return the key set
      */
-    public Set keySet() {
+    public Set<K> keySet() {
         return new KeySet();
     }
 
@@ -361,7 +362,7 @@ public final class StaticBucketMap implements Map {
      * 
      * @return the values
      */
-    public Collection values() {
+    public Collection<V> values() {
         return new Values();
     }
 
@@ -370,7 +371,7 @@ public final class StaticBucketMap implements Map {
      * 
      * @return the entry set
      */
-    public Set entrySet() {
+    public Set<Map.Entry<K, V>> entrySet() {
         return new EntrySet();
     }
 
@@ -381,11 +382,11 @@ public final class StaticBucketMap implements Map {
      * 
      * @param map  the map of entries to add
      */
-    public void putAll(Map map) {
-        Iterator i = map.keySet().iterator();
+    public void putAll(Map<? extends K, ? extends V> map) {
+        Iterator<? extends K> i = map.keySet().iterator();
 
         while (i.hasNext()) {
-            Object key = i.next();
+            K key = i.next();
             put(key, map.get(key));
         }
     }
@@ -416,7 +417,7 @@ public final class StaticBucketMap implements Map {
         if (obj instanceof Map == false) {
             return false;
         }
-        Map other = (Map) obj;
+        Map<?, ?> other = (Map<?, ?>) obj;
         return entrySet().equals(other.entrySet());
     }
 
@@ -430,7 +431,7 @@ public final class StaticBucketMap implements Map {
 
         for (int i = 0; i < buckets.length; i++) {
             synchronized (locks[i]) {
-                Node n = buckets[i];
+                Node<K, V> n = buckets[i];
 
                 while (n != null) {
                     hashCode += n.hashCode();
@@ -445,16 +446,16 @@ public final class StaticBucketMap implements Map {
     /**
      * The Map.Entry for the StaticBucketMap.
      */
-    private static final class Node implements Map.Entry, KeyValue {
-        protected Object key;
-        protected Object value;
-        protected Node next;
+    private static final class Node<K, V> implements Map.Entry<K, V>, KeyValue<K, V> {
+        protected K key;
+        protected V value;
+        protected Node<K, V> next;
 
-        public Object getKey() {
+        public K getKey() {
             return key;
         }
 
-        public Object getValue() {
+        public V getValue() {
             return value;
         }
 
@@ -471,20 +472,19 @@ public final class StaticBucketMap implements Map {
                 return false;
             }
 
-            Map.Entry e2 = (Map.Entry) obj;
+            Map.Entry<?, ?> e2 = (Map.Entry<?, ?>) obj;
             return (
                 (key == null ? e2.getKey() == null : key.equals(e2.getKey())) &&
                 (value == null ? e2.getValue() == null : value.equals(e2.getValue())));
         }
 
-        public Object setValue(Object obj) {
-            Object retVal = value;
+        public V setValue(V obj) {
+            V retVal = value;
             value = obj;
             return retVal;
         }
     }
 
-
     /**
      * The lock object, which also includes a count of the nodes in this lock.
      */
@@ -492,20 +492,17 @@ public final class StaticBucketMap implements Map {
         public int size;
     }
 
-
     //-----------------------------------------------------------------------
-    private class EntryIterator implements Iterator {
-
-        private ArrayList current = new ArrayList();
+    private class BaseIterator {
+        private ArrayList<Map.Entry<K, V>> current = new ArrayList<Map.Entry<K,V>>();
         private int bucket;
-        private Map.Entry last;
-
+        private Map.Entry<K, V> last;
 
         public boolean hasNext() {
             if (current.size() > 0) return true;
             while (bucket < buckets.length) {
                 synchronized (locks[bucket]) {
-                    Node n = buckets[bucket];
+                    Node<K, V> n = buckets[bucket];
                     while (n != null) {
                         current.add(n);
                         n = n.next;
@@ -517,41 +514,44 @@ public final class StaticBucketMap implements Map {
             return false;
         }
 
-        protected Map.Entry nextEntry() {
+        protected Map.Entry<K, V> nextEntry() {
             if (!hasNext()) throw new NoSuchElementException();
-            last = (Map.Entry)current.remove(current.size() - 1);
+            last = current.remove(current.size() - 1);
             return last;
         }
 
-        public Object next() {
-            return nextEntry();
-        }
-
         public void remove() {
             if (last == null) throw new IllegalStateException();
             StaticBucketMap.this.remove(last.getKey());
             last = null;
         }
+    }
+
+    private class EntryIterator extends BaseIterator implements Iterator<Map.Entry<K, V>> {
+
+        public Map.Entry<K, V> next() {
+            return nextEntry();
+        }
 
     }
 
-    private class ValueIterator extends EntryIterator {
+    private class ValueIterator extends BaseIterator implements Iterator<V> {
 
-        public Object next() {
+        public V next() {
             return nextEntry().getValue();
         }
 
     }
 
-    private class KeyIterator extends EntryIterator {
+    private class KeyIterator extends BaseIterator implements Iterator<K> {
 
-        public Object next() {
+        public K next() {
             return nextEntry().getKey();
         }
 
     }
 
-    private class EntrySet extends AbstractSet {
+    private class EntrySet extends AbstractSet<Map.Entry<K, V>> {
 
         public int size() {
             return StaticBucketMap.this.size();
@@ -561,15 +561,15 @@ public final class StaticBucketMap implements Map {
             StaticBucketMap.this.clear();
         }
 
-        public Iterator iterator() {
+        public Iterator<Map.Entry<K, V>> iterator() {
             return new EntryIterator();
         }
 
         public boolean contains(Object obj) {
-            Map.Entry entry = (Map.Entry) obj;
+            Map.Entry<?, ?> entry = (Map.Entry<?, ?>) obj;
             int hash = getHash(entry.getKey());
             synchronized (locks[hash]) {
-                for (Node n = buckets[hash]; n != null; n = n.next) {
+                for (Node<K, V> n = buckets[hash]; n != null; n = n.next) {
                     if (n.equals(entry)) return true;
                 }
             }
@@ -580,10 +580,10 @@ public final class StaticBucketMap implements Map {
             if (obj instanceof Map.Entry == false) {
                 return false;
             }
-            Map.Entry entry = (Map.Entry) obj;
+            Map.Entry<?, ?> entry = (Map.Entry<?, ?>) obj;
             int hash = getHash(entry.getKey());
             synchronized (locks[hash]) {
-                for (Node n = buckets[hash]; n != null; n = n.next) {
+                for (Node<K, V> n = buckets[hash]; n != null; n = n.next) {
                     if (n.equals(entry)) {
                         StaticBucketMap.this.remove(n.getKey());
                         return true;
@@ -595,8 +595,7 @@ public final class StaticBucketMap implements Map {
 
     }
 
-
-    private class KeySet extends AbstractSet {
+    private class KeySet extends AbstractSet<K> {
 
         public int size() {
             return StaticBucketMap.this.size();
@@ -606,7 +605,7 @@ public final class StaticBucketMap implements Map {
             StaticBucketMap.this.clear();
         }
 
-        public Iterator iterator() {
+        public Iterator<K> iterator() {
             return new KeyIterator();
         }
 
@@ -617,7 +616,7 @@ public final class StaticBucketMap implements Map {
         public boolean remove(Object obj) {
             int hash = getHash(obj);
             synchronized (locks[hash]) {
-                for (Node n = buckets[hash]; n != null; n = n.next) {
+                for (Node<K, V> n = buckets[hash]; n != null; n = n.next) {
                     Object k = n.getKey();
                     if ((k == obj) || ((k != null) && k.equals(obj))) {
                         StaticBucketMap.this.remove(k);
@@ -626,13 +625,12 @@ public final class StaticBucketMap implements Map {
                 }
             }
             return false;
-
         }
 
     }
 
 
-    private class Values extends AbstractCollection {
+    private class Values extends AbstractCollection<V> {
 
         public int size() {
             return StaticBucketMap.this.size();
@@ -642,13 +640,12 @@ public final class StaticBucketMap implements Map {
             StaticBucketMap.this.clear();
         }
 
-        public Iterator iterator() {
+        public Iterator<V> iterator() {
             return new ValueIterator();
         }
 
     }
 
-
     /**
      *  Prevents any operations from occurring on this map while the
      *  given {@link Runnable} executes.  This method can be used, for

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/TransformedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/TransformedMap.java b/src/java/org/apache/commons/collections/map/TransformedMap.java
index 499facf..4df0f2e 100644
--- a/src/java/org/apache/commons/collections/map/TransformedMap.java
+++ b/src/java/org/apache/commons/collections/map/TransformedMap.java
@@ -20,7 +20,6 @@ import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.commons.collections.Transformer;
@@ -46,17 +45,17 @@ import org.apache.commons.collections.Transformer;
  * 
  * @author Stephen Colebourne
  */
-public class TransformedMap
-        extends AbstractInputCheckedMapDecorator
+public class TransformedMap<K, V>
+        extends AbstractInputCheckedMapDecorator<K, V>
         implements Serializable {
 
     /** Serialization version */
     private static final long serialVersionUID = 7023152376788900464L;
 
     /** The transformer to use for the key */
-    protected final Transformer keyTransformer;
+    protected final Transformer<? super K, ? extends K> keyTransformer;
     /** The transformer to use for the value */
-    protected final Transformer valueTransformer;
+    protected final Transformer<? super V, ? extends V> valueTransformer;
 
     /**
      * Factory method to create a transforming map.
@@ -70,8 +69,10 @@ public class TransformedMap
      * @param valueTransformer  the transformer to use for value conversion, null means no transformation
      * @throws IllegalArgumentException if map is null
      */
-    public static Map decorate(Map map, Transformer keyTransformer, Transformer valueTransformer) {
-        return new TransformedMap(map, keyTransformer, valueTransformer);
+    public static <K, V> Map<K, V> decorate(Map<K, V> map,
+            Transformer<? super K, ? extends K> keyTransformer,
+            Transformer<? super V, ? extends V> valueTransformer) {
+        return new TransformedMap<K, V>(map, keyTransformer, valueTransformer);
     }
 
     /**
@@ -88,10 +89,12 @@ public class TransformedMap
      * @throws IllegalArgumentException if map is null
      * @since Commons Collections 3.2
      */
-    public static Map decorateTransform(Map map, Transformer keyTransformer, Transformer valueTransformer) {
-        TransformedMap decorated = new TransformedMap(map, keyTransformer, valueTransformer);
+    public static <K, V> Map<K, V> decorateTransform(Map<K, V> map,
+            Transformer<? super K, ? extends K> keyTransformer,
+            Transformer<? super V, ? extends V> valueTransformer) {
+        TransformedMap<K, V> decorated = new TransformedMap<K, V>(map, keyTransformer, valueTransformer);
         if (map.size() > 0) {
-            Map transformed = decorated.transformMap(map);
+            Map<K, V> transformed = decorated.transformMap(map);
             decorated.clear();
             decorated.decorated().putAll(transformed);  // avoids double transformation
         }
@@ -110,7 +113,8 @@ public class TransformedMap
      * @param valueTransformer  the transformer to use for value conversion, null means no conversion
      * @throws IllegalArgumentException if map is null
      */
-    protected TransformedMap(Map map, Transformer keyTransformer, Transformer valueTransformer) {
+    protected TransformedMap(Map<K, V> map, Transformer<? super K, ? extends K> keyTransformer,
+            Transformer<? super V, ? extends V> valueTransformer) {
         super(map);
         this.keyTransformer = keyTransformer;
         this.valueTransformer = valueTransformer;
@@ -137,6 +141,7 @@ public class TransformedMap
      * @throws ClassNotFoundException
      * @since Commons Collections 3.1
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
         map = (Map) in.readObject();
@@ -151,7 +156,7 @@ public class TransformedMap
      * @param object  the object to transform
      * @throws the transformed object
      */
-    protected Object transformKey(Object object) {
+    protected K transformKey(K object) {
         if (keyTransformer == null) {
             return object;
         }
@@ -166,7 +171,7 @@ public class TransformedMap
      * @param object  the object to transform
      * @throws the transformed object
      */
-    protected Object transformValue(Object object) {
+    protected V transformValue(V object) {
         if (valueTransformer == null) {
             return object;
         }
@@ -181,14 +186,15 @@ public class TransformedMap
      * @param map  the map to transform
      * @throws the transformed object
      */
-    protected Map transformMap(Map map) {
+    @SuppressWarnings("unchecked")
+    protected Map<K, V> transformMap(Map<? extends K, ? extends V> map) {
         if (map.isEmpty()) {
-            return map;
+            return (Map<K, V>) map;
         }
-        Map result = new LinkedMap(map.size());
-        for (Iterator it = map.entrySet().iterator(); it.hasNext(); ) {
-            Map.Entry entry = (Map.Entry) it.next();
-            result.put(transformKey(entry.getKey()), transformValue(entry.getValue()));
+        Map<K, V> result = new LinkedMap<K, V>(map.size());
+
+        for (Map.Entry<? extends K, ? extends V> entry : map.entrySet()) {
+            result.put((K) transformKey(entry.getKey()), transformValue(entry.getValue()));
         }
         return result;
     }
@@ -200,7 +206,7 @@ public class TransformedMap
      * @return the transformed value
      * @since Commons Collections 3.1
      */
-    protected Object checkSetValue(Object value) {
+    protected V checkSetValue(V value) {
         return valueTransformer.transform(value);
     }
 
@@ -215,13 +221,13 @@ public class TransformedMap
     }
 
     //-----------------------------------------------------------------------
-    public Object put(Object key, Object value) {
+    public V put(K key, V value) {
         key = transformKey(key);
         value = transformValue(value);
         return decorated().put(key, value);
     }
 
-    public void putAll(Map mapToCopy) {
+    public void putAll(Map<? extends K, ? extends V> mapToCopy) {
         mapToCopy = transformMap(mapToCopy);
         decorated().putAll(mapToCopy);
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/TransformedSortedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/TransformedSortedMap.java b/src/java/org/apache/commons/collections/map/TransformedSortedMap.java
index abf782b..5957736 100644
--- a/src/java/org/apache/commons/collections/map/TransformedSortedMap.java
+++ b/src/java/org/apache/commons/collections/map/TransformedSortedMap.java
@@ -43,9 +43,9 @@ import org.apache.commons.collections.Transformer;
  * 
  * @author Stephen Colebourne
  */
-public class TransformedSortedMap
-        extends TransformedMap
-        implements SortedMap {
+public class TransformedSortedMap<K, V>
+        extends TransformedMap<K, V>
+        implements SortedMap<K, V> {
 
     /** Serialization version */
     private static final long serialVersionUID = -8751771676410385778L;
@@ -62,8 +62,10 @@ public class TransformedSortedMap
      * @param valueTransformer  the predicate to validate to values, null means no transformation
      * @throws IllegalArgumentException if the map is null
      */
-    public static SortedMap decorate(SortedMap map, Transformer keyTransformer, Transformer valueTransformer) {
-        return new TransformedSortedMap(map, keyTransformer, valueTransformer);
+    public static <K, V> SortedMap<K, V> decorate(SortedMap<K, V> map,
+            Transformer<? super K, ? extends K> keyTransformer,
+            Transformer<? super V, ? extends V> valueTransformer) {
+        return new TransformedSortedMap<K, V>(map, keyTransformer, valueTransformer);
     }
 
     /**
@@ -80,10 +82,12 @@ public class TransformedSortedMap
      * @throws IllegalArgumentException if map is null
      * @since Commons Collections 3.2
      */
-    public static SortedMap decorateTransform(SortedMap map, Transformer keyTransformer, Transformer valueTransformer) {
-        TransformedSortedMap decorated = new TransformedSortedMap(map, keyTransformer, valueTransformer);
+    public static <K, V> SortedMap<K, V> decorateTransform(SortedMap<K, V> map,
+            Transformer<? super K, ? extends K> keyTransformer,
+            Transformer<? super V, ? extends V> valueTransformer) {
+        TransformedSortedMap<K, V> decorated = new TransformedSortedMap<K, V>(map, keyTransformer, valueTransformer);
         if (map.size() > 0) {
-            Map transformed = decorated.transformMap(map);
+            Map<K, V> transformed = decorated.transformMap(map);
             decorated.clear();
             decorated.decorated().putAll(transformed);  // avoids double transformation
         }
@@ -102,7 +106,9 @@ public class TransformedSortedMap
      * @param valueTransformer  the predicate to validate to values, null means no transformation
      * @throws IllegalArgumentException if the map is null
      */
-    protected TransformedSortedMap(SortedMap map, Transformer keyTransformer, Transformer valueTransformer) {
+    protected TransformedSortedMap(SortedMap<K, V> map,
+            Transformer<? super K, ? extends K> keyTransformer,
+            Transformer<? super V, ? extends V> valueTransformer) {
         super(map, keyTransformer, valueTransformer);
     }
 
@@ -112,36 +118,36 @@ public class TransformedSortedMap
      * 
      * @return the decorated map
      */
-    protected SortedMap getSortedMap() {
-        return (SortedMap) map;
+    protected SortedMap<K, V> getSortedMap() {
+        return (SortedMap<K, V>) map;
     }
 
     //-----------------------------------------------------------------------
-    public Object firstKey() {
+    public K firstKey() {
         return getSortedMap().firstKey();
     }
 
-    public Object lastKey() {
+    public K lastKey() {
         return getSortedMap().lastKey();
     }
 
-    public Comparator comparator() {
+    public Comparator<? super K> comparator() {
         return getSortedMap().comparator();
     }
 
-    public SortedMap subMap(Object fromKey, Object toKey) {
-        SortedMap map = getSortedMap().subMap(fromKey, toKey);
-        return new TransformedSortedMap(map, keyTransformer, valueTransformer);
+    public SortedMap<K, V> subMap(K fromKey, K toKey) {
+        SortedMap<K, V> map = getSortedMap().subMap(fromKey, toKey);
+        return new TransformedSortedMap<K, V>(map, keyTransformer, valueTransformer);
     }
 
-    public SortedMap headMap(Object toKey) {
-        SortedMap map = getSortedMap().headMap(toKey);
-        return new TransformedSortedMap(map, keyTransformer, valueTransformer);
+    public SortedMap<K, V> headMap(K toKey) {
+        SortedMap<K, V> map = getSortedMap().headMap(toKey);
+        return new TransformedSortedMap<K, V>(map, keyTransformer, valueTransformer);
     }
 
-    public SortedMap tailMap(Object fromKey) {
-        SortedMap map = getSortedMap().tailMap(fromKey);
-        return new TransformedSortedMap(map, keyTransformer, valueTransformer);
+    public SortedMap<K, V> tailMap(K fromKey) {
+        SortedMap<K, V> map = getSortedMap().tailMap(fromKey);
+        return new TransformedSortedMap<K, V>(map, keyTransformer, valueTransformer);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/UnmodifiableEntrySet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/UnmodifiableEntrySet.java b/src/java/org/apache/commons/collections/map/UnmodifiableEntrySet.java
index 081e715..afb088e 100644
--- a/src/java/org/apache/commons/collections/map/UnmodifiableEntrySet.java
+++ b/src/java/org/apache/commons/collections/map/UnmodifiableEntrySet.java
@@ -35,8 +35,11 @@ import org.apache.commons.collections.set.AbstractSetDecorator;
  * 
  * @author Stephen Colebourne
  */
-public final class UnmodifiableEntrySet
-        extends AbstractSetDecorator implements Unmodifiable {
+public final class UnmodifiableEntrySet<K, V>
+        extends AbstractSetDecorator<Map.Entry<K, V>> implements Unmodifiable {
+
+    /** Serialization version */
+    private static final long serialVersionUID = 1678353579659253473L;
 
     /**
      * Factory method to create an unmodifiable set of Map Entry objects.
@@ -44,11 +47,11 @@ public final class UnmodifiableEntrySet
      * @param set  the set to decorate, must not be null
      * @throws IllegalArgumentException if set is null
      */
-    public static Set decorate(Set set) {
+    public static <K, V> Set<Map.Entry<K, V>> decorate(Set<Map.Entry<K, V>> set) {
         if (set instanceof Unmodifiable) {
             return set;
         }
-        return new UnmodifiableEntrySet(set);
+        return new UnmodifiableEntrySet<K, V>(set);
     }
 
     //-----------------------------------------------------------------------
@@ -58,16 +61,16 @@ public final class UnmodifiableEntrySet
      * @param set  the set to decorate, must not be null
      * @throws IllegalArgumentException if set is null
      */
-    private UnmodifiableEntrySet(Set set) {
+    private UnmodifiableEntrySet(Set<Map.Entry<K, V>> set) {
         super(set);
     }
 
     //-----------------------------------------------------------------------
-    public boolean add(Object object) {
+    public boolean add(Map.Entry<K, V> object) {
         throw new UnsupportedOperationException();
     }
 
-    public boolean addAll(Collection coll) {
+    public boolean addAll(Collection<? extends Map.Entry<K, V>> coll) {
         throw new UnsupportedOperationException();
     }
 
@@ -79,28 +82,30 @@ public final class UnmodifiableEntrySet
         throw new UnsupportedOperationException();
     }
 
-    public boolean removeAll(Collection coll) {
+    public boolean removeAll(Collection<?> coll) {
         throw new UnsupportedOperationException();
     }
 
-    public boolean retainAll(Collection coll) {
+    public boolean retainAll(Collection<?> coll) {
         throw new UnsupportedOperationException();
     }
 
     //-----------------------------------------------------------------------
-    public Iterator iterator() {
+    public Iterator<Map.Entry<K, V>> iterator() {
         return new UnmodifiableEntrySetIterator(collection.iterator());
     }
     
+    @SuppressWarnings("unchecked")
     public Object[] toArray() {
         Object[] array = collection.toArray();
         for (int i = 0; i < array.length; i++) {
-            array[i] = new UnmodifiableEntry((Map.Entry) array[i]);
+            array[i] = new UnmodifiableEntry((Map.Entry<K, V>) array[i]);
         }
         return array;
     }
     
-    public Object[] toArray(Object array[]) {
+    @SuppressWarnings("unchecked")
+    public <T> T[] toArray(T[] array) {
         Object[] result = array;
         if (array.length > 0) {
             // we must create a new array to handle multi-threaded situations
@@ -109,15 +114,15 @@ public final class UnmodifiableEntrySet
         }
         result = collection.toArray(result);
         for (int i = 0; i < result.length; i++) {
-            result[i] = new UnmodifiableEntry((Map.Entry) result[i]);
+            result[i] = new UnmodifiableEntry((Map.Entry<K, V>) result[i]);
         }
 
         // check to see if result should be returned straight
         if (result.length > array.length) {
-            return result;
+            return (T[]) result;
         }
 
-        // copy back into input array to fulfil the method contract
+        // copy back into input array to fulfill the method contract
         System.arraycopy(result, 0, array, 0, result.length);
         if (array.length > result.length) {
             array[result.length] = null;
@@ -129,17 +134,16 @@ public final class UnmodifiableEntrySet
     /**
      * Implementation of an entry set iterator.
      */
-    final static class UnmodifiableEntrySetIterator extends AbstractIteratorDecorator {
-        
-        protected UnmodifiableEntrySetIterator(Iterator iterator) {
+    private class UnmodifiableEntrySetIterator extends AbstractIteratorDecorator<Map.Entry<K, V>> {
+
+        protected UnmodifiableEntrySetIterator(Iterator<Map.Entry<K, V>> iterator) {
             super(iterator);
         }
-        
-        public Object next() {
-            Map.Entry entry = (Map.Entry) iterator.next();
-            return new UnmodifiableEntry(entry);
+
+        public Map.Entry<K, V> next() {
+            return new UnmodifiableEntry(iterator.next());
         }
-        
+
         public void remove() {
             throw new UnsupportedOperationException();
         }
@@ -149,13 +153,13 @@ public final class UnmodifiableEntrySet
     /**
      * Implementation of a map entry that is unmodifiable.
      */
-    final static class UnmodifiableEntry extends AbstractMapEntryDecorator {
+    private class UnmodifiableEntry extends AbstractMapEntryDecorator<K, V> {
 
-        protected UnmodifiableEntry(Map.Entry entry) {
+        protected UnmodifiableEntry(Map.Entry<K, V> entry) {
             super(entry);
         }
 
-        public Object setValue(Object obj) {
+        public V setValue(V obj) {
             throw new UnsupportedOperationException();
         }
     }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/UnmodifiableMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/UnmodifiableMap.java b/src/java/org/apache/commons/collections/map/UnmodifiableMap.java
index cbf085f..0239db1 100644
--- a/src/java/org/apache/commons/collections/map/UnmodifiableMap.java
+++ b/src/java/org/apache/commons/collections/map/UnmodifiableMap.java
@@ -42,9 +42,9 @@ import org.apache.commons.collections.set.UnmodifiableSet;
  * 
  * @author Stephen Colebourne
  */
-public final class UnmodifiableMap
-        extends AbstractMapDecorator
-        implements IterableMap, Unmodifiable, Serializable {
+public final class UnmodifiableMap<K, V>
+        extends AbstractMapDecorator<K, V>
+        implements IterableMap<K, V>, Unmodifiable, Serializable {
 
     /** Serialization version */
     private static final long serialVersionUID = 2737023427269031941L;
@@ -55,11 +55,11 @@ public final class UnmodifiableMap
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if map is null
      */
-    public static Map decorate(Map map) {
+    public static <K, V> Map<K, V> decorate(Map<K, V> map) {
         if (map instanceof Unmodifiable) {
             return map;
         }
-        return new UnmodifiableMap(map);
+        return new UnmodifiableMap<K, V>(map);
     }
 
     //-----------------------------------------------------------------------
@@ -69,7 +69,7 @@ public final class UnmodifiableMap
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if map is null
      */
-    private UnmodifiableMap(Map map) {
+    private UnmodifiableMap(Map<K, V> map) {
         super(map);
     }
 
@@ -94,9 +94,10 @@ public final class UnmodifiableMap
      * @throws ClassNotFoundException
      * @since Commons Collections 3.1
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
-        map = (Map) in.readObject();
+        map = (Map<K, V>) in.readObject();
     }
 
     //-----------------------------------------------------------------------
@@ -104,40 +105,39 @@ public final class UnmodifiableMap
         throw new UnsupportedOperationException();
     }
 
-    public Object put(Object key, Object value) {
+    public V put(K key, V value) {
         throw new UnsupportedOperationException();
     }
 
-    public void putAll(Map mapToCopy) {
+    public void putAll(Map<? extends K, ? extends V> mapToCopy) {
         throw new UnsupportedOperationException();
     }
 
-    public Object remove(Object key) {
+    public V remove(Object key) {
         throw new UnsupportedOperationException();
     }
 
-    public MapIterator mapIterator() {
+    public MapIterator<K, V> mapIterator() {
         if (map instanceof IterableMap) {
-            MapIterator it = ((IterableMap) map).mapIterator();
-            return UnmodifiableMapIterator.decorate(it);
-        } else {
-            MapIterator it = new EntrySetMapIterator(map);
+            MapIterator<K, V> it = ((IterableMap<K, V>) map).mapIterator();
             return UnmodifiableMapIterator.decorate(it);
         }
+        MapIterator<K, V> it = new EntrySetMapIterator<K, V>(map);
+        return UnmodifiableMapIterator.decorate(it);
     }
 
-    public Set entrySet() {
-        Set set = super.entrySet();
+    public Set<Map.Entry<K, V>> entrySet() {
+        Set<Map.Entry<K, V>> set = super.entrySet();
         return UnmodifiableEntrySet.decorate(set);
     }
 
-    public Set keySet() {
-        Set set = super.keySet();
+    public Set<K> keySet() {
+        Set<K> set = super.keySet();
         return UnmodifiableSet.decorate(set);
     }
 
-    public Collection values() {
-        Collection coll = super.values();
+    public Collection<V> values() {
+        Collection<V> coll = super.values();
         return UnmodifiableCollection.decorate(coll);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java b/src/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java
index d7a949a..2e42934 100644
--- a/src/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java
+++ b/src/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java
@@ -24,12 +24,10 @@ import java.util.Collection;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.commons.collections.MapIterator;
 import org.apache.commons.collections.OrderedMap;
 import org.apache.commons.collections.OrderedMapIterator;
 import org.apache.commons.collections.Unmodifiable;
 import org.apache.commons.collections.collection.UnmodifiableCollection;
-import org.apache.commons.collections.iterators.UnmodifiableMapIterator;
 import org.apache.commons.collections.iterators.UnmodifiableOrderedMapIterator;
 import org.apache.commons.collections.set.UnmodifiableSet;
 
@@ -43,9 +41,8 @@ import org.apache.commons.collections.set.UnmodifiableSet;
  * 
  * @author Stephen Colebourne
  */
-public final class UnmodifiableOrderedMap
-        extends AbstractOrderedMapDecorator
-        implements Unmodifiable, Serializable {
+public final class UnmodifiableOrderedMap<K, V> extends AbstractOrderedMapDecorator<K, V> implements
+        Unmodifiable, Serializable {
 
     /** Serialization version */
     private static final long serialVersionUID = 8136428161720526266L;
@@ -56,11 +53,11 @@ public final class UnmodifiableOrderedMap
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if map is null
      */
-    public static OrderedMap decorate(OrderedMap map) {
+    public static <K, V> OrderedMap<K, V> decorate(OrderedMap<K, V> map) {
         if (map instanceof Unmodifiable) {
             return map;
         }
-        return new UnmodifiableOrderedMap(map);
+        return new UnmodifiableOrderedMap<K, V>(map);
     }
 
     //-----------------------------------------------------------------------
@@ -70,7 +67,7 @@ public final class UnmodifiableOrderedMap
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if map is null
      */
-    private UnmodifiableOrderedMap(OrderedMap map) {
+    private UnmodifiableOrderedMap(OrderedMap<K, V> map) {
         super(map);
     }
 
@@ -95,19 +92,15 @@ public final class UnmodifiableOrderedMap
      * @throws ClassNotFoundException
      * @since Commons Collections 3.1
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
         map = (Map) in.readObject();
     }
 
     //-----------------------------------------------------------------------
-    public MapIterator mapIterator() {
-        MapIterator it = decorated().mapIterator();
-        return UnmodifiableMapIterator.decorate(it);
-    }
-
-    public OrderedMapIterator orderedMapIterator() {
-        OrderedMapIterator it = decorated().orderedMapIterator();
+    public OrderedMapIterator<K, V> mapIterator() {
+        OrderedMapIterator<K, V> it = decorated().mapIterator();
         return UnmodifiableOrderedMapIterator.decorate(it);
     }
 
@@ -115,30 +108,30 @@ public final class UnmodifiableOrderedMap
         throw new UnsupportedOperationException();
     }
 
-    public Object put(Object key, Object value) {
+    public V put(K key, V value) {
         throw new UnsupportedOperationException();
     }
 
-    public void putAll(Map mapToCopy) {
+    public void putAll(Map<? extends K, ? extends V> mapToCopy) {
         throw new UnsupportedOperationException();
     }
 
-    public Object remove(Object key) {
+    public V remove(Object key) {
         throw new UnsupportedOperationException();
     }
 
-    public Set entrySet() {
-        Set set = super.entrySet();
+    public Set<Map.Entry<K, V>> entrySet() {
+        Set<Map.Entry<K, V>> set = super.entrySet();
         return UnmodifiableEntrySet.decorate(set);
     }
 
-    public Set keySet() {
-        Set set = super.keySet();
+    public Set<K> keySet() {
+        Set<K> set = super.keySet();
         return UnmodifiableSet.decorate(set);
     }
 
-    public Collection values() {
-        Collection coll = super.values();
+    public Collection<V> values() {
+        Collection<V> coll = super.values();
         return UnmodifiableCollection.decorate(coll);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/map/UnmodifiableSortedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/UnmodifiableSortedMap.java b/src/java/org/apache/commons/collections/map/UnmodifiableSortedMap.java
index 3984dad..7c78671 100644
--- a/src/java/org/apache/commons/collections/map/UnmodifiableSortedMap.java
+++ b/src/java/org/apache/commons/collections/map/UnmodifiableSortedMap.java
@@ -40,8 +40,8 @@ import org.apache.commons.collections.set.UnmodifiableSet;
  * 
  * @author Stephen Colebourne
  */
-public final class UnmodifiableSortedMap
-        extends AbstractSortedMapDecorator
+public final class UnmodifiableSortedMap<K, V>
+        extends AbstractSortedMapDecorator<K, V>
         implements Unmodifiable, Serializable {
 
     /** Serialization version */
@@ -53,11 +53,11 @@ public final class UnmodifiableSortedMap
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if map is null
      */
-    public static SortedMap decorate(SortedMap map) {
+    public static <K, V> SortedMap<K, V> decorate(SortedMap<K, V> map) {
         if (map instanceof Unmodifiable) {
             return map;
         }
-        return new UnmodifiableSortedMap(map);
+        return new UnmodifiableSortedMap<K, V>(map);
     }
 
     //-----------------------------------------------------------------------
@@ -67,10 +67,10 @@ public final class UnmodifiableSortedMap
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if map is null
      */
-    private UnmodifiableSortedMap(SortedMap map) {
+    private UnmodifiableSortedMap(SortedMap<K, V> map) {
         super(map);
     }
-
+    
     //-----------------------------------------------------------------------
     /**
      * Write the map out using a custom routine.
@@ -92,9 +92,10 @@ public final class UnmodifiableSortedMap
      * @throws ClassNotFoundException
      * @since Commons Collections 3.1
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
-        map = (Map) in.readObject();
+        map = (Map<K, V>) in.readObject();
     }
 
     //-----------------------------------------------------------------------
@@ -102,59 +103,53 @@ public final class UnmodifiableSortedMap
         throw new UnsupportedOperationException();
     }
 
-    public Object put(Object key, Object value) {
+    public V put(K key, V value) {
         throw new UnsupportedOperationException();
     }
 
-    public void putAll(Map mapToCopy) {
+    public void putAll(Map<? extends K, ? extends V> mapToCopy) {
         throw new UnsupportedOperationException();
     }
 
-    public Object remove(Object key) {
+    public V remove(Object key) {
         throw new UnsupportedOperationException();
     }
 
-    public Set entrySet() {
-        Set set = super.entrySet();
-        return UnmodifiableEntrySet.decorate(set);
+    public Set<Map.Entry<K, V>> entrySet() {
+        return UnmodifiableEntrySet.decorate(super.entrySet());
     }
 
-    public Set keySet() {
-        Set set = super.keySet();
-        return UnmodifiableSet.decorate(set);
+    public Set<K> keySet() {
+        return UnmodifiableSet.decorate(super.keySet());
     }
 
-    public Collection values() {
-        Collection coll = super.values();
-        return UnmodifiableCollection.decorate(coll);
+    public Collection<V> values() {
+        return UnmodifiableCollection.decorate(super.values());
     }
 
     //-----------------------------------------------------------------------
-    public Object firstKey() {
+    public K firstKey() {
         return decorated().firstKey();
     }
 
-    public Object lastKey() {
+    public K lastKey() {
         return decorated().lastKey();
     }
 
-    public Comparator comparator() {
+    public Comparator<? super K> comparator() {
         return decorated().comparator();
     }
 
-    public SortedMap subMap(Object fromKey, Object toKey) {
-        SortedMap map = decorated().subMap(fromKey, toKey);
-        return new UnmodifiableSortedMap(map);
+    public SortedMap<K, V> subMap(K fromKey, K toKey) {
+        return new UnmodifiableSortedMap<K, V>(decorated().subMap(fromKey, toKey));
     }
 
-    public SortedMap headMap(Object toKey) {
-        SortedMap map = decorated().headMap(toKey);
-        return new UnmodifiableSortedMap(map);
+    public SortedMap<K, V> headMap(K toKey) {
+        return new UnmodifiableSortedMap<K, V>(decorated().headMap(toKey));
     }
 
-    public SortedMap tailMap(Object fromKey) {
-        SortedMap map = decorated().tailMap(fromKey);
-        return new UnmodifiableSortedMap(map);
+    public SortedMap<K, V> tailMap(K fromKey) {
+        return new UnmodifiableSortedMap<K, V>(decorated().tailMap(fromKey));
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/set/AbstractSerializableSetDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/AbstractSerializableSetDecorator.java b/src/java/org/apache/commons/collections/set/AbstractSerializableSetDecorator.java
index ba08f5c..5a0c932 100644
--- a/src/java/org/apache/commons/collections/set/AbstractSerializableSetDecorator.java
+++ b/src/java/org/apache/commons/collections/set/AbstractSerializableSetDecorator.java
@@ -29,8 +29,8 @@ import java.util.Set;
  * @author Stephen Colebourne
  * @since Commons Collections 3.1
  */
-public abstract class AbstractSerializableSetDecorator
-        extends AbstractSetDecorator
+public abstract class AbstractSerializableSetDecorator<E>
+        extends AbstractSetDecorator<E>
         implements Serializable {
 
     /** Serialization version */
@@ -39,7 +39,7 @@ public abstract class AbstractSerializableSetDecorator
     /**
      * Constructor.
      */
-    protected AbstractSerializableSetDecorator(Set set) {
+    protected AbstractSerializableSetDecorator(Set<E> set) {
         super(set);
     }
 
@@ -62,9 +62,10 @@ public abstract class AbstractSerializableSetDecorator
      * @throws IOException
      * @throws ClassNotFoundException
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
-        collection = (Collection) in.readObject();
+        collection = (Collection<E>) in.readObject();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/set/AbstractSetDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/AbstractSetDecorator.java b/src/java/org/apache/commons/collections/set/AbstractSetDecorator.java
index 920fceb..dffc0c5 100644
--- a/src/java/org/apache/commons/collections/set/AbstractSetDecorator.java
+++ b/src/java/org/apache/commons/collections/set/AbstractSetDecorator.java
@@ -31,9 +31,11 @@ import org.apache.commons.collections.collection.AbstractCollectionDecorator;
  * 
  * @author Stephen Colebourne
  */
-public abstract class AbstractSetDecorator<E>
-        extends AbstractCollectionDecorator<E>
-        implements Set<E> {
+public abstract class AbstractSetDecorator<E> extends AbstractCollectionDecorator<E> implements
+        Set<E> {
+
+    /** Serialization version */
+    private static final long serialVersionUID = -4678668309576958546L;
 
     /**
      * Constructor only used in deserialization, do not use otherwise.

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java b/src/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java
index 6d9dcb2..e26fe9f 100644
--- a/src/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java
+++ b/src/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java
@@ -35,6 +35,9 @@ public abstract class AbstractSortedSetDecorator<E>
         extends AbstractSetDecorator<E>
         implements SortedSet<E> {
 
+    /** Serialization version */
+    private static final long serialVersionUID = -3462240946294214398L;
+
     /**
      * Constructor only used in deserialization, do not use otherwise.
      * @since Commons Collections 3.1

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/set/CompositeSet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/CompositeSet.java b/src/java/org/apache/commons/collections/set/CompositeSet.java
index 90d8f35..1e53d8d 100644
--- a/src/java/org/apache/commons/collections/set/CompositeSet.java
+++ b/src/java/org/apache/commons/collections/set/CompositeSet.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.
@@ -17,7 +17,7 @@
 package org.apache.commons.collections.set;
 
 import java.util.Collection;
-import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
 
 import org.apache.commons.collections.CollectionUtils;
@@ -35,29 +35,30 @@ import org.apache.commons.collections.collection.CompositeCollection;
  *
  * @author Brian McCallister
  */
-public class CompositeSet extends CompositeCollection implements Set {
+public class CompositeSet<E> extends CompositeCollection<E> implements Set<E> {
+
     /**
      * Create an empty CompositeSet
      */
     public CompositeSet() {
         super();
     }
-    
+
     /**
      * Create a CompositeSet with just <code>set</code> composited
      * @param set The initial set in the composite
      */
-    public CompositeSet(Set set) {
+    public CompositeSet(Set<E> set) {
         super(set);
     }
-    
+
     /**
      * Create a composite set with sets as the initial set of composited Sets
      */
-    public CompositeSet(Set[] sets) {
+    public CompositeSet(Set<E>[] sets) {
         super(sets);
     }
-    
+
     /**
      * Add a Set to this composite
      *
@@ -69,14 +70,13 @@ public class CompositeSet extends CompositeCollection implements Set {
      * @see org.apache.commons.collections.collection.CompositeCollection.CollectionMutator
      * @see SetMutator
      */
-    public synchronized void addComposited(Collection c) {
+    public synchronized void addComposited(Collection<E> c) {
         if (!(c instanceof Set)) {
             throw new IllegalArgumentException("Collections added must implement java.util.Set");
         }
-        
-        for (Iterator i = this.getCollections().iterator(); i.hasNext();) {
-            Set set = (Set) i.next();
-            Collection intersects = CollectionUtils.intersection(set, c);
+
+        for (Set<E> set : getCollections()) {
+            Collection<E> intersects = CollectionUtils.intersection(set, c);
             if (intersects.size() > 0) {
                 if (this.mutator == null) {
                     throw new UnsupportedOperationException(
@@ -86,38 +86,48 @@ public class CompositeSet extends CompositeCollection implements Set {
                     throw new UnsupportedOperationException(
                         "Collision adding composited collection to a CompositeSet with a CollectionMutator instead of a SetMutator");
                 }
-                ((SetMutator) this.mutator).resolveCollision(this, set, (Set) c, intersects);
+                getMutator().resolveCollision(this, set, (Set<E>) c, intersects);
                 if (CollectionUtils.intersection(set, c).size() > 0) {
                     throw new IllegalArgumentException(
                         "Attempt to add illegal entry unresolved by SetMutator.resolveCollision()");
                 }
             }
         }
-        super.addComposited(new Collection[]{c});
+        super.addComposited(c);
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    @Override
+    public List<? extends Set<E>> getCollections() {
+        return (List<Set<E>>) super.getCollections();
+    }
+
     /**
      * Add two sets to this composite
      *
      * @throws IllegalArgumentException if c or d does not implement java.util.Set
      */
-    public synchronized void addComposited(Collection c, Collection d) {
+    @SuppressWarnings("unchecked")
+    public synchronized void addComposited(Collection<E> c, Collection<E> d) {
         if (!(c instanceof Set)) throw new IllegalArgumentException("Argument must implement java.util.Set");
         if (!(d instanceof Set)) throw new IllegalArgumentException("Argument must implement java.util.Set");
-        this.addComposited(new Set[]{(Set) c, (Set) d});
+        this.addComposited(new Set[] { (Set<? extends E>) c, (Set<? extends E>) d });
     }
-    
+
     /**
      * Add an array of sets to this composite
      * @param comps
      * @throws IllegalArgumentException if any of the collections in comps do not implement Set
      */
-    public synchronized void addComposited(Collection[] comps) {
+    public synchronized void addComposited(Collection<E>[] comps) {
         for (int i = comps.length - 1; i >= 0; --i) {
             this.addComposited(comps[i]);
         }
     }
-    
+
     /**
      * This can receive either a <code>CompositeCollection.CollectionMutator</code>
      * or a <code>CompositeSet.SetMutator</code>. If a
@@ -125,12 +135,12 @@ public class CompositeSet extends CompositeCollection implements Set {
      * composited sets will throw IllegalArgumentException
      * <p>
      */
-    public void setMutator(CollectionMutator mutator) {
+    public void setMutator(CollectionMutator<E> mutator) {
         super.setMutator(mutator);
     }
-    
+
     /* Set operations */
-    
+
     /**
      * If a <code>CollectionMutator</code> is defined for this CompositeSet then this
      * method will be called anyway.
@@ -139,46 +149,51 @@ public class CompositeSet extends CompositeCollection implements Set {
      * @return true if the object is removed, false otherwise
      */
     public boolean remove(Object obj) {
-        for (Iterator i = this.getCollections().iterator(); i.hasNext();) {
-            Set set = (Set) i.next();
+        for (Set<? extends E> set : getCollections()) {
             if (set.contains(obj)) return set.remove(obj);
         }
         return false;
     }
-    
-    
+
     /**
      * @see Set#equals
      */
+    @SuppressWarnings("unchecked")
     public boolean equals(Object obj) {
         if (obj instanceof Set) {
             Set set = (Set) obj;
-            if (set.containsAll(this) && set.size() == this.size()) {
-                return true;
-            }
+            return set.containsAll(this) && set.size() == this.size();
         }
         return false;
     }
-    
+
     /**
      * @see Set#hashCode
      */
     public int hashCode() {
         int code = 0;
-        for (Iterator i = this.iterator(); i.hasNext();) {
-            Object next = i.next();
-            code += (next != null ? next.hashCode() : 0);
+        for (E e : this) {
+            code += (e == null ? 0 : e.hashCode());
         }
         return code;
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected SetMutator<E> getMutator() {
+        return (SetMutator<E>) super.getMutator();
+    }
+
     /**
      * Define callbacks for mutation operations.
      * <p>
      * Defining remove() on implementations of SetMutator is pointless
      * as they are never called by CompositeSet.
      */
-    public static interface SetMutator extends CompositeCollection.CollectionMutator {
+    public static interface SetMutator<E> extends CompositeCollection.CollectionMutator<E> {
+
         /**
          * <p>
          * Called when a Set is added to the CompositeSet and there is a
@@ -193,6 +208,6 @@ public class CompositeSet extends CompositeCollection implements Set {
          * @param added the Set being added to the composite
          * @param intersects the intersection of th existing and added sets
          */
-        public void resolveCollision(CompositeSet comp, Set existing, Set added, Collection intersects);
+        public void resolveCollision(CompositeSet<E> comp, Set<E> existing, Set<E> added, Collection<E> intersects);
     }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/set/ListOrderedSet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/ListOrderedSet.java b/src/java/org/apache/commons/collections/set/ListOrderedSet.java
index 855c511..beb3990 100644
--- a/src/java/org/apache/commons/collections/set/ListOrderedSet.java
+++ b/src/java/org/apache/commons/collections/set/ListOrderedSet.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.
@@ -36,7 +36,7 @@ import org.apache.commons.collections.list.UnmodifiableList;
  * <p>
  * The ListOrderedSet also has various useful direct methods. These include many
  * from <code>List</code>, such as <code>get(int)</code>, <code>remove(int)</code>
- * and <code>indexOf(int)</code>. An unmodifiable <code>List</code> view of 
+ * and <code>indexOf(int)</code>. An unmodifiable <code>List</code> view of
  * the set can be obtained via <code>asList()</code>.
  * <p>
  * This class cannot implement the <code>List</code> interface directly as
@@ -46,30 +46,30 @@ import org.apache.commons.collections.list.UnmodifiableList;
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Henning P. Schmiedehausen
  */
-public class ListOrderedSet extends AbstractSerializableSetDecorator implements Set {
+public class ListOrderedSet<E> extends AbstractSerializableSetDecorator<E> implements Set<E> {
 
     /** Serialization version */
     private static final long serialVersionUID = -228664372470420141L;
 
     /** Internal list to hold the sequence of objects */
-    protected final List setOrder;
+    protected final List<E> setOrder;
 
     /**
      * Factory method to create an ordered set specifying the list and set to use.
      * <p>
      * The list and set must both be empty.
-     * 
+     *
      * @param set  the set to decorate, must be empty and not null
      * @param list  the list to decorate, must be empty and not null
      * @throws IllegalArgumentException if set or list is null
      * @throws IllegalArgumentException if either the set or list is not empty
      * @since Commons Collections 3.1
      */
-    public static ListOrderedSet decorate(Set set, List list) {
+    public static <E> ListOrderedSet<E> decorate(Set<E> set, List<E> list) {
         if (set == null) {
             throw new IllegalArgumentException("Set must not be null");
         }
@@ -79,19 +79,19 @@ public class ListOrderedSet extends AbstractSerializableSetDecorator implements
         if (set.size() > 0 || list.size() > 0) {
             throw new IllegalArgumentException("Set and List must be empty");
         }
-        return new ListOrderedSet(set, list);
+        return new ListOrderedSet<E>(set, list);
     }
 
     /**
      * Factory method to create an ordered set.
      * <p>
      * An <code>ArrayList</code> is used to retain order.
-     * 
+     *
      * @param set  the set to decorate, must not be null
      * @throws IllegalArgumentException if set is null
      */
-    public static ListOrderedSet decorate(Set set) {
-        return new ListOrderedSet(set);
+    public static <E> ListOrderedSet<E> decorate(Set<E> set) {
+        return new ListOrderedSet<E>(set);
     }
 
     /**
@@ -101,53 +101,53 @@ public class ListOrderedSet extends AbstractSerializableSetDecorator implements
      * <p>
      * NOTE: If the list contains duplicates, the duplicates are removed,
      * altering the specified list.
-     * 
+     *
      * @param list  the list to decorate, must not be null
      * @throws IllegalArgumentException if list is null
      */
-    public static ListOrderedSet decorate(List list) {
+    public static <E> ListOrderedSet<E> decorate(List<E> list) {
         if (list == null) {
             throw new IllegalArgumentException("List must not be null");
         }
-        Set set = new HashSet(list);
+        Set<E> set = new HashSet<E>(list);
         list.retainAll(set);
-        
-        return new ListOrderedSet(set, list);
+
+        return new ListOrderedSet<E>(set, list);
     }
 
     //-----------------------------------------------------------------------
     /**
      * Constructs a new empty <code>ListOrderedSet</code> using
      * a <code>HashSet</code> and an <code>ArrayList</code> internally.
-     * 
+     *
      * @since Commons Collections 3.1
      */
     public ListOrderedSet() {
-        super(new HashSet());
-        setOrder = new ArrayList();
+        super(new HashSet<E>());
+        setOrder = new ArrayList<E>();
     }
 
     /**
      * Constructor that wraps (not copies).
-     * 
+     *
      * @param set  the set to decorate, must not be null
      * @throws IllegalArgumentException if set is null
      */
-    protected ListOrderedSet(Set set) {
+    protected ListOrderedSet(Set<E> set) {
         super(set);
-        setOrder = new ArrayList(set);
+        setOrder = new ArrayList<E>(set);
     }
 
     /**
      * Constructor that wraps (not copies) the Set and specifies the list to use.
      * <p>
      * The set and list must both be correctly initialised to the same elements.
-     * 
+     *
      * @param set  the set to decorate, must not be null
      * @param list  the list to decorate, must not be null
      * @throws IllegalArgumentException if set or list is null
      */
-    protected ListOrderedSet(Set set, List list) {
+    protected ListOrderedSet(Set<E> set, List<E> list) {
         super(set);
         if (list == null) {
             throw new IllegalArgumentException("List must not be null");
@@ -158,10 +158,10 @@ public class ListOrderedSet extends AbstractSerializableSetDecorator implements
     //-----------------------------------------------------------------------
     /**
      * Gets an unmodifiable view of the order of the Set.
-     * 
+     *
      * @return an unmodifiable list view
      */
-    public List asList() {
+    public List<E> asList() {
         return UnmodifiableList.decorate(setOrder);
     }
 
@@ -171,27 +171,22 @@ public class ListOrderedSet extends AbstractSerializableSetDecorator implements
         setOrder.clear();
     }
 
-    public Iterator iterator() {
-        return new OrderedSetIterator(setOrder.iterator(), collection);
+    public Iterator<E> iterator() {
+        return new OrderedSetIterator<E>(setOrder.iterator(), collection);
     }
 
-    public boolean add(Object object) {
-        if (collection.contains(object)) {
-            // re-adding doesn't change order
-            return collection.add(object);
-        } else {
-            // first add, so add to both set and list
-            boolean result = collection.add(object);
+    public boolean add(E object) {
+        if (collection.add(object)) {
             setOrder.add(object);
-            return result;
+            return true;
         }
+        return false;
     }
 
-    public boolean addAll(Collection coll) {
+    public boolean addAll(Collection<? extends E> coll) {
         boolean result = false;
-        for (Iterator it = coll.iterator(); it.hasNext();) {
-            Object object = it.next();
-            result = result | add(object);
+        for (E e : coll) {
+            result |= add(e);
         }
         return result;
     }
@@ -202,25 +197,24 @@ public class ListOrderedSet extends AbstractSerializableSetDecorator implements
         return result;
     }
 
-    public boolean removeAll(Collection coll) {
+    public boolean removeAll(Collection<?> coll) {
         boolean result = false;
-        for (Iterator it = coll.iterator(); it.hasNext();) {
-            Object object = it.next();
-            result = result | remove(object);
+        for (Iterator<?> it = coll.iterator(); it.hasNext();) {
+            result |= remove(it.next());
         }
         return result;
     }
 
-    public boolean retainAll(Collection coll) {
+    public boolean retainAll(Collection<?> coll) {
         boolean result = collection.retainAll(coll);
         if (result == false) {
             return false;
-        } else if (collection.size() == 0) {
+        }
+        if (collection.size() == 0) {
             setOrder.clear();
         } else {
-            for (Iterator it = setOrder.iterator(); it.hasNext();) {
-                Object object = it.next();
-                if (collection.contains(object) == false) {
+            for (Iterator<E> it = setOrder.iterator(); it.hasNext();) {
+                if (!collection.contains(it.next())) {
                     it.remove();
                 }
             }
@@ -232,12 +226,12 @@ public class ListOrderedSet extends AbstractSerializableSetDecorator implements
         return setOrder.toArray();
     }
 
-    public Object[] toArray(Object a[]) {
+    public <T> T[] toArray(T a[]) {
         return setOrder.toArray(a);
     }
 
     //-----------------------------------------------------------------------
-    public Object get(int index) {
+    public E get(int index) {
         return setOrder.get(index);
     }
 
@@ -245,23 +239,22 @@ public class ListOrderedSet extends AbstractSerializableSetDecorator implements
         return setOrder.indexOf(object);
     }
 
-    public void add(int index, Object object) {
-        if (contains(object) == false) {
+    public void add(int index, E object) {
+        if (!contains(object)) {
             collection.add(object);
             setOrder.add(index, object);
         }
     }
 
-    public boolean addAll(int index, Collection coll) {
+    public boolean addAll(int index, Collection<? extends E> coll) {
         boolean changed = false;
-        for (Iterator it = coll.iterator(); it.hasNext();) {
-            Object object = it.next();
-            if (contains(object) == false) {
-                collection.add(object);
-                setOrder.add(index, object);
-                index++;
-                changed = true;
+        for (E e : coll) {
+            if (contains(e)) {
+                continue;
             }
+            collection.add(e);
+            setOrder.add(index++, e);
+            changed = true;
         }
         return changed;
     }
@@ -273,9 +266,9 @@ public class ListOrderedSet extends AbstractSerializableSetDecorator implements
     }
 
     /**
-     * Uses the underlying List's toString so that order is achieved. 
-     * This means that the decorated Set's toString is not used, so 
-     * any custom toStrings will be ignored. 
+     * Uses the underlying List's toString so that order is achieved.
+     * This means that the decorated Set's toString is not used, so
+     * any custom toStrings will be ignored.
      */
     // Fortunately List.toString and Set.toString look the same
     public String toString() {
@@ -286,19 +279,19 @@ public class ListOrderedSet extends AbstractSerializableSetDecorator implements
     /**
      * Internal iterator handle remove.
      */
-    static class OrderedSetIterator extends AbstractIteratorDecorator {
-        
+    static class OrderedSetIterator<E> extends AbstractIteratorDecorator<E> {
+
         /** Object we iterate on */
-        protected final Collection set;
+        protected final Collection<E> set;
         /** Last object retrieved */
-        protected Object last;
+        protected E last;
 
-        private OrderedSetIterator(Iterator iterator, Collection set) {
+        private OrderedSetIterator(Iterator<E> iterator, Collection<E> set) {
             super(iterator);
             this.set = set;
         }
 
-        public Object next() {
+        public E next() {
             last = iterator.next();
             return last;
         }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/set/MapBackedSet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/MapBackedSet.java b/src/java/org/apache/commons/collections/set/MapBackedSet.java
index 21863ba..5144de5 100644
--- a/src/java/org/apache/commons/collections/set/MapBackedSet.java
+++ b/src/java/org/apache/commons/collections/set/MapBackedSet.java
@@ -37,15 +37,16 @@ import java.util.Set;
  * 
  * @author Stephen Colebourne
  */
-public final class MapBackedSet implements Set, Serializable {
+public final class MapBackedSet<E, V> implements Set<E>, Serializable {
 
     /** Serialization version */
     private static final long serialVersionUID = 6723912213766056587L;
 
     /** The map being used as the backing store */
-    protected final Map map;
+    protected final Map<E, ? super V> map;
+
     /** The dummyValue to use */
-    protected final Object dummyValue;
+    protected final V dummyValue;
 
     /**
      * Factory method to create a set from a map.
@@ -53,7 +54,7 @@ public final class MapBackedSet implements Set, Serializable {
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if set is null
      */
-    public static Set decorate(Map map) {
+    public static <E, V> Set<E> decorate(Map<E, ? super V> map) {
         return decorate(map, null);
     }
 
@@ -64,11 +65,11 @@ public final class MapBackedSet implements Set, Serializable {
      * @param dummyValue  the dummy value to use
      * @throws IllegalArgumentException if map is null
      */
-    public static Set decorate(Map map, Object dummyValue) {
+    public static <E, V> Set<E> decorate(Map<E, ? super V> map, V dummyValue) {
         if (map == null) {
             throw new IllegalArgumentException("The map must not be null");
         }
-        return new MapBackedSet(map, dummyValue);
+        return new MapBackedSet<E, V>(map, dummyValue);
     }
 
     //-----------------------------------------------------------------------
@@ -79,7 +80,7 @@ public final class MapBackedSet implements Set, Serializable {
      * @param dummyValue  the dummy value to use
      * @throws IllegalArgumentException if map is null
      */
-    private MapBackedSet(Map map, Object dummyValue) {
+    private MapBackedSet(Map<E, ? super V> map, V dummyValue) {
         super();
         this.map = map;
         this.dummyValue = dummyValue;
@@ -94,7 +95,7 @@ public final class MapBackedSet implements Set, Serializable {
         return map.isEmpty();
     }
 
-    public Iterator iterator() {
+    public Iterator<E> iterator() {
         return map.keySet().iterator();
     }
 
@@ -102,21 +103,20 @@ public final class MapBackedSet implements Set, Serializable {
         return map.containsKey(obj);
     }
 
-    public boolean containsAll(Collection coll) {
+    public boolean containsAll(Collection<?> coll) {
         return map.keySet().containsAll(coll);
     }
 
-    public boolean add(Object obj) {
+    public boolean add(E obj) {
         int size = map.size();
         map.put(obj, dummyValue);
         return (map.size() != size);
     }
 
-    public boolean addAll(Collection coll) {
+    public boolean addAll(Collection<? extends E> coll) {
         int size = map.size();
-        for (Iterator it = coll.iterator(); it.hasNext();) {
-            Object obj = it.next();
-            map.put(obj, dummyValue);
+        for (E e : coll) {
+            map.put(e, dummyValue);
         }
         return (map.size() != size);
     }
@@ -127,11 +127,11 @@ public final class MapBackedSet implements Set, Serializable {
         return (map.size() != size);
     }
 
-    public boolean removeAll(Collection coll) {
+    public boolean removeAll(Collection<?> coll) {
         return map.keySet().removeAll(coll);
     }
 
-    public boolean retainAll(Collection coll) {
+    public boolean retainAll(Collection<?> coll) {
         return map.keySet().retainAll(coll);
     }
 
@@ -143,7 +143,7 @@ public final class MapBackedSet implements Set, Serializable {
         return map.keySet().toArray();
     }
 
-    public Object[] toArray(Object[] array) {
+    public <T> T[] toArray(T[] array) {
         return map.keySet().toArray(array);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/set/SynchronizedSet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/SynchronizedSet.java b/src/java/org/apache/commons/collections/set/SynchronizedSet.java
index 53b31aa..1bc69f1 100644
--- a/src/java/org/apache/commons/collections/set/SynchronizedSet.java
+++ b/src/java/org/apache/commons/collections/set/SynchronizedSet.java
@@ -75,8 +75,8 @@ public class SynchronizedSet<E> extends SynchronizedCollection<E> implements Set
      * 
      * @return the decorated set
      */
-    protected Set getSet() {
-        return (Set) collection;
+    protected Set<E> getSet() {
+        return (Set<E>) collection;
     }
 
 }


[57/77] [abbrv] commons-collections git commit: comment

Posted by ch...@apache.org.
comment

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@751903 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/e17ccdb8
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/e17ccdb8
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/e17ccdb8

Branch: refs/heads/collections_jdk5_branch
Commit: e17ccdb8192ad05c14db24d138e5c63ba6f2dc97
Parents: da23d70
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Mon Mar 9 23:10:21 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Mon Mar 9 23:10:21 2009 +0000

----------------------------------------------------------------------
 .../commons/collections/map/TransformedMap.java | 30 +++++++++++---------
 1 file changed, 16 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/e17ccdb8/src/java/org/apache/commons/collections/map/TransformedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/TransformedMap.java b/src/java/org/apache/commons/collections/map/TransformedMap.java
index 49cd9ec..0b4c9c7 100644
--- a/src/java/org/apache/commons/collections/map/TransformedMap.java
+++ b/src/java/org/apache/commons/collections/map/TransformedMap.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.
@@ -36,14 +36,16 @@ import org.apache.commons.collections.Transformer;
  * <strong>Note that TransformedMap is not synchronized and is not thread-safe.</strong>
  * If you wish to use this map from multiple threads concurrently, you must use
  * appropriate synchronization. The simplest approach is to wrap this map
- * using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw 
+ * using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw
  * exceptions when accessed by concurrent threads without synchronization.
  * <p>
  * This class is Serializable from Commons Collections 3.1.
+ * <p>
+ * @see org.apache.commons.collections.splitmap.TransformedMap
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
 public class TransformedMap<K, V>
@@ -64,7 +66,7 @@ public class TransformedMap<K, V>
      * If there are any elements already in the map being decorated, they
      * are NOT transformed.
      * Contrast this with {@link #decorateTransform}.
-     * 
+     *
      * @param map  the map to decorate, must not be null
      * @param keyTransformer  the transformer to use for key conversion, null means no transformation
      * @param valueTransformer  the transformer to use for value conversion, null means no transformation
@@ -83,7 +85,7 @@ public class TransformedMap<K, V>
      * If there are any elements already in the map being decorated, they
      * will be transformed by this method.
      * Contrast this with {@link #decorate}.
-     * 
+     *
      * @param map  the map to decorate, must not be null
      * @param keyTransformer  the transformer to use for key conversion, null means no transformation
      * @param valueTransformer  the transformer to use for value conversion, null means no transformation
@@ -108,7 +110,7 @@ public class TransformedMap<K, V>
      * <p>
      * If there are any elements already in the collection being decorated, they
      * are NOT transformed.
-     * 
+     *
      * @param map  the map to decorate, must not be null
      * @param keyTransformer  the transformer to use for key conversion, null means no conversion
      * @param valueTransformer  the transformer to use for value conversion, null means no conversion
@@ -124,7 +126,7 @@ public class TransformedMap<K, V>
     //-----------------------------------------------------------------------
     /**
      * Write the map out using a custom routine.
-     * 
+     *
      * @param out  the output stream
      * @throws IOException
      * @since Commons Collections 3.1
@@ -136,7 +138,7 @@ public class TransformedMap<K, V>
 
     /**
      * Read the map in using a custom routine.
-     * 
+     *
      * @param in  the input stream
      * @throws IOException
      * @throws ClassNotFoundException
@@ -153,7 +155,7 @@ public class TransformedMap<K, V>
      * Transforms a key.
      * <p>
      * The transformer itself may throw an exception if necessary.
-     * 
+     *
      * @param object  the object to transform
      * @throws the transformed object
      */
@@ -168,7 +170,7 @@ public class TransformedMap<K, V>
      * Transforms a value.
      * <p>
      * The transformer itself may throw an exception if necessary.
-     * 
+     *
      * @param object  the object to transform
      * @throws the transformed object
      */
@@ -183,7 +185,7 @@ public class TransformedMap<K, V>
      * Transforms a map.
      * <p>
      * The transformer itself may throw an exception if necessary.
-     * 
+     *
      * @param map  the map to transform
      * @throws the transformed object
      */
@@ -202,7 +204,7 @@ public class TransformedMap<K, V>
 
     /**
      * Override to transform the value when using <code>setValue</code>.
-     * 
+     *
      * @param value  the value to transform
      * @return the transformed value
      * @since Commons Collections 3.1
@@ -213,7 +215,7 @@ public class TransformedMap<K, V>
 
     /**
      * Override to only return true when there is a value transformer.
-     * 
+     *
      * @return true if a value transformer is in use
      * @since Commons Collections 3.1
      */


[45/77] [abbrv] commons-collections git commit: comments

Posted by ch...@apache.org.
comments

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@751852 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/e53e8f2f
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/e53e8f2f
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/e53e8f2f

Branch: refs/heads/collections_jdk5_branch
Commit: e53e8f2fc4f6d49ed7ac4c8350cf138778896cb1
Parents: afd5d3f
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Mon Mar 9 21:37:19 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Mon Mar 9 21:37:19 2009 +0000

----------------------------------------------------------------------
 src/java/org/apache/commons/collections/map/TransformedMap.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/e53e8f2f/src/java/org/apache/commons/collections/map/TransformedMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/TransformedMap.java b/src/java/org/apache/commons/collections/map/TransformedMap.java
index 56741fd..49cd9ec 100644
--- a/src/java/org/apache/commons/collections/map/TransformedMap.java
+++ b/src/java/org/apache/commons/collections/map/TransformedMap.java
@@ -63,7 +63,7 @@ public class TransformedMap<K, V>
      * <p>
      * If there are any elements already in the map being decorated, they
      * are NOT transformed.
-     * Constrast this with {@link #decorateTransform}.
+     * Contrast this with {@link #decorateTransform}.
      * 
      * @param map  the map to decorate, must not be null
      * @param keyTransformer  the transformer to use for key conversion, null means no transformation
@@ -82,7 +82,7 @@ public class TransformedMap<K, V>
      * <p>
      * If there are any elements already in the map being decorated, they
      * will be transformed by this method.
-     * Constrast this with {@link #decorate}.
+     * Contrast this with {@link #decorate}.
      * 
      * @param map  the map to decorate, must not be null
      * @param keyTransformer  the transformer to use for key conversion, null means no transformation


[41/77] [abbrv] commons-collections git commit: update javadoc/html files to newer-style ASL headers

Posted by ch...@apache.org.
update javadoc/html files to newer-style ASL headers

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@740367 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/2aefdf6a
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/2aefdf6a
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/2aefdf6a

Branch: refs/heads/collections_jdk5_branch
Commit: 2aefdf6a5346e234925760d551ef216802dc608b
Parents: dadc033
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Tue Feb 3 18:17:29 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Tue Feb 3 18:17:29 2009 +0000

----------------------------------------------------------------------
 src/java/org/apache/commons/collections/bag/package.html | 11 ++++++-----
 .../org/apache/commons/collections/bidimap/package.html  | 11 ++++++-----
 .../org/apache/commons/collections/buffer/package.html   | 11 ++++++-----
 .../apache/commons/collections/collection/package.html   | 11 ++++++-----
 .../apache/commons/collections/comparators/package.html  | 11 ++++++-----
 .../org/apache/commons/collections/functors/package.html | 11 ++++++-----
 .../apache/commons/collections/iterators/package.html    | 11 ++++++-----
 .../org/apache/commons/collections/keyvalue/package.html | 11 ++++++-----
 .../org/apache/commons/collections/list/package.html     | 11 ++++++-----
 src/java/org/apache/commons/collections/map/package.html | 11 ++++++-----
 src/java/org/apache/commons/collections/overview.html    | 11 ++++++-----
 src/java/org/apache/commons/collections/package.html     | 11 ++++++-----
 src/java/org/apache/commons/collections/set/package.html | 11 ++++++-----
 13 files changed, 78 insertions(+), 65 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/2aefdf6a/src/java/org/apache/commons/collections/bag/package.html
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bag/package.html b/src/java/org/apache/commons/collections/bag/package.html
index f5a84b4..bbf1afe 100644
--- a/src/java/org/apache/commons/collections/bag/package.html
+++ b/src/java/org/apache/commons/collections/bag/package.html
@@ -1,10 +1,11 @@
 <!-- $Id$ -->
  <!--
-   Copyright 2003-2004 The Apache Software Foundation
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   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
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/2aefdf6a/src/java/org/apache/commons/collections/bidimap/package.html
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bidimap/package.html b/src/java/org/apache/commons/collections/bidimap/package.html
index 0892dc8..d2f4be7 100644
--- a/src/java/org/apache/commons/collections/bidimap/package.html
+++ b/src/java/org/apache/commons/collections/bidimap/package.html
@@ -1,10 +1,11 @@
 <!-- $Id$ -->
  <!--
-   Copyright 2003-2004 The Apache Software Foundation
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   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
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/2aefdf6a/src/java/org/apache/commons/collections/buffer/package.html
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/buffer/package.html b/src/java/org/apache/commons/collections/buffer/package.html
index fb96927..1c20c8f 100644
--- a/src/java/org/apache/commons/collections/buffer/package.html
+++ b/src/java/org/apache/commons/collections/buffer/package.html
@@ -1,10 +1,11 @@
 <!-- $Id$ -->
  <!--
-   Copyright 2003-2004 The Apache Software Foundation
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   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
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/2aefdf6a/src/java/org/apache/commons/collections/collection/package.html
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/collection/package.html b/src/java/org/apache/commons/collections/collection/package.html
index 8057b14..bf847d8 100644
--- a/src/java/org/apache/commons/collections/collection/package.html
+++ b/src/java/org/apache/commons/collections/collection/package.html
@@ -1,10 +1,11 @@
 <!-- $Id$ -->
  <!--
-   Copyright 2003-2004 The Apache Software Foundation
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   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
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/2aefdf6a/src/java/org/apache/commons/collections/comparators/package.html
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/comparators/package.html b/src/java/org/apache/commons/collections/comparators/package.html
index 99e8c96..cde16a1 100644
--- a/src/java/org/apache/commons/collections/comparators/package.html
+++ b/src/java/org/apache/commons/collections/comparators/package.html
@@ -1,10 +1,11 @@
 <!-- $Id$ -->
  <!--
-   Copyright 2002-2004 The Apache Software Foundation
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   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
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/2aefdf6a/src/java/org/apache/commons/collections/functors/package.html
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/package.html b/src/java/org/apache/commons/collections/functors/package.html
index ad9584a..0243e6f 100644
--- a/src/java/org/apache/commons/collections/functors/package.html
+++ b/src/java/org/apache/commons/collections/functors/package.html
@@ -1,10 +1,11 @@
 <!-- $Id$ -->
  <!--
-   Copyright 2003-2005 The Apache Software Foundation
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   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
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/2aefdf6a/src/java/org/apache/commons/collections/iterators/package.html
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/package.html b/src/java/org/apache/commons/collections/iterators/package.html
index 7bd2db3..10c3fe5 100644
--- a/src/java/org/apache/commons/collections/iterators/package.html
+++ b/src/java/org/apache/commons/collections/iterators/package.html
@@ -1,10 +1,11 @@
 <!-- $Id$ -->
  <!--
-   Copyright 2002-2004 The Apache Software Foundation
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   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
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/2aefdf6a/src/java/org/apache/commons/collections/keyvalue/package.html
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/keyvalue/package.html b/src/java/org/apache/commons/collections/keyvalue/package.html
index fd79e55..cbfce12 100644
--- a/src/java/org/apache/commons/collections/keyvalue/package.html
+++ b/src/java/org/apache/commons/collections/keyvalue/package.html
@@ -1,10 +1,11 @@
 <!-- $Id$ -->
  <!--
-   Copyright 2003-2004 The Apache Software Foundation
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   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
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/2aefdf6a/src/java/org/apache/commons/collections/list/package.html
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/package.html b/src/java/org/apache/commons/collections/list/package.html
index 14aa369..31728c3 100644
--- a/src/java/org/apache/commons/collections/list/package.html
+++ b/src/java/org/apache/commons/collections/list/package.html
@@ -1,10 +1,11 @@
 <!-- $Id$ -->
  <!--
-   Copyright 2006 The Apache Software Foundation
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   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
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/2aefdf6a/src/java/org/apache/commons/collections/map/package.html
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/package.html b/src/java/org/apache/commons/collections/map/package.html
index 47e4211..95bbc16 100644
--- a/src/java/org/apache/commons/collections/map/package.html
+++ b/src/java/org/apache/commons/collections/map/package.html
@@ -1,10 +1,11 @@
 <!-- $Id$ -->
  <!--
-   Copyright 2003-2004 The Apache Software Foundation
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   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
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/2aefdf6a/src/java/org/apache/commons/collections/overview.html
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/overview.html b/src/java/org/apache/commons/collections/overview.html
index 83d1f51..6cb5dfd 100644
--- a/src/java/org/apache/commons/collections/overview.html
+++ b/src/java/org/apache/commons/collections/overview.html
@@ -1,10 +1,11 @@
 <!-- $Id$ -->
  <!--
-   Copyright 2003-2004 The Apache Software Foundation
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   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
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/2aefdf6a/src/java/org/apache/commons/collections/package.html
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/package.html b/src/java/org/apache/commons/collections/package.html
index 2a9da01..3de2338 100644
--- a/src/java/org/apache/commons/collections/package.html
+++ b/src/java/org/apache/commons/collections/package.html
@@ -1,10 +1,11 @@
 <!-- $Id$ -->
  <!--
-   Copyright 2003-2006 The Apache Software Foundation
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   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
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/2aefdf6a/src/java/org/apache/commons/collections/set/package.html
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/set/package.html b/src/java/org/apache/commons/collections/set/package.html
index 36f895b..9cecab1 100644
--- a/src/java/org/apache/commons/collections/set/package.html
+++ b/src/java/org/apache/commons/collections/set/package.html
@@ -1,10 +1,11 @@
 <!-- $Id$ -->
  <!--
-   Copyright 2003-2004 The Apache Software Foundation
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   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
 


[25/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/IteratorChain.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/IteratorChain.java b/src/java/org/apache/commons/collections/iterators/IteratorChain.java
index abcde4c..eaca82a 100644
--- a/src/java/org/apache/commons/collections/iterators/IteratorChain.java
+++ b/src/java/org/apache/commons/collections/iterators/IteratorChain.java
@@ -26,45 +26,50 @@ import org.apache.commons.collections.list.UnmodifiableList;
 /**
  * An IteratorChain is an Iterator that wraps a number of Iterators.
  * <p>
- * This class makes multiple iterators look like one to the caller
- * When any method from the Iterator interface is called, the IteratorChain
- * will delegate to a single underlying Iterator. The IteratorChain will
- * invoke the Iterators in sequence until all Iterators are exhausted.
+ * This class makes multiple iterators look like one to the caller When any
+ * method from the Iterator interface is called, the IteratorChain will delegate
+ * to a single underlying Iterator. The IteratorChain will invoke the Iterators
+ * in sequence until all Iterators are exhausted.
  * <p>
- * Under many circumstances, linking Iterators together in this manner is
- * more efficient (and convenient) than reading out the contents of each
- * Iterator into a List and creating a new Iterator.
+ * Under many circumstances, linking Iterators together in this manner is more
+ * efficient (and convenient) than reading out the contents of each Iterator
+ * into a List and creating a new Iterator.
  * <p>
  * Calling a method that adds new Iterator<i>after a method in the Iterator
- * interface has been called</i> will result in an UnsupportedOperationException.
- * Subclasses should <i>take care</i> to not alter the underlying List of Iterators.
+ * interface has been called</i> will result in an
+ * UnsupportedOperationException. Subclasses should <i>take care</i> to not
+ * alter the underlying List of Iterators.
  * <p>
- * NOTE: As from version 3.0, the IteratorChain may contain no
- * iterators. In this case the class will function as an empty iterator.
- *
+ * NOTE: As from version 3.0, the IteratorChain may contain no iterators. In
+ * this case the class will function as an empty iterator.
+ * 
  * @since Commons Collections 2.1
- * @version $Revision$ $Date$
- *
+ * @version $Revision$ $Date: 2006-10-27 19:52:37 -0500 (Fri, 27 Oct
+ * 2006) $
+ * 
  * @author Morgan Delagrange
  * @author Stephen Colebourne
  */
-public class IteratorChain implements Iterator {
+public class IteratorChain<E> implements Iterator<E> {
+
+    /** The chain of iterators */
+    protected final List<Iterator<? extends E>> iteratorChain = new ArrayList<Iterator<? extends E>>();
 
-	/** The chain of iterators */
-    protected final List iteratorChain = new ArrayList();
     /** The index of the current iterator */
     protected int currentIteratorIndex = 0;
+
     /** The current iterator */
-    protected Iterator currentIterator = null;
+    protected Iterator<? extends E> currentIterator = null;
+
     /**
-     * The "last used" Iterator is the Iterator upon which
-     * next() or hasNext() was most recently called
-     * used for the remove() operation only
+     * The "last used" Iterator is the Iterator upon which next() or hasNext()
+     * was most recently called used for the remove() operation only
      */
-    protected Iterator lastUsedIterator = null;
+    protected Iterator<? extends E> lastUsedIterator = null;
+
     /**
-     * ComparatorChain is "locked" after the first time
-     * compare(Object,Object) is called
+     * ComparatorChain is "locked" after the first time compare(Object,Object)
+     * is called
      */
     protected boolean isLocked = false;
 
@@ -72,8 +77,8 @@ public class IteratorChain implements Iterator {
     /**
      * Construct an IteratorChain with no Iterators.
      * <p>
-     * You will normally use {@link #addIterator(Iterator)} to add
-     * some iterators after using this constructor.
+     * You will normally use {@link #addIterator(Iterator)} to add some
+     * iterators after using this constructor.
      */
     public IteratorChain() {
         super();
@@ -82,49 +87,47 @@ public class IteratorChain implements Iterator {
     /**
      * Construct an IteratorChain with a single Iterator.
      * <p>
-     * This method takes one iterator. The newly constructed iterator
-     * will iterate through that iterator. Thus calling this constructor
-     * on its own will have no effect other than decorating the input iterator.
+     * This method takes one iterator. The newly constructed iterator will
+     * iterate through that iterator. Thus calling this constructor on its own
+     * will have no effect other than decorating the input iterator.
      * <p>
-     * You will normally use {@link #addIterator(Iterator)} to add
-     * some more iterators after using this constructor.
-     *
-     * @param iterator  the first child iterator in the IteratorChain, not null
+     * You will normally use {@link #addIterator(Iterator)} to add some more
+     * iterators after using this constructor.
+     * 
+     * @param iterator the first child iterator in the IteratorChain, not null
      * @throws NullPointerException if the iterator is null
      */
-    public IteratorChain(Iterator iterator) {
+    public IteratorChain(Iterator<? extends E> iterator) {
         super();
         addIterator(iterator);
     }
 
     /**
-     * Constructs a new <code>IteratorChain</code> over the two
-     * given iterators.
+     * Constructs a new <code>IteratorChain</code> over the two given iterators.
      * <p>
-     * This method takes two iterators. The newly constructed iterator
-     * will iterate through each one of the input iterators in turn.
-     *
-     * @param first  the first child iterator in the IteratorChain, not null
-     * @param second  the second child iterator in the IteratorChain, not null
+     * This method takes two iterators. The newly constructed iterator will
+     * iterate through each one of the input iterators in turn.
+     * 
+     * @param first the first child iterator in the IteratorChain, not null
+     * @param second the second child iterator in the IteratorChain, not null
      * @throws NullPointerException if either iterator is null
      */
-    public IteratorChain(Iterator first, Iterator second) {
+    public IteratorChain(Iterator<? extends E> first, Iterator<? extends E> second) {
         super();
         addIterator(first);
         addIterator(second);
     }
 
     /**
-     * Constructs a new <code>IteratorChain</code> over the array
-     * of iterators.
+     * Constructs a new <code>IteratorChain</code> over the array of iterators.
      * <p>
      * This method takes an array of iterators. The newly constructed iterator
      * will iterate through each one of the input iterators in turn.
-     *
-     * @param iteratorChain  the array of iterators, not null
+     * 
+     * @param iteratorChain the array of iterators, not null
      * @throws NullPointerException if iterators array is or contains null
      */
-    public IteratorChain(Iterator[] iteratorChain) {
+    public IteratorChain(Iterator<? extends E>[] iteratorChain) {
         super();
         for (int i = 0; i < iteratorChain.length; i++) {
             addIterator(iteratorChain[i]);
@@ -132,33 +135,33 @@ public class IteratorChain implements Iterator {
     }
 
     /**
-     * Constructs a new <code>IteratorChain</code> over the collection
-     * of iterators.
+     * Constructs a new <code>IteratorChain</code> over the collection of
+     * iterators.
      * <p>
-     * This method takes a collection of iterators. The newly constructed iterator
-     * will iterate through each one of the input iterators in turn.
-     *
-     * @param iteratorChain  the collection of iterators, not null
+     * This method takes a collection of iterators. The newly constructed
+     * iterator will iterate through each one of the input iterators in turn.
+     * 
+     * @param iteratorChain the collection of iterators, not null
      * @throws NullPointerException if iterators collection is or contains null
-     * @throws ClassCastException if iterators collection doesn't contain an iterator
+     * @throws ClassCastException if iterators collection doesn't contain an
+     * iterator
      */
-    public IteratorChain(Collection iteratorChain) {
+    public IteratorChain(Collection<Iterator<? extends E>> iteratorChain) {
         super();
-        for (Iterator it = iteratorChain.iterator(); it.hasNext();) {
-            Iterator item = (Iterator) it.next();
-            addIterator(item);
+        for (Iterator<? extends E> iterator : iteratorChain) {
+            addIterator(iterator);
         }
     }
 
     //-----------------------------------------------------------------------
     /**
      * Add an Iterator to the end of the chain
-     *
+     * 
      * @param iterator Iterator to add
      * @throws IllegalStateException if I've already started iterating
      * @throws NullPointerException if the iterator is null
      */
-    public void addIterator(Iterator iterator) {
+    public void addIterator(Iterator<? extends E> iterator) {
         checkLocked();
         if (iterator == null) {
             throw new NullPointerException("Iterator must not be null");
@@ -168,14 +171,15 @@ public class IteratorChain implements Iterator {
 
     /**
      * Set the Iterator at the given index
-     *
-     * @param index      index of the Iterator to replace
-     * @param iterator   Iterator to place at the given index
+     * 
+     * @param index index of the Iterator to replace
+     * @param iterator Iterator to place at the given index
      * @throws IndexOutOfBoundsException if index &lt; 0 or index &gt; size()
      * @throws IllegalStateException if I've already started iterating
      * @throws NullPointerException if the iterator is null
      */
-    public void setIterator(int index, Iterator iterator) throws IndexOutOfBoundsException {
+    public void setIterator(int index, Iterator<? extends E> iterator)
+            throws IndexOutOfBoundsException {
         checkLocked();
         if (iterator == null) {
             throw new NullPointerException("Iterator must not be null");
@@ -185,16 +189,16 @@ public class IteratorChain implements Iterator {
 
     /**
      * Get the list of Iterators (unmodifiable)
-     *
+     * 
      * @return the unmodifiable list of iterators added
      */
-    public List getIterators() {
+    public List<Iterator<? extends E>> getIterators() {
         return UnmodifiableList.decorate(iteratorChain);
     }
 
     /**
      * Number of Iterators in the current IteratorChain.
-     *
+     * 
      * @return Iterator count
      */
     public int size() {
@@ -203,9 +207,9 @@ public class IteratorChain implements Iterator {
 
     /**
      * Determine if modifications can still be made to the IteratorChain.
-     * IteratorChains cannot be modified once they have executed a method
-     * from the Iterator interface.
-     *
+     * IteratorChains cannot be modified once they have executed a method from
+     * the Iterator interface.
+     * 
      * @return true if IteratorChain cannot be modified, false if it can
      */
     public boolean isLocked() {
@@ -217,13 +221,14 @@ public class IteratorChain implements Iterator {
      */
     private void checkLocked() {
         if (isLocked == true) {
-            throw new UnsupportedOperationException("IteratorChain cannot be changed after the first use of a method from the Iterator interface");
+            throw new UnsupportedOperationException(
+                    "IteratorChain cannot be changed after the first use of a method from the Iterator interface");
         }
     }
 
     /**
-     * Lock the chain so no more iterators can be added.
-     * This must be called from all Iterator interface methods.
+     * Lock the chain so no more iterators can be added. This must be called
+     * from all Iterator interface methods.
      */
     private void lockChain() {
         if (isLocked == false) {
@@ -232,31 +237,32 @@ public class IteratorChain implements Iterator {
     }
 
     /**
-     * Updates the current iterator field to ensure that the current Iterator
-     * is not exhausted
+     * Updates the current iterator field to ensure that the current Iterator is
+     * not exhausted
      */
     protected void updateCurrentIterator() {
         if (currentIterator == null) {
             if (iteratorChain.isEmpty()) {
-                currentIterator = EmptyIterator.INSTANCE;
+                currentIterator = EmptyIterator.<E> getInstance();
             } else {
-                currentIterator = (Iterator) iteratorChain.get(0);
+                currentIterator = iteratorChain.get(0);
             }
             // set last used iterator here, in case the user calls remove
             // before calling hasNext() or next() (although they shouldn't)
             lastUsedIterator = currentIterator;
         }
 
-        while (currentIterator.hasNext() == false && currentIteratorIndex < iteratorChain.size() - 1) {
+        while (currentIterator.hasNext() == false
+                && currentIteratorIndex < iteratorChain.size() - 1) {
             currentIteratorIndex++;
-            currentIterator = (Iterator) iteratorChain.get(currentIteratorIndex);
+            currentIterator = iteratorChain.get(currentIteratorIndex);
         }
     }
 
     //-----------------------------------------------------------------------
     /**
      * Return true if any Iterator in the IteratorChain has a remaining element.
-     *
+     * 
      * @return true if elements remain
      */
     public boolean hasNext() {
@@ -269,11 +275,12 @@ public class IteratorChain implements Iterator {
 
     /**
      * Returns the next Object of the current Iterator
-     *
+     * 
      * @return Object from the current Iterator
-     * @throws java.util.NoSuchElementException if all the Iterators are exhausted
+     * @throws java.util.NoSuchElementException if all the Iterators are
+     * exhausted
      */
-    public Object next() {
+    public E next() {
         lockChain();
         updateCurrentIterator();
         lastUsedIterator = currentIterator;
@@ -282,18 +289,17 @@ public class IteratorChain implements Iterator {
     }
 
     /**
-     * Removes from the underlying collection the last element
-     * returned by the Iterator.  As with next() and hasNext(),
-     * this method calls remove() on the underlying Iterator.
-     * Therefore, this method may throw an
-     * UnsupportedOperationException if the underlying
-     * Iterator does not support this method.
-     *
-     * @throws UnsupportedOperationException
-     *   if the remove operator is not supported by the underlying Iterator
-     * @throws IllegalStateException
-     *   if the next method has not yet been called, or the remove method has
-     *   already been called after the last call to the next method.
+     * Removes from the underlying collection the last element returned by the
+     * Iterator. As with next() and hasNext(), this method calls remove() on the
+     * underlying Iterator. Therefore, this method may throw an
+     * UnsupportedOperationException if the underlying Iterator does not support
+     * this method.
+     * 
+     * @throws UnsupportedOperationException if the remove operator is not
+     * supported by the underlying Iterator
+     * @throws IllegalStateException if the next method has not yet been called,
+     * or the remove method has already been called after the last call to the
+     * next method.
      */
     public void remove() {
         lockChain();

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/IteratorEnumeration.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/IteratorEnumeration.java b/src/java/org/apache/commons/collections/iterators/IteratorEnumeration.java
index 7858243..499d994 100644
--- a/src/java/org/apache/commons/collections/iterators/IteratorEnumeration.java
+++ b/src/java/org/apache/commons/collections/iterators/IteratorEnumeration.java
@@ -19,36 +19,36 @@ package org.apache.commons.collections.iterators;
 import java.util.Enumeration;
 import java.util.Iterator;
 
-/** 
- * Adapter to make an {@link Iterator Iterator} instance appear to be
- * an {@link Enumeration Enumeration} instance.
- *
+/**
+ * Adapter to make an {@link Iterator Iterator} instance appear to be an
+ * {@link Enumeration Enumeration} instance.
+ * 
  * @since Commons Collections 1.0
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2006-10-27 19:52:37 -0500 (Fri, 27 Oct
+ * 2006) $
  * 
  * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
  */
-public class IteratorEnumeration implements Enumeration {
-    
+public class IteratorEnumeration<E> implements Enumeration<E> {
+
     /** The iterator being decorated. */
-    private Iterator iterator;
-    
+    private Iterator<? extends E> iterator;
+
     /**
-     * Constructs a new <code>IteratorEnumeration</code> that will not 
-     * function until {@link #setIterator(Iterator) setIterator} is  
-     * invoked.
+     * Constructs a new <code>IteratorEnumeration</code> that will not function
+     * until {@link #setIterator(Iterator) setIterator} is invoked.
      */
     public IteratorEnumeration() {
         super();
     }
 
     /**
-     * Constructs a new <code>IteratorEnumeration</code> that will use
-     * the given iterator. 
+     * Constructs a new <code>IteratorEnumeration</code> that will use the given
+     * iterator.
      * 
-     * @param iterator  the iterator to use
+     * @param iterator the iterator to use
      */
-    public IteratorEnumeration( Iterator iterator ) {
+    public IteratorEnumeration(Iterator<? extends E> iterator) {
         super();
         this.iterator = iterator;
     }
@@ -57,22 +57,22 @@ public class IteratorEnumeration implements Enumeration {
     //-------------------------------------------------------------------------
 
     /**
-     *  Returns true if the underlying iterator has more elements.
-     *
-     *  @return true if the underlying iterator has more elements
+     * Returns true if the underlying iterator has more elements.
+     * 
+     * @return true if the underlying iterator has more elements
      */
     public boolean hasMoreElements() {
         return iterator.hasNext();
     }
 
     /**
-     *  Returns the next element from the underlying iterator.
-     *
-     *  @return the next element from the underlying iterator.
-     *  @throws java.util.NoSuchElementException  if the underlying iterator has no
-     *    more elements
+     * Returns the next element from the underlying iterator.
+     * 
+     * @return the next element from the underlying iterator.
+     * @throws java.util.NoSuchElementException if the underlying iterator has
+     * no more elements
      */
-    public Object nextElement() {
+    public E nextElement() {
         return iterator.next();
     }
 
@@ -80,21 +80,21 @@ public class IteratorEnumeration implements Enumeration {
     //-------------------------------------------------------------------------
 
     /**
-     *  Returns the underlying iterator.
+     * Returns the underlying iterator.
      * 
-     *  @return the underlying iterator
+     * @return the underlying iterator
      */
-    public Iterator getIterator() {
+    public Iterator<? extends E> getIterator() {
         return iterator;
     }
 
     /**
-     *  Sets the underlying iterator.
-     *
-     *  @param iterator  the new underlying iterator
+     * Sets the underlying iterator.
+     * 
+     * @param iterator the new underlying iterator
      */
-    public void setIterator( Iterator iterator ) {
+    public void setIterator(Iterator<? extends E> iterator) {
         this.iterator = iterator;
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java b/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java
index de1e8c2..4abd2f5 100644
--- a/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java
+++ b/src/java/org/apache/commons/collections/iterators/ListIteratorWrapper.java
@@ -42,16 +42,16 @@ import org.apache.commons.collections.ResettableListIterator;
  * @author Morgan Delagrange
  * @author Stephen Colebourne
  */
-public class ListIteratorWrapper implements ResettableListIterator {
+public class ListIteratorWrapper<E> implements ResettableListIterator<E> {
 
     /** Message used when remove, set or add are called. */
     private static final String UNSUPPORTED_OPERATION_MESSAGE =
         "ListIteratorWrapper does not support optional operations of ListIterator.";
 
     /** The underlying iterator being decorated. */
-    private final Iterator iterator;
+    private final Iterator<? extends E> iterator;
     /** The list being used to cache the iterator. */
-    private final List list = new ArrayList();
+    private final List<E> list = new ArrayList<E>();
 
     /** The current index of this iterator. */
     private int currentIndex = 0;
@@ -67,7 +67,7 @@ public class ListIteratorWrapper implements ResettableListIterator {
      * @param iterator  the iterator to wrap
      * @throws NullPointerException if the iterator is null
      */
-    public ListIteratorWrapper(Iterator iterator) {
+    public ListIteratorWrapper(Iterator<? extends E> iterator) {
         super();
         if (iterator == null) {
             throw new NullPointerException("Iterator must not be null");
@@ -83,7 +83,7 @@ public class ListIteratorWrapper implements ResettableListIterator {
      * @param obj  the object to add, ignored
      * @throws UnsupportedOperationException always
      */
-    public void add(Object obj) throws UnsupportedOperationException {
+    public void add(E obj) throws UnsupportedOperationException {
         throw new UnsupportedOperationException(UNSUPPORTED_OPERATION_MESSAGE);
     }
 
@@ -117,13 +117,13 @@ public class ListIteratorWrapper implements ResettableListIterator {
      * @return the next element from the iterator
      * @throws NoSuchElementException if there are no more elements
      */
-    public Object next() throws NoSuchElementException {
+    public E next() throws NoSuchElementException {
         if (currentIndex < wrappedIteratorIndex) {
             ++currentIndex;
             return list.get(currentIndex - 1);
         }
 
-        Object retval = iterator.next();
+        E retval = iterator.next();
         list.add(retval);
         ++currentIndex;
         ++wrappedIteratorIndex;
@@ -145,7 +145,7 @@ public class ListIteratorWrapper implements ResettableListIterator {
      * @return the previous element
      * @throws NoSuchElementException  if there are no previous elements
      */
-    public Object previous() throws NoSuchElementException {
+    public E previous() throws NoSuchElementException {
         if (currentIndex == 0) {
             throw new NoSuchElementException();
         }
@@ -177,7 +177,7 @@ public class ListIteratorWrapper implements ResettableListIterator {
      * @param obj  the object to set, ignored
      * @throws UnsupportedOperationException always
      */
-    public void set(Object obj) throws UnsupportedOperationException {
+    public void set(E obj) throws UnsupportedOperationException {
         throw new UnsupportedOperationException(UNSUPPORTED_OPERATION_MESSAGE);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/LoopingIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/LoopingIterator.java b/src/java/org/apache/commons/collections/iterators/LoopingIterator.java
index 9909416..8a23122 100644
--- a/src/java/org/apache/commons/collections/iterators/LoopingIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/LoopingIterator.java
@@ -38,12 +38,12 @@ import org.apache.commons.collections.ResettableIterator;
  * @author <a href="mailto:joncrlsn@users.sf.net">Jonathan Carlson</a>
  * @author Stephen Colebourne
  */
-public class LoopingIterator implements ResettableIterator {
+public class LoopingIterator<E> implements ResettableIterator<E> {
     
     /** The collection to base the iterator on */
-    private Collection collection;
+    private Collection<? extends E> collection;
     /** The current iterator */
-    private Iterator iterator;
+    private Iterator<? extends E> iterator;
 
     /**
      * Constructor that wraps a collection.
@@ -54,7 +54,7 @@ public class LoopingIterator implements ResettableIterator {
      * @param coll  the collection to wrap
      * @throws NullPointerException if the collection is null
      */
-    public LoopingIterator(Collection coll) {
+    public LoopingIterator(Collection<? extends E> coll) {
         if (coll == null) {
             throw new NullPointerException("The collection must not be null");
         }
@@ -82,7 +82,7 @@ public class LoopingIterator implements ResettableIterator {
      * @throws NoSuchElementException if there are no elements
      *         at all.  Use {@link #hasNext} to avoid this error.
      */
-    public Object next() {
+    public E next() {
         if (collection.size() == 0) {
             throw new NoSuchElementException("There are no elements for this iterator to loop on");
         }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/LoopingListIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/LoopingListIterator.java b/src/java/org/apache/commons/collections/iterators/LoopingListIterator.java
index b3ca2d8..a951c61 100644
--- a/src/java/org/apache/commons/collections/iterators/LoopingListIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/LoopingListIterator.java
@@ -39,12 +39,12 @@ import org.apache.commons.collections.ResettableListIterator;
  *
  * @author Eric Crampton <cc...@eonomine.com>
  */
-public class LoopingListIterator implements ResettableListIterator {
+public class LoopingListIterator<E> implements ResettableListIterator<E> {
 
     /** The list to base the iterator on */
-    private List list;
+    private List<E> list;
     /** The current list iterator */
-    private ListIterator iterator;
+    private ListIterator<E> iterator;
 
     /**
      * Constructor that wraps a list.
@@ -56,7 +56,7 @@ public class LoopingListIterator implements ResettableListIterator {
      * @param list the list to wrap
      * @throws NullPointerException if the list it null
      */
-    public LoopingListIterator(List list) {
+    public LoopingListIterator(List<E> list) {
         if (list == null) {
             throw new NullPointerException("The list must not be null");
         }
@@ -84,7 +84,7 @@ public class LoopingListIterator implements ResettableListIterator {
      * @return the object after the last element returned
      * @throws NoSuchElementException if there are no elements in the list
      */
-    public Object next() {
+    public E next() {
         if (list.isEmpty()) {
             throw new NoSuchElementException(
                 "There are no elements for this iterator to loop on");
@@ -113,9 +113,8 @@ public class LoopingListIterator implements ResettableListIterator {
         }
         if (iterator.hasNext() == false) {
             return 0;
-        } else {
-            return iterator.nextIndex();
         }
+        return iterator.nextIndex();
     }
 
     /**
@@ -139,21 +138,20 @@ public class LoopingListIterator implements ResettableListIterator {
      * @return the object before the last element returned
      * @throws NoSuchElementException if there are no elements in the list
      */
-    public Object previous() {
+    public E previous() {
         if (list.isEmpty()) {
             throw new NoSuchElementException(
                 "There are no elements for this iterator to loop on");
         }
         if (iterator.hasPrevious() == false) {
-            Object result = null;
+            E result = null;
             while (iterator.hasNext()) {
                 result = iterator.next();
             }
             iterator.previous();
             return result;
-        } else {
-            return iterator.previous();
         }
+        return iterator.previous();
     }
 
     /**
@@ -174,9 +172,8 @@ public class LoopingListIterator implements ResettableListIterator {
         }
         if (iterator.hasPrevious() == false) {
             return list.size() - 1;
-        } else {
-            return iterator.previousIndex();
         }
+        return iterator.previousIndex();
     }
 
     /**
@@ -216,7 +213,7 @@ public class LoopingListIterator implements ResettableListIterator {
      * @throws UnsupportedOperationException if the add method is not
      *  supported by the iterator implementation of the underlying list
      */
-    public void add(Object obj) {
+    public void add(E obj) {
         iterator.add(obj);
     }
 
@@ -232,7 +229,7 @@ public class LoopingListIterator implements ResettableListIterator {
      * @throws UnsupportedOperationException if the set method is not
      *  supported by the iterator implementation of the underlying list
      */
-    public void set(Object obj) {
+    public void set(E obj) {
         iterator.set(obj);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/ObjectArrayIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/ObjectArrayIterator.java b/src/java/org/apache/commons/collections/iterators/ObjectArrayIterator.java
index 73e7dfb..378e772 100644
--- a/src/java/org/apache/commons/collections/iterators/ObjectArrayIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/ObjectArrayIterator.java
@@ -40,11 +40,11 @@ import org.apache.commons.collections.ResettableIterator;
  * @author Stephen Colebourne
  * @author Phil Steitz
  */
-public class ObjectArrayIterator
-        implements Iterator, ResettableIterator {
+public class ObjectArrayIterator<E>
+        implements Iterator<E>, ResettableIterator<E> {
 
     /** The array */
-    protected Object[] array = null;
+    protected E[] array = null;
     /** The start index to loop from */
     protected int startIndex = 0;
     /** The end index to loop to */
@@ -69,7 +69,7 @@ public class ObjectArrayIterator
      * @param array the array to iterate over
      * @throws NullPointerException if <code>array</code> is <code>null</code>
      */
-    public ObjectArrayIterator(Object[] array) {
+    public ObjectArrayIterator(E[] array) {
         this(array, 0, array.length);
     }
 
@@ -82,7 +82,7 @@ public class ObjectArrayIterator
      * @throws NullPointerException if <code>array</code> is <code>null</code>
      * @throws IndexOutOfBoundsException if the start index is out of bounds
      */
-    public ObjectArrayIterator(Object array[], int start) {
+    public ObjectArrayIterator(E array[], int start) {
         this(array, start, array.length);
     }
 
@@ -97,7 +97,7 @@ public class ObjectArrayIterator
      * @throws IllegalArgumentException if end index is before the start
      * @throws NullPointerException if <code>array</code> is <code>null</code>
      */
-    public ObjectArrayIterator(Object array[], int start, int end) {
+    public ObjectArrayIterator(E array[], int start, int end) {
         super();
         if (start < 0) {
             throw new ArrayIndexOutOfBoundsException("Start index must not be less than zero");
@@ -136,7 +136,7 @@ public class ObjectArrayIterator
      * @throws NoSuchElementException if all the elements in the array
      *    have already been returned
      */
-    public Object next() {
+    public E next() {
         if (hasNext() == false) {
             throw new NoSuchElementException();
         }
@@ -162,7 +162,7 @@ public class ObjectArrayIterator
      * the no-arg constructor was used and {@link #setArray} has never
      * been called with a valid array.
      */
-    public Object[] getArray() {
+    public E[] getArray() {
         return this.array;
     }
 
@@ -178,7 +178,7 @@ public class ObjectArrayIterator
      * @throws IllegalStateException if the <code>array</code> was set in the constructor
      * @throws NullPointerException if <code>array</code> is <code>null</code>
      */
-    public void setArray(Object[] array) {
+    public void setArray(E[] array) {
         if (this.array != null) {
             throw new IllegalStateException("The array to iterate over has already been set");
         }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java b/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java
index 4208886..113fba6 100644
--- a/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java
@@ -41,8 +41,8 @@ import org.apache.commons.collections.ResettableListIterator;
  * @author Stephen Colebourne
  * @author Phil Steitz
  */
-public class ObjectArrayListIterator extends ObjectArrayIterator
-		implements ListIterator, ResettableListIterator {
+public class ObjectArrayListIterator<E> extends ObjectArrayIterator<E>
+		implements ListIterator<E>, ResettableListIterator<E> {
 
     /**
      * Holds the index of the last item returned by a call to <code>next()</code> 
@@ -69,7 +69,7 @@ public class ObjectArrayListIterator extends ObjectArrayIterator
      * @param array the array to iterate over
      * @throws NullPointerException if <code>array</code> is <code>null</code>
      */
-    public ObjectArrayListIterator(Object[] array) {
+    public ObjectArrayListIterator(E[] array) {
         super(array);
     }
 
@@ -82,7 +82,7 @@ public class ObjectArrayListIterator extends ObjectArrayIterator
      * @throws NullPointerException if <code>array</code> is <code>null</code>
      * @throws IndexOutOfBoundsException if the start index is out of bounds
      */
-    public ObjectArrayListIterator(Object[] array, int start) {
+    public ObjectArrayListIterator(E[] array, int start) {
         super(array, start);
     }
     
@@ -97,7 +97,7 @@ public class ObjectArrayListIterator extends ObjectArrayIterator
      * @throws IllegalArgumentException if end index is before the start
      * @throws NullPointerException if <code>array</code> is <code>null</code>
      */
-    public ObjectArrayListIterator(Object[] array, int start, int end) {
+    public ObjectArrayListIterator(E[] array, int start, int end) {
         super(array, start, end);
     }
 
@@ -119,7 +119,7 @@ public class ObjectArrayListIterator extends ObjectArrayIterator
      * @return the previous element
      * @throws NoSuchElementException if there is no previous element
      */
-    public Object previous() {
+    public E previous() {
         if (hasPrevious() == false) {
             throw new NoSuchElementException();
         }
@@ -133,7 +133,7 @@ public class ObjectArrayListIterator extends ObjectArrayIterator
      * @return the next element
      * @throws NoSuchElementException if there is no next element
      */
-    public Object next() {
+    public E next() {
         if (hasNext() == false) {
             throw new NoSuchElementException();
         }
@@ -166,7 +166,7 @@ public class ObjectArrayListIterator extends ObjectArrayIterator
      * @param obj  the object to add
      * @throws UnsupportedOperationException always thrown.
      */
-    public void add(Object obj) {
+    public void add(E obj) {
         throw new UnsupportedOperationException("add() method is not supported");
     }
 
@@ -187,7 +187,7 @@ public class ObjectArrayListIterator extends ObjectArrayIterator
      * @throws IllegalStateException if next() has not yet been called.
      * @throws ClassCastException if the object type is unsuitable for the array
      */
-    public void set(Object obj) {
+    public void set(E obj) {
         if (this.lastItemIndex == -1) {
             throw new IllegalStateException("must call next() or previous() before a call to set()");
         }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/ObjectGraphIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/ObjectGraphIterator.java b/src/java/org/apache/commons/collections/iterators/ObjectGraphIterator.java
index 45d73b0..a43a876 100644
--- a/src/java/org/apache/commons/collections/iterators/ObjectGraphIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/ObjectGraphIterator.java
@@ -75,23 +75,23 @@ import org.apache.commons.collections.Transformer;
  * 
  * @author Stephen Colebourne
  */
-public class ObjectGraphIterator implements Iterator {
+public class ObjectGraphIterator<E> implements Iterator<E> {
 
     /** The stack of iterators */
-    protected final ArrayStack stack = new ArrayStack(8);
+    protected final ArrayStack<Iterator<? extends E>> stack = new ArrayStack<Iterator<? extends E>>(8);
 	/** The root object in the tree */
-    protected Object root;
+    protected E root;
     /** The transformer to use */
-    protected Transformer transformer;
+    protected Transformer<? super E, ? extends E> transformer;
 
     /** Whether there is another element in the iteration */
-    protected boolean hasNext = false;    
+    protected boolean hasNext = false;
     /** The current iterator */
-    protected Iterator currentIterator;
+    protected Iterator<? extends E> currentIterator;
     /** The current value */
-    protected Object currentValue;
+    protected E currentValue;
     /** The last used iterator, needed for remove() */
-    protected Iterator lastUsedIterator;
+    protected Iterator<? extends E> lastUsedIterator;
 
     //-----------------------------------------------------------------------
     /**
@@ -103,10 +103,11 @@ public class ObjectGraphIterator implements Iterator {
      * @param root  the root object, null will result in an empty iterator
      * @param transformer  the transformer to use, null will use a no effect transformer
      */
-    public ObjectGraphIterator(Object root, Transformer transformer) {
+    @SuppressWarnings("unchecked")
+    public ObjectGraphIterator(E root, Transformer<? super E, ? extends E> transformer) {
         super();
         if (root instanceof Iterator) {
-            this.currentIterator = (Iterator) root;
+            this.currentIterator = (Iterator<? extends E>) root;
         } else {
             this.root = root;
         }
@@ -123,7 +124,7 @@ public class ObjectGraphIterator implements Iterator {
      * 
      * @param rootIterator  the root iterator, null will result in an empty iterator
      */
-    public ObjectGraphIterator(Iterator rootIterator) {
+    public ObjectGraphIterator(Iterator<? extends E> rootIterator) {
         super();
         this.currentIterator = rootIterator;
         this.transformer = null;
@@ -158,10 +159,11 @@ public class ObjectGraphIterator implements Iterator {
      * 
      * @param value  the value to start from
      */
-    protected void findNext(Object value) {
+    @SuppressWarnings("unchecked")
+    protected void findNext(E value) {
         if (value instanceof Iterator) {
             // need to examine this iterator
-            findNextByIterator((Iterator) value);
+            findNextByIterator((Iterator<? extends E>) value);
         } else {
             // next value found
             currentValue = value;
@@ -174,7 +176,7 @@ public class ObjectGraphIterator implements Iterator {
      * 
      * @param iterator  the iterator to start from
      */
-    protected void findNextByIterator(Iterator iterator) {
+    protected void findNextByIterator(Iterator<? extends E> iterator) {
         if (iterator != currentIterator) {
             // recurse a level
             if (currentIterator != null) {
@@ -184,7 +186,7 @@ public class ObjectGraphIterator implements Iterator {
         }
         
         while (currentIterator.hasNext() && hasNext == false) {
-            Object next = currentIterator.next();
+            E next = currentIterator.next();
             if (transformer != null) {
                 next = transformer.transform(next);
             }
@@ -196,7 +198,7 @@ public class ObjectGraphIterator implements Iterator {
             // all iterators exhausted
         } else {
             // current iterator exhausted, go up a level
-            currentIterator = (Iterator) stack.pop();
+            currentIterator = (Iterator<? extends E>) stack.pop();
             findNextByIterator(currentIterator);
         }
     }
@@ -218,13 +220,13 @@ public class ObjectGraphIterator implements Iterator {
      * @return the next element from the iteration
      * @throws NoSuchElementException if all the Iterators are exhausted
      */
-    public Object next() {
+    public E next() {
         updateCurrentIterator();
         if (hasNext == false) {
             throw new NoSuchElementException("No more elements in the iteration");
         }
         lastUsedIterator = currentIterator;
-        Object result = currentValue;
+        E result = currentValue;
         currentValue = null;
         hasNext = false;
         return result;

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/ReverseListIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/ReverseListIterator.java b/src/java/org/apache/commons/collections/iterators/ReverseListIterator.java
index 16c7f84..6552676 100644
--- a/src/java/org/apache/commons/collections/iterators/ReverseListIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/ReverseListIterator.java
@@ -38,12 +38,12 @@ import org.apache.commons.collections.ResettableListIterator;
  * @since Commons Collections 3.2
  * @version $Revision: $ $Date$
  */
-public class ReverseListIterator implements ResettableListIterator {
+public class ReverseListIterator<E> implements ResettableListIterator<E> {
 
     /** The list being wrapped. */
-    private final List list;
+    private final List<E> list;
     /** The list iterator being wrapped. */
-    private ListIterator iterator;
+    private ListIterator<E> iterator;
     /** Flag to indicate if updating is possible at the moment. */
     private boolean validForUpdate = true;
 
@@ -53,7 +53,7 @@ public class ReverseListIterator implements ResettableListIterator {
      * @param list  the list to create a reversed iterator for
      * @throws NullPointerException if the list is null
      */
-    public ReverseListIterator(List list) {
+    public ReverseListIterator(List<E> list) {
         super();
         this.list = list;
         iterator = list.listIterator(list.size());
@@ -75,8 +75,8 @@ public class ReverseListIterator implements ResettableListIterator {
      *
      * @return the next element in the iterator
      */
-    public Object next() {
-        Object obj = iterator.previous();
+    public E next() {
+        E obj = iterator.previous();
         validForUpdate = true;
         return obj;
     }
@@ -105,8 +105,8 @@ public class ReverseListIterator implements ResettableListIterator {
      *
      * @return the previous element in the iterator
      */
-    public Object previous() {
-        Object obj = iterator.next();
+    public E previous() {
+        E obj = iterator.next();
         validForUpdate = true;
         return obj;
     }
@@ -140,7 +140,7 @@ public class ReverseListIterator implements ResettableListIterator {
      * @throws UnsupportedOperationException if the list is unmodifiable
      * @throws IllegalStateException if the iterator is not in a valid state for set
      */
-    public void set(Object obj) {
+    public void set(E obj) {
         if (validForUpdate == false) {
             throw new IllegalStateException("Cannot set to list until next() or previous() called");
         }
@@ -154,7 +154,7 @@ public class ReverseListIterator implements ResettableListIterator {
      * @throws UnsupportedOperationException if the list is unmodifiable
      * @throws IllegalStateException if the iterator is not in a valid state for set
      */
-    public void add(Object obj) {
+    public void add(E obj) {
         // the validForUpdate flag is needed as the necessary previous()
         // method call re-enables remove and add
         if (validForUpdate == false) {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/SingletonIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/SingletonIterator.java b/src/java/org/apache/commons/collections/iterators/SingletonIterator.java
index 2e4da6c..a1b8c31 100644
--- a/src/java/org/apache/commons/collections/iterators/SingletonIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/SingletonIterator.java
@@ -32,8 +32,8 @@ import org.apache.commons.collections.ResettableIterator;
  * @author Stephen Colebourne
  * @author Rodney Waldhoff
  */
-public class SingletonIterator
-		implements Iterator, ResettableIterator {
+public class SingletonIterator<E>
+		implements Iterator<E>, ResettableIterator<E> {
 
     /** Whether remove is allowed */
     private final boolean removeAllowed;
@@ -42,7 +42,7 @@ public class SingletonIterator
     /** Has the element been removed */
     private boolean removed = false;
     /** The object */
-    private Object object;
+    private E object;
 
     /**
      * Constructs a new <code>SingletonIterator</code> where <code>remove</code>
@@ -50,7 +50,7 @@ public class SingletonIterator
      *
      * @param object  the single object to return from the iterator
      */
-    public SingletonIterator(Object object) {
+    public SingletonIterator(E object) {
         this(object, true);
     }
 
@@ -62,7 +62,7 @@ public class SingletonIterator
      * @param removeAllowed  true if remove is allowed
      * @since Commons Collections 3.1
      */
-    public SingletonIterator(Object object, boolean removeAllowed) {
+    public SingletonIterator(E object, boolean removeAllowed) {
         super();
         this.object = object;
         this.removeAllowed = removeAllowed;
@@ -89,7 +89,7 @@ public class SingletonIterator
      * @throws NoSuchElementException if the single object has already 
      *    been returned
      */
-    public Object next() {
+    public E next() {
         if (!beforeFirst || removed) {
             throw new NoSuchElementException();
         }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/SingletonListIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/SingletonListIterator.java b/src/java/org/apache/commons/collections/iterators/SingletonListIterator.java
index 25b9171..73fc9fd 100644
--- a/src/java/org/apache/commons/collections/iterators/SingletonListIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/SingletonListIterator.java
@@ -31,19 +31,19 @@ import org.apache.commons.collections.ResettableListIterator;
  * @author Stephen Colebourne
  * @author Rodney Waldhoff
  */
-public class SingletonListIterator implements ListIterator, ResettableListIterator {
+public class SingletonListIterator<E> implements ListIterator<E>, ResettableListIterator<E> {
 
     private boolean beforeFirst = true;
     private boolean nextCalled = false;
     private boolean removed = false;
-    private Object object;
+    private E object;
 
     /**
      * Constructs a new <code>SingletonListIterator</code>.
      *
      * @param object  the single object to return from the iterator
      */
-    public SingletonListIterator(Object object) {
+    public SingletonListIterator(E object) {
         super();
         this.object = object;
     }
@@ -100,7 +100,7 @@ public class SingletonListIterator implements ListIterator, ResettableListIterat
      * @throws NoSuchElementException if the single object has already 
      *    been returned
      */
-    public Object next() {
+    public E next() {
         if (!beforeFirst || removed) {
             throw new NoSuchElementException();
         }
@@ -118,7 +118,7 @@ public class SingletonListIterator implements ListIterator, ResettableListIterat
      * @throws NoSuchElementException if the single object has not already 
      *    been returned
      */
-    public Object previous() {
+    public E previous() {
         if (beforeFirst || removed) {
             throw new NoSuchElementException();
         }
@@ -147,7 +147,7 @@ public class SingletonListIterator implements ListIterator, ResettableListIterat
      *
      * @throws UnsupportedOperationException always
      */
-    public void add(Object obj) {
+    public void add(E obj) {
         throw new UnsupportedOperationException("add() is not supported by this iterator");
     }
     
@@ -158,7 +158,7 @@ public class SingletonListIterator implements ListIterator, ResettableListIterat
      * @throws IllegalStateException if <tt>next</tt> has not been called 
      *          or the object has been removed
      */
-    public void set(Object obj) {
+    public void set(E obj) {
         if (!nextCalled || removed) {
             throw new IllegalStateException();
         }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/TransformIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/TransformIterator.java b/src/java/org/apache/commons/collections/iterators/TransformIterator.java
index fc23b59..1546719 100644
--- a/src/java/org/apache/commons/collections/iterators/TransformIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/TransformIterator.java
@@ -29,18 +29,18 @@ import org.apache.commons.collections.Transformer;
  * @author James Strachan
  * @author Stephen Colebourne
  */
-public class TransformIterator implements Iterator {
+public class TransformIterator<I, O> implements Iterator<O> {
 
     /** The iterator being used */
-    private Iterator iterator;
+    private Iterator<? extends I> iterator;
     /** The transformer being used */
-    private Transformer transformer;
+    private Transformer<? super I, ? extends O> transformer;
 
     //-----------------------------------------------------------------------
     /**
      * Constructs a new <code>TransformIterator</code> that will not function
-     * until the {@link #setIterator(Iterator) setIterator} method is 
-     * invoked.
+     * until the {@link #setIterator(Iterator) setIterator} and 
+     * {@link #setTransformer(Transformer)} methods are invoked.
      */
     public TransformIterator() {
         super();
@@ -52,7 +52,7 @@ public class TransformIterator implements Iterator {
      *
      * @param iterator  the iterator to use
      */
-    public TransformIterator(Iterator iterator) {
+    public TransformIterator(Iterator<? extends I> iterator) {
         super();
         this.iterator = iterator;
     }
@@ -65,7 +65,7 @@ public class TransformIterator implements Iterator {
      * @param iterator  the iterator to use
      * @param transformer  the transformer to use
      */
-    public TransformIterator(Iterator iterator, Transformer transformer) {
+    public TransformIterator(Iterator<? extends I> iterator, Transformer<? super I, ? extends O> transformer) {
         super();
         this.iterator = iterator;
         this.transformer = transformer;
@@ -84,7 +84,7 @@ public class TransformIterator implements Iterator {
      * @return the next object
      * @throws java.util.NoSuchElementException if there are no more elements
      */
-    public Object next() {
+    public O next() {
         return transform(iterator.next());
     }
 
@@ -98,7 +98,7 @@ public class TransformIterator implements Iterator {
      * 
      * @return the iterator.
      */
-    public Iterator getIterator() {
+    public Iterator<? extends I> getIterator() {
         return iterator;
     }
 
@@ -108,7 +108,7 @@ public class TransformIterator implements Iterator {
      * 
      * @param iterator  the iterator to use
      */
-    public void setIterator(Iterator iterator) {
+    public void setIterator(Iterator<? extends I> iterator) {
         this.iterator = iterator;
     }
 
@@ -118,7 +118,7 @@ public class TransformIterator implements Iterator {
      * 
      * @return the transformer.
      */
-    public Transformer getTransformer() {
+    public Transformer<? super I, ? extends O> getTransformer() {
         return transformer;
     }
 
@@ -128,7 +128,7 @@ public class TransformIterator implements Iterator {
      * 
      * @param transformer  the transformer to use
      */
-    public void setTransformer(Transformer transformer) {
+    public void setTransformer(Transformer<? super I, ? extends O> transformer) {
         this.transformer = transformer;
     }
 
@@ -140,10 +140,7 @@ public class TransformIterator implements Iterator {
      * @param source  the object to transform
      * @return the transformed object
      */
-    protected Object transform(Object source) {
-        if (transformer != null) {
-            return transformer.transform(source);
-        }
-        return source;
+    protected O transform(I source) {
+        return transformer.transform(source);
     }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/UniqueFilterIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/UniqueFilterIterator.java b/src/java/org/apache/commons/collections/iterators/UniqueFilterIterator.java
index 41e20b5..64a4b54 100644
--- a/src/java/org/apache/commons/collections/iterators/UniqueFilterIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/UniqueFilterIterator.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.
@@ -20,26 +20,26 @@ import java.util.Iterator;
 
 import org.apache.commons.collections.functors.UniquePredicate;
 
-/** 
+/**
  * A FilterIterator which only returns "unique" Objects.  Internally,
  * the Iterator maintains a Set of objects it has already encountered,
  * and duplicate Objects are skipped.
  *
  * @since Commons Collections 2.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Morgan Delagrange
  */
-public class UniqueFilterIterator extends FilterIterator {
-       
+public class UniqueFilterIterator<E> extends FilterIterator<E> {
+
     //-------------------------------------------------------------------------
-    
+
     /**
      *  Constructs a new <code>UniqueFilterIterator</code>.
      *
      *  @param iterator  the iterator to use
      */
-    public UniqueFilterIterator( Iterator iterator ) {
+    public UniqueFilterIterator(Iterator<E> iterator) {
         super(iterator, UniquePredicate.getInstance());
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/UnmodifiableIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/UnmodifiableIterator.java b/src/java/org/apache/commons/collections/iterators/UnmodifiableIterator.java
index 5fa3e2b..3cff73c 100644
--- a/src/java/org/apache/commons/collections/iterators/UnmodifiableIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/UnmodifiableIterator.java
@@ -28,10 +28,10 @@ import org.apache.commons.collections.Unmodifiable;
  * 
  * @author Stephen Colebourne
  */
-public final class UnmodifiableIterator implements Iterator, Unmodifiable {
+public final class UnmodifiableIterator<E> implements Iterator<E>, Unmodifiable {
 
     /** The iterator being decorated */
-    private Iterator iterator;
+    private Iterator<E> iterator;
 
     //-----------------------------------------------------------------------
     /**
@@ -42,23 +42,23 @@ public final class UnmodifiableIterator implements Iterator, Unmodifiable {
      * @param iterator  the iterator to decorate
      * @throws IllegalArgumentException if the iterator is null
      */
-    public static Iterator decorate(Iterator iterator) {
+    public static <E> Iterator<E> decorate(Iterator<E> iterator) {
         if (iterator == null) {
             throw new IllegalArgumentException("Iterator must not be null");
         }
         if (iterator instanceof Unmodifiable) {
             return iterator;
         }
-        return new UnmodifiableIterator(iterator);
+        return new UnmodifiableIterator<E>(iterator);
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Constructor.
      *
      * @param iterator  the iterator to decorate
      */
-    private UnmodifiableIterator(Iterator iterator) {
+    private UnmodifiableIterator(Iterator<E> iterator) {
         super();
         this.iterator = iterator;
     }
@@ -68,7 +68,7 @@ public final class UnmodifiableIterator implements Iterator, Unmodifiable {
         return iterator.hasNext();
     }
 
-    public Object next() {
+    public E next() {
         return iterator.next();
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/UnmodifiableListIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/UnmodifiableListIterator.java b/src/java/org/apache/commons/collections/iterators/UnmodifiableListIterator.java
index cb8cc3d..a2bafe1 100644
--- a/src/java/org/apache/commons/collections/iterators/UnmodifiableListIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/UnmodifiableListIterator.java
@@ -28,10 +28,10 @@ import org.apache.commons.collections.Unmodifiable;
  * 
  * @author Stephen Colebourne
  */
-public final class UnmodifiableListIterator implements ListIterator, Unmodifiable {
+public final class UnmodifiableListIterator<E> implements ListIterator<E>, Unmodifiable {
 
     /** The iterator being decorated */
-    private ListIterator iterator;
+    private ListIterator<E> iterator;
 
     //-----------------------------------------------------------------------
     /**
@@ -40,14 +40,14 @@ public final class UnmodifiableListIterator implements ListIterator, Unmodifiabl
      * @param iterator  the iterator to decorate
      * @throws IllegalArgumentException if the iterator is null
      */
-    public static ListIterator decorate(ListIterator iterator) {
+    public static <E> ListIterator<E> decorate(ListIterator<E> iterator) {
         if (iterator == null) {
             throw new IllegalArgumentException("ListIterator must not be null");
         }
         if (iterator instanceof Unmodifiable) {
             return iterator;
         }
-        return new UnmodifiableListIterator(iterator);
+        return new UnmodifiableListIterator<E>(iterator);
     }
     
     //-----------------------------------------------------------------------
@@ -56,7 +56,7 @@ public final class UnmodifiableListIterator implements ListIterator, Unmodifiabl
      *
      * @param iterator  the iterator to decorate
      */
-    private UnmodifiableListIterator(ListIterator iterator) {
+    private UnmodifiableListIterator(ListIterator<E> iterator) {
         super();
         this.iterator = iterator;
     }
@@ -66,7 +66,7 @@ public final class UnmodifiableListIterator implements ListIterator, Unmodifiabl
         return iterator.hasNext();
     }
 
-    public Object next() {
+    public E next() {
         return iterator.next();
     }
 
@@ -78,7 +78,7 @@ public final class UnmodifiableListIterator implements ListIterator, Unmodifiabl
         return iterator.hasPrevious();
     }
 
-    public Object previous() {
+    public E previous() {
         return iterator.previous();
     }
 
@@ -90,11 +90,11 @@ public final class UnmodifiableListIterator implements ListIterator, Unmodifiabl
         throw new UnsupportedOperationException("remove() is not supported");
     }
 
-    public void set(Object obj) {
+    public void set(E obj) {
         throw new UnsupportedOperationException("set() is not supported");
     }
 
-    public void add(Object obj) {
+    public void add(E obj) {
         throw new UnsupportedOperationException("add() is not supported");
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/UnmodifiableMapIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/UnmodifiableMapIterator.java b/src/java/org/apache/commons/collections/iterators/UnmodifiableMapIterator.java
index 0c4144d..9c1905f 100644
--- a/src/java/org/apache/commons/collections/iterators/UnmodifiableMapIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/UnmodifiableMapIterator.java
@@ -27,10 +27,10 @@ import org.apache.commons.collections.Unmodifiable;
  * 
  * @author Stephen Colebourne
  */
-public final class UnmodifiableMapIterator implements MapIterator, Unmodifiable {
+public final class UnmodifiableMapIterator<K, V> implements MapIterator<K, V>, Unmodifiable {
 
     /** The iterator being decorated */
-    private MapIterator iterator;
+    private MapIterator<K, V> iterator;
 
     //-----------------------------------------------------------------------
     /**
@@ -39,23 +39,23 @@ public final class UnmodifiableMapIterator implements MapIterator, Unmodifiable
      * @param iterator  the iterator to decorate
      * @throws IllegalArgumentException if the iterator is null
      */
-    public static MapIterator decorate(MapIterator iterator) {
+    public static <K, V> MapIterator<K, V> decorate(MapIterator<K, V> iterator) {
         if (iterator == null) {
             throw new IllegalArgumentException("MapIterator must not be null");
         }
         if (iterator instanceof Unmodifiable) {
             return iterator;
         }
-        return new UnmodifiableMapIterator(iterator);
+        return new UnmodifiableMapIterator<K, V>(iterator);
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Constructor.
      *
      * @param iterator  the iterator to decorate
      */
-    private UnmodifiableMapIterator(MapIterator iterator) {
+    private UnmodifiableMapIterator(MapIterator<K, V> iterator) {
         super();
         this.iterator = iterator;
     }
@@ -65,19 +65,19 @@ public final class UnmodifiableMapIterator implements MapIterator, Unmodifiable
         return iterator.hasNext();
     }
 
-    public Object next() {
+    public K next() {
         return iterator.next();
     }
 
-    public Object getKey() {
+    public K getKey() {
         return iterator.getKey();
     }
 
-    public Object getValue() {
+    public V getValue() {
         return iterator.getValue();
     }
 
-    public Object setValue(Object value) {
+    public V setValue(V value) {
         throw new UnsupportedOperationException("setValue() is not supported");
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/iterators/UnmodifiableOrderedMapIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/UnmodifiableOrderedMapIterator.java b/src/java/org/apache/commons/collections/iterators/UnmodifiableOrderedMapIterator.java
index 6cf2339..c8eb884 100644
--- a/src/java/org/apache/commons/collections/iterators/UnmodifiableOrderedMapIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/UnmodifiableOrderedMapIterator.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.
@@ -19,18 +19,19 @@ package org.apache.commons.collections.iterators;
 import org.apache.commons.collections.OrderedMapIterator;
 import org.apache.commons.collections.Unmodifiable;
 
-/** 
+/**
  * Decorates an ordered map iterator such that it cannot be modified.
  *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  */
-public final class UnmodifiableOrderedMapIterator implements OrderedMapIterator, Unmodifiable {
+public final class UnmodifiableOrderedMapIterator<K, V> implements OrderedMapIterator<K, V>,
+        Unmodifiable {
 
     /** The iterator being decorated */
-    private OrderedMapIterator iterator;
+    private OrderedMapIterator<K, V> iterator;
 
     //-----------------------------------------------------------------------
     /**
@@ -39,23 +40,23 @@ public final class UnmodifiableOrderedMapIterator implements OrderedMapIterator,
      * @param iterator  the iterator to decorate
      * @throws IllegalArgumentException if the iterator is null
      */
-    public static OrderedMapIterator decorate(OrderedMapIterator iterator) {
+    public static <K, V> OrderedMapIterator<K, V> decorate(OrderedMapIterator<K, V> iterator) {
         if (iterator == null) {
             throw new IllegalArgumentException("OrderedMapIterator must not be null");
         }
         if (iterator instanceof Unmodifiable) {
             return iterator;
         }
-        return new UnmodifiableOrderedMapIterator(iterator);
+        return new UnmodifiableOrderedMapIterator<K, V>(iterator);
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Constructor.
      *
      * @param iterator  the iterator to decorate
      */
-    private UnmodifiableOrderedMapIterator(OrderedMapIterator iterator) {
+    private UnmodifiableOrderedMapIterator(OrderedMapIterator<K, V> iterator) {
         super();
         this.iterator = iterator;
     }
@@ -65,7 +66,7 @@ public final class UnmodifiableOrderedMapIterator implements OrderedMapIterator,
         return iterator.hasNext();
     }
 
-    public Object next() {
+    public K next() {
         return iterator.next();
     }
 
@@ -73,19 +74,19 @@ public final class UnmodifiableOrderedMapIterator implements OrderedMapIterator,
         return iterator.hasPrevious();
     }
 
-    public Object previous() {
+    public K previous() {
         return iterator.previous();
     }
 
-    public Object getKey() {
+    public K getKey() {
         return iterator.getKey();
     }
 
-    public Object getValue() {
+    public V getValue() {
         return iterator.getValue();
     }
 
-    public Object setValue(Object value) {
+    public V setValue(V value) {
         throw new UnsupportedOperationException("setValue() is not supported");
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/keyvalue/AbstractKeyValue.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/keyvalue/AbstractKeyValue.java b/src/java/org/apache/commons/collections/keyvalue/AbstractKeyValue.java
index a4a02bc..61f46db 100644
--- a/src/java/org/apache/commons/collections/keyvalue/AbstractKeyValue.java
+++ b/src/java/org/apache/commons/collections/keyvalue/AbstractKeyValue.java
@@ -30,12 +30,12 @@ import org.apache.commons.collections.KeyValue;
  * @author Neil O'Toole
  * @author Stephen Colebourne
  */
-public abstract class AbstractKeyValue implements KeyValue {
+public abstract class AbstractKeyValue<K, V> implements KeyValue<K, V> {
 
     /** The key */
-    protected Object key;
+    protected K key;
     /** The value */
-    protected Object value;
+    protected V value;
 
     /**
      * Constructs a new pair with the specified key and given value.
@@ -43,7 +43,7 @@ public abstract class AbstractKeyValue implements KeyValue {
      * @param key  the key for the entry, may be null
      * @param value  the value for the entry, may be null
      */
-    protected AbstractKeyValue(Object key, Object value) {
+    protected AbstractKeyValue(K key, V value) {
         super();
         this.key = key;
         this.value = value;
@@ -54,7 +54,7 @@ public abstract class AbstractKeyValue implements KeyValue {
      *
      * @return the key 
      */
-    public Object getKey() {
+    public K getKey() {
         return key;
     }
 
@@ -63,7 +63,7 @@ public abstract class AbstractKeyValue implements KeyValue {
      *
      * @return the value
      */
-    public Object getValue() {
+    public V getValue() {
         return value;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntry.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntry.java b/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntry.java
index 62cb53c..16967aa 100644
--- a/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntry.java
+++ b/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntry.java
@@ -30,7 +30,7 @@ import java.util.Map;
  * @author Neil O'Toole
  * @author Stephen Colebourne
  */
-public abstract class AbstractMapEntry extends AbstractKeyValue implements Map.Entry {
+public abstract class AbstractMapEntry<K, V> extends AbstractKeyValue<K, V> implements Map.Entry<K, V> {
 
     /**
      * Constructs a new entry with the given key and given value.
@@ -38,7 +38,7 @@ public abstract class AbstractMapEntry extends AbstractKeyValue implements Map.E
      * @param key  the key for the entry, may be null
      * @param value  the value for the entry, may be null
      */
-    protected AbstractMapEntry(Object key, Object value) {
+    protected AbstractMapEntry(K key, V value) {
         super(key, value);
     }
 
@@ -53,8 +53,8 @@ public abstract class AbstractMapEntry extends AbstractKeyValue implements Map.E
      * @param value  the new value
      * @return the previous value
      */
-    public Object setValue(Object value) {
-        Object answer = this.value;
+    public V setValue(V value) {
+        V answer = this.value;
         this.value = value;
         return answer;
     }
@@ -67,6 +67,7 @@ public abstract class AbstractMapEntry extends AbstractKeyValue implements Map.E
      * @param obj  the object to compare to
      * @return true if equal key and value
      */
+    @SuppressWarnings("unchecked")
     public boolean equals(Object obj) {
         if (obj == this) {
             return true;

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntryDecorator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntryDecorator.java b/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntryDecorator.java
index c8f904d..0acd80e 100644
--- a/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntryDecorator.java
+++ b/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntryDecorator.java
@@ -29,10 +29,10 @@ import org.apache.commons.collections.KeyValue;
  * 
  * @author Stephen Colebourne
  */
-public abstract class AbstractMapEntryDecorator implements Map.Entry, KeyValue {
+public abstract class AbstractMapEntryDecorator<K, V> implements Map.Entry<K, V>, KeyValue<K, V> {
     
     /** The <code>Map.Entry</code> to decorate */
-    protected final Map.Entry entry;
+    protected final Map.Entry<K, V> entry;
 
     /**
      * Constructor that wraps (not copies).
@@ -40,7 +40,7 @@ public abstract class AbstractMapEntryDecorator implements Map.Entry, KeyValue {
      * @param entry  the <code>Map.Entry</code> to decorate, must not be null
      * @throws IllegalArgumentException if the collection is null
      */
-    public AbstractMapEntryDecorator(Map.Entry entry) {
+    public AbstractMapEntryDecorator(Map.Entry<K, V> entry) {
         if (entry == null) {
             throw new IllegalArgumentException("Map Entry must not be null");
         }
@@ -52,20 +52,20 @@ public abstract class AbstractMapEntryDecorator implements Map.Entry, KeyValue {
      * 
      * @return the decorated map
      */
-    protected Map.Entry getMapEntry() {
+    protected Map.Entry<K, V> getMapEntry() {
         return entry;
     }
 
     //-----------------------------------------------------------------------
-    public Object getKey() {
+    public K getKey() {
         return entry.getKey();
     }
 
-    public Object getValue() {
+    public V getValue() {
         return entry.getValue();
     }
 
-    public Object setValue(Object object) {
+    public V setValue(V object) {
         return entry.setValue(object);
     }
    

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/keyvalue/DefaultKeyValue.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/keyvalue/DefaultKeyValue.java b/src/java/org/apache/commons/collections/keyvalue/DefaultKeyValue.java
index e096532..e38df5d 100644
--- a/src/java/org/apache/commons/collections/keyvalue/DefaultKeyValue.java
+++ b/src/java/org/apache/commons/collections/keyvalue/DefaultKeyValue.java
@@ -35,7 +35,7 @@ import org.apache.commons.collections.KeyValue;
  * @author Neil O'Toole
  * @author Stephen Colebourne
  */
-public class DefaultKeyValue extends AbstractKeyValue {
+public class DefaultKeyValue<K, V> extends AbstractKeyValue<K, V> {
 
     /**
      * Constructs a new pair with a null key and null value.
@@ -50,7 +50,7 @@ public class DefaultKeyValue extends AbstractKeyValue {
      * @param key  the key for the entry, may be null
      * @param value  the value for the entry, may be null
      */
-    public DefaultKeyValue(final Object key, final Object value) {
+    public DefaultKeyValue(final K key, final V value) {
         super(key, value);
     }
 
@@ -60,7 +60,7 @@ public class DefaultKeyValue extends AbstractKeyValue {
      * @param pair  the pair to copy, must not be null
      * @throws NullPointerException if the entry is null
      */
-    public DefaultKeyValue(final KeyValue pair) {
+    public DefaultKeyValue(final KeyValue<K, V> pair) {
         super(pair.getKey(), pair.getValue());
     }
 
@@ -70,7 +70,7 @@ public class DefaultKeyValue extends AbstractKeyValue {
      * @param entry  the entry to copy, must not be null
      * @throws NullPointerException if the entry is null
      */
-    public DefaultKeyValue(final Map.Entry entry) {
+    public DefaultKeyValue(final Map.Entry<K, V> entry) {
         super(entry.getKey(), entry.getValue());
     }
 
@@ -82,12 +82,12 @@ public class DefaultKeyValue extends AbstractKeyValue {
      * @return the old key
      * @throws IllegalArgumentException if key is this object
      */
-    public Object setKey(final Object key) {
+    public K setKey(final K key) {
         if (key == this) {
             throw new IllegalArgumentException("DefaultKeyValue may not contain itself as a key.");
         }
 
-        final Object old = this.key;
+        final K old = this.key;
         this.key = key;
         return old;
     }
@@ -99,12 +99,12 @@ public class DefaultKeyValue extends AbstractKeyValue {
      * @param value the new value
      * @throws IllegalArgumentException if value is this object
      */
-    public Object setValue(final Object value) {
+    public V setValue(final V value) {
         if (value == this) {
             throw new IllegalArgumentException("DefaultKeyValue may not contain itself as a value.");
         }
 
-        final Object old = this.value;
+        final V old = this.value;
         this.value = value;
         return old;
     }
@@ -115,8 +115,8 @@ public class DefaultKeyValue extends AbstractKeyValue {
      * 
      * @return a MapEntry instance
      */
-    public Map.Entry toMapEntry() {
-        return new DefaultMapEntry(this);
+    public Map.Entry<K, V> toMapEntry() {
+        return new DefaultMapEntry<K, V>(this);
     }
 
     //-----------------------------------------------------------------------
@@ -129,6 +129,7 @@ public class DefaultKeyValue extends AbstractKeyValue {
      * @param obj  the object to compare to
      * @return true if equal key and value
      */
+    @SuppressWarnings("unchecked")
     public boolean equals(final Object obj) {
         if (obj == this) {
             return true;

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/keyvalue/DefaultMapEntry.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/keyvalue/DefaultMapEntry.java b/src/java/org/apache/commons/collections/keyvalue/DefaultMapEntry.java
index c92a1f6..8731b66 100644
--- a/src/java/org/apache/commons/collections/keyvalue/DefaultMapEntry.java
+++ b/src/java/org/apache/commons/collections/keyvalue/DefaultMapEntry.java
@@ -32,7 +32,7 @@ import org.apache.commons.collections.KeyValue;
  * @author Neil O'Toole
  * @author Stephen Colebourne
  */
-public final class DefaultMapEntry extends AbstractMapEntry {
+public final class DefaultMapEntry<K, V> extends AbstractMapEntry<K, V> {
 
     /**
      * Constructs a new entry with the specified key and given value.
@@ -40,7 +40,7 @@ public final class DefaultMapEntry extends AbstractMapEntry {
      * @param key  the key for the entry, may be null
      * @param value  the value for the entry, may be null
      */
-    public DefaultMapEntry(final Object key, final Object value) {
+    public DefaultMapEntry(final K key, final V value) {
         super(key, value);
     }
 
@@ -50,7 +50,7 @@ public final class DefaultMapEntry extends AbstractMapEntry {
      * @param pair  the pair to copy, must not be null
      * @throws NullPointerException if the entry is null
      */
-    public DefaultMapEntry(final KeyValue pair) {
+    public DefaultMapEntry(final KeyValue<K, V> pair) {
         super(pair.getKey(), pair.getValue());
     }
 
@@ -60,7 +60,7 @@ public final class DefaultMapEntry extends AbstractMapEntry {
      * @param entry  the entry to copy, must not be null
      * @throws NullPointerException if the entry is null
      */
-    public DefaultMapEntry(final Map.Entry entry) {
+    public DefaultMapEntry(final Map.Entry<K, V> entry) {
         super(entry.getKey(), entry.getValue());
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/java/org/apache/commons/collections/keyvalue/MultiKey.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/keyvalue/MultiKey.java b/src/java/org/apache/commons/collections/keyvalue/MultiKey.java
index f3f4cd7..c91047e 100644
--- a/src/java/org/apache/commons/collections/keyvalue/MultiKey.java
+++ b/src/java/org/apache/commons/collections/keyvalue/MultiKey.java
@@ -45,17 +45,17 @@ import java.util.Arrays;
  * @author Howard Lewis Ship
  * @author Stephen Colebourne
  */
-public class MultiKey implements Serializable {
+public class MultiKey<K> implements Serializable {
     // This class could implement List, but that would confuse it's purpose
 
     /** Serialisation version */
     private static final long serialVersionUID = 4465448607415788805L;
 
     /** The individual keys */
-    private final Object[] keys;
+    private final K[] keys;
     /** The cached hashCode */
     private final int hashCode;
-    
+
     /**
      * Constructor taking two keys.
      * <p>
@@ -65,10 +65,11 @@ public class MultiKey implements Serializable {
      * @param key1  the first key
      * @param key2  the second key
      */
-    public MultiKey(Object key1, Object key2) {
-        this(new Object[] {key1, key2}, false);
+    @SuppressWarnings("unchecked")
+    public MultiKey(K key1, K key2) {
+        this((K[]) new Object[] { key1, key2 }, false);
     }
-    
+
     /**
      * Constructor taking three keys.
      * <p>
@@ -79,10 +80,11 @@ public class MultiKey implements Serializable {
      * @param key2  the second key
      * @param key3  the third key
      */
-    public MultiKey(Object key1, Object key2, Object key3) {
-        this(new Object[] {key1, key2, key3}, false);
+    @SuppressWarnings("unchecked")
+    public MultiKey(K key1, K key2, K key3) {
+        this((K[]) new Object[] {key1, key2, key3}, false);
     }
-    
+
     /**
      * Constructor taking four keys.
      * <p>
@@ -94,10 +96,11 @@ public class MultiKey implements Serializable {
      * @param key3  the third key
      * @param key4  the fourth key
      */
-    public MultiKey(Object key1, Object key2, Object key3, Object key4) {
-        this(new Object[] {key1, key2, key3, key4}, false);
+    @SuppressWarnings("unchecked")
+    public MultiKey(K key1, K key2, K key3, K key4) {
+        this((K[]) new Object[] {key1, key2, key3, key4}, false);
     }
-    
+
     /**
      * Constructor taking five keys.
      * <p>
@@ -110,10 +113,11 @@ public class MultiKey implements Serializable {
      * @param key4  the fourth key
      * @param key5  the fifth key
      */
-    public MultiKey(Object key1, Object key2, Object key3, Object key4, Object key5) {
-        this(new Object[] {key1, key2, key3, key4, key5}, false);
+    @SuppressWarnings("unchecked")
+    public MultiKey(K key1, K key2, K key3, K key4, K key5) {
+        this((K[]) new Object[] {key1, key2, key3, key4, key5}, false);
     }
-    
+
     /**
      * Constructor taking an array of keys which is cloned.
      * <p>
@@ -125,10 +129,10 @@ public class MultiKey implements Serializable {
      * @param keys  the array of keys, not null
      * @throws IllegalArgumentException if the key array is null
      */
-    public MultiKey(Object[] keys) {
+    public MultiKey(K[] keys) {
         this(keys, true);
     }
-    
+
     /**
      * Constructor taking an array of keys, optionally choosing whether to clone.
      * <p>
@@ -153,17 +157,17 @@ public class MultiKey implements Serializable {
      * @throws IllegalArgumentException if the key array is null
      * @since Commons Collections 3.1
      */
-    public MultiKey(Object[] keys, boolean makeClone) {
+    public MultiKey(K[] keys, boolean makeClone) {
         super();
         if (keys == null) {
             throw new IllegalArgumentException("The array of keys must not be null");
         }
         if (makeClone) {
-            this.keys = (Object[]) keys.clone();
+            this.keys = keys.clone();
         } else {
             this.keys = keys;
         }
-        
+
         int total = 0;
         for (int i = 0; i < keys.length; i++) {
             if (keys[i] != null) {
@@ -172,7 +176,7 @@ public class MultiKey implements Serializable {
         }
         hashCode = total;
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Gets a clone of the array of keys.
@@ -182,10 +186,10 @@ public class MultiKey implements Serializable {
      * 
      * @return the individual keys
      */
-    public Object[] getKeys() {
-        return (Object[]) keys.clone();
+    public K[] getKeys() {
+        return keys.clone();
     }
-    
+
     /**
      * Gets the key at the specified index.
      * <p>
@@ -197,10 +201,10 @@ public class MultiKey implements Serializable {
      * @throws IndexOutOfBoundsException if the index is invalid
      * @since Commons Collections 3.1
      */
-    public Object getKey(int index) {
+    public K getKey(int index) {
         return keys[index];
     }
-    
+
     /**
      * Gets the size of the list of keys.
      * 
@@ -210,7 +214,7 @@ public class MultiKey implements Serializable {
     public int size() {
         return keys.length;
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Compares this object to another.
@@ -226,7 +230,7 @@ public class MultiKey implements Serializable {
             return true;
         }
         if (other instanceof MultiKey) {
-            MultiKey otherMulti = (MultiKey) other;
+            MultiKey<?> otherMulti = (MultiKey<?>) other;
             return Arrays.equals(keys, otherMulti.keys);
         }
         return false;


[16/77] [abbrv] commons-collections git commit: finish generics (minus one class)

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/TestPredicateUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestPredicateUtils.java b/src/test/org/apache/commons/collections/TestPredicateUtils.java
index e8b1e16..e7b7b9e 100644
--- a/src/test/org/apache/commons/collections/TestPredicateUtils.java
+++ b/src/test/org/apache/commons/collections/TestPredicateUtils.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,14 +30,16 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.commons.collections.functors.AllPredicate;
 import org.apache.commons.collections.functors.BasicPredicateTestBase;
 import org.apache.commons.collections.functors.EqualPredicate;
+import org.apache.commons.collections.functors.FalsePredicate;
 import org.apache.commons.collections.functors.TruePredicate;
 import org.junit.Test;
 
 /**
  * Tests the org.apache.commons.collections.PredicateUtils class.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
@@ -74,7 +76,7 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
     // notNullPredicate
     //------------------------------------------------------------------
 
@@ -94,8 +96,8 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         assertSame(nullPredicate(), PredicateUtils.identityPredicate(null));
         assertNotNull(PredicateUtils.identityPredicate(new Integer(6)));
         assertEquals(false, PredicateUtils.identityPredicate(new Integer(6)).evaluate(null));
-        assertEquals(false, PredicateUtils.identityPredicate(new Integer(6)).evaluate(cObject));
-        assertEquals(false, PredicateUtils.identityPredicate(new Integer(6)).evaluate(cString));
+        assertEquals(false, PredicateUtils.<Object>identityPredicate(new Integer(6)).evaluate(cObject));
+        assertEquals(false, PredicateUtils.<Object>identityPredicate(new Integer(6)).evaluate(cString));
         assertEquals(false, PredicateUtils.identityPredicate(new Integer(6)).evaluate(cInteger));
         assertEquals(true, PredicateUtils.identityPredicate(cInteger).evaluate(cInteger));
     }
@@ -104,37 +106,37 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
     //------------------------------------------------------------------
 
     @Test public void testTruePredicate() {
-        assertNotNull(PredicateUtils.truePredicate());
-        assertSame(PredicateUtils.truePredicate(), PredicateUtils.truePredicate());
-        assertEquals(true, PredicateUtils.truePredicate().evaluate(null));
-        assertEquals(true, PredicateUtils.truePredicate().evaluate(cObject));
-        assertEquals(true, PredicateUtils.truePredicate().evaluate(cString));
-        assertEquals(true, PredicateUtils.truePredicate().evaluate(cInteger));
+        assertNotNull(TruePredicate.truePredicate());
+        assertSame(TruePredicate.truePredicate(), TruePredicate.truePredicate());
+        assertEquals(true, TruePredicate.truePredicate().evaluate(null));
+        assertEquals(true, TruePredicate.truePredicate().evaluate(cObject));
+        assertEquals(true, TruePredicate.truePredicate().evaluate(cString));
+        assertEquals(true, TruePredicate.truePredicate().evaluate(cInteger));
     }
 
     // falsePredicate
     //------------------------------------------------------------------
 
     @Test public void testFalsePredicate() {
-        assertNotNull(PredicateUtils.falsePredicate());
-        assertSame(PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate());
-        assertEquals(false, PredicateUtils.falsePredicate().evaluate(null));
-        assertEquals(false, PredicateUtils.falsePredicate().evaluate(cObject));
-        assertEquals(false, PredicateUtils.falsePredicate().evaluate(cString));
-        assertEquals(false, PredicateUtils.falsePredicate().evaluate(cInteger));
+        assertNotNull(FalsePredicate.falsePredicate());
+        assertSame(FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate());
+        assertEquals(false, FalsePredicate.falsePredicate().evaluate(null));
+        assertEquals(false, FalsePredicate.falsePredicate().evaluate(cObject));
+        assertEquals(false, FalsePredicate.falsePredicate().evaluate(cString));
+        assertEquals(false, FalsePredicate.falsePredicate().evaluate(cInteger));
     }
 
     // notPredicate
     //------------------------------------------------------------------
 
     @Test public void testNotPredicate() {
-        assertNotNull(PredicateUtils.notPredicate(PredicateUtils.truePredicate()));
-        assertEquals(false, PredicateUtils.notPredicate(PredicateUtils.truePredicate()).evaluate(null));
-        assertEquals(false, PredicateUtils.notPredicate(PredicateUtils.truePredicate()).evaluate(cObject));
-        assertEquals(false, PredicateUtils.notPredicate(PredicateUtils.truePredicate()).evaluate(cString));
-        assertEquals(false, PredicateUtils.notPredicate(PredicateUtils.truePredicate()).evaluate(cInteger));
+        assertNotNull(PredicateUtils.notPredicate(TruePredicate.truePredicate()));
+        assertEquals(false, PredicateUtils.notPredicate(TruePredicate.truePredicate()).evaluate(null));
+        assertEquals(false, PredicateUtils.notPredicate(TruePredicate.truePredicate()).evaluate(cObject));
+        assertEquals(false, PredicateUtils.notPredicate(TruePredicate.truePredicate()).evaluate(cString));
+        assertEquals(false, PredicateUtils.notPredicate(TruePredicate.truePredicate()).evaluate(cInteger));
     }
-    
+
     @Test public void testNotPredicateEx() {
         try {
             PredicateUtils.notPredicate(null);
@@ -143,15 +145,15 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
     // andPredicate
     //------------------------------------------------------------------
 
     @Test public void testAndPredicate() {
-        assertEquals(true, PredicateUtils.andPredicate(PredicateUtils.truePredicate(), PredicateUtils.truePredicate()).evaluate(null));
-        assertEquals(false, PredicateUtils.andPredicate(PredicateUtils.truePredicate(), PredicateUtils.falsePredicate()).evaluate(null));
-        assertEquals(false, PredicateUtils.andPredicate(PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()).evaluate(null));
-        assertEquals(false, PredicateUtils.andPredicate(PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()).evaluate(null));
+        assertEquals(true, PredicateUtils.andPredicate(TruePredicate.truePredicate(), TruePredicate.truePredicate()).evaluate(null));
+        assertEquals(false, PredicateUtils.andPredicate(TruePredicate.truePredicate(), FalsePredicate.falsePredicate()).evaluate(null));
+        assertEquals(false, PredicateUtils.andPredicate(FalsePredicate.falsePredicate(), TruePredicate.truePredicate()).evaluate(null));
+        assertEquals(false, PredicateUtils.andPredicate(FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate()).evaluate(null));
     }
 
     @Test public void testAndPredicateEx() {
@@ -162,113 +164,116 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
     // allPredicate
     //------------------------------------------------------------------
 
+    @SuppressWarnings("unchecked")
     @Test public void testAllPredicate() {
-        assertTrue(PredicateUtils.allPredicate(
-            new Predicate[] {}), null);
-        assertEquals(true, PredicateUtils.allPredicate(new Predicate[] {
-            PredicateUtils.truePredicate(), PredicateUtils.truePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
-        assertEquals(false, PredicateUtils.allPredicate(new Predicate[] {
-            PredicateUtils.truePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
-        assertEquals(false, PredicateUtils.allPredicate(new Predicate[] {
-            PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
-        assertEquals(false, PredicateUtils.allPredicate(new Predicate[] {
-            PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()}).evaluate(null));
-        Collection coll = new ArrayList();
-        coll.add(PredicateUtils.truePredicate());
-        coll.add(PredicateUtils.truePredicate());
-        coll.add(PredicateUtils.truePredicate());
-        assertEquals(true, PredicateUtils.allPredicate(coll).evaluate(null));
+        assertTrue(AllPredicate.allPredicate(new Predicate[] {}), null);
+        assertEquals(true, AllPredicate.allPredicate(new Predicate[] {
+                TruePredicate.truePredicate(), TruePredicate.truePredicate(), TruePredicate.truePredicate()}).evaluate(null));
+        assertEquals(false, AllPredicate.allPredicate(new Predicate[] {
+                TruePredicate.truePredicate(), FalsePredicate.falsePredicate(), TruePredicate.truePredicate()}).evaluate(null));
+        assertEquals(false, AllPredicate.allPredicate(new Predicate[] {
+                FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate(), TruePredicate.truePredicate()}).evaluate(null));
+        assertEquals(false, AllPredicate.allPredicate(new Predicate[] {
+                FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate()}).evaluate(null));
+        Collection<Predicate<Object>> coll = new ArrayList<Predicate<Object>>();
+        coll.add(TruePredicate.truePredicate());
+        coll.add(TruePredicate.truePredicate());
+        coll.add(TruePredicate.truePredicate());
+        assertEquals(true, AllPredicate.allPredicate(coll).evaluate(null));
         coll.clear();
-        coll.add(PredicateUtils.truePredicate());
-        coll.add(PredicateUtils.falsePredicate());
-        coll.add(PredicateUtils.truePredicate());
-        assertEquals(false, PredicateUtils.allPredicate(coll).evaluate(null));
+        coll.add(TruePredicate.truePredicate());
+        coll.add(FalsePredicate.falsePredicate());
+        coll.add(TruePredicate.truePredicate());
+        assertEquals(false, AllPredicate.allPredicate(coll).evaluate(null));
         coll.clear();
-        coll.add(PredicateUtils.falsePredicate());
-        coll.add(PredicateUtils.falsePredicate());
-        coll.add(PredicateUtils.truePredicate());
-        assertEquals(false, PredicateUtils.allPredicate(coll).evaluate(null));
+        coll.add(FalsePredicate.falsePredicate());
+        coll.add(FalsePredicate.falsePredicate());
+        coll.add(TruePredicate.truePredicate());
+        assertEquals(false, AllPredicate.allPredicate(coll).evaluate(null));
         coll.clear();
-        coll.add(PredicateUtils.falsePredicate());
-        coll.add(PredicateUtils.falsePredicate());
-        coll.add(PredicateUtils.falsePredicate());
-        assertEquals(false, PredicateUtils.allPredicate(coll).evaluate(null));
+        coll.add(FalsePredicate.falsePredicate());
+        coll.add(FalsePredicate.falsePredicate());
+        coll.add(FalsePredicate.falsePredicate());
+        assertEquals(false, AllPredicate.allPredicate(coll).evaluate(null));
         coll.clear();
-        coll.add(PredicateUtils.falsePredicate());
-        assertFalse(PredicateUtils.allPredicate(coll), null);
+        coll.add(FalsePredicate.falsePredicate());
+        assertFalse(AllPredicate.allPredicate(coll), null);
         coll.clear();
-        coll.add(PredicateUtils.truePredicate());
-        assertTrue(PredicateUtils.allPredicate(coll), null);
+        coll.add(TruePredicate.truePredicate());
+        assertTrue(AllPredicate.allPredicate(coll), null);
         coll.clear();
-        assertTrue(PredicateUtils.allPredicate(coll), null);
+        assertTrue(AllPredicate.allPredicate(coll), null);
     }
 
+    @SuppressWarnings("unchecked")
     @Test public void testAllPredicateEx1() {
         try {
-            PredicateUtils.allPredicate((Predicate[]) null);
+            AllPredicate.allPredicate((Predicate[]) null);
         } catch (IllegalArgumentException ex) {
             return;
         }
         fail();
     }
-    
+
+    @SuppressWarnings("unchecked")
     @Test public void testAllPredicateEx2() {
         try {
-            PredicateUtils.allPredicate(new Predicate[] {null});
+            AllPredicate.<Object>allPredicate(new Predicate[] { null });
         } catch (IllegalArgumentException ex) {
             return;
         }
         fail();
     }
-    
+
+    @SuppressWarnings("unchecked")
     @Test public void testAllPredicateEx3() {
         try {
-            PredicateUtils.allPredicate(new Predicate[] {null, null});
+            AllPredicate.allPredicate(new Predicate[] { null, null });
         } catch (IllegalArgumentException ex) {
             return;
         }
         fail();
     }
-    
+
     @Test public void testAllPredicateEx4() {
         try {
-            PredicateUtils.allPredicate((Collection) null);
+            AllPredicate.allPredicate((Collection<Predicate<Object>>) null);
         } catch (IllegalArgumentException ex) {
             return;
         }
         fail();
     }
-    
+
     @Test public void testAllPredicateEx5() {
-        PredicateUtils.allPredicate(Collections.EMPTY_LIST);
+        AllPredicate.allPredicate(Collections.<Predicate<Object>>emptyList());
     }
-    
+
     @Test public void testAllPredicateEx6() {
         try {
-            Collection coll = new ArrayList();
+            Collection<Predicate<Object>> coll = new ArrayList<Predicate<Object>>();
             coll.add(null);
             coll.add(null);
-            PredicateUtils.allPredicate(coll);
+            AllPredicate.allPredicate(coll);
         } catch (IllegalArgumentException ex) {
             return;
         }
         fail();
     }
-    
+
     // orPredicate
     //------------------------------------------------------------------
 
     @Test public void testOrPredicate() {
-        assertEquals(true, PredicateUtils.orPredicate(PredicateUtils.truePredicate(), PredicateUtils.truePredicate()).evaluate(null));
-        assertEquals(true, PredicateUtils.orPredicate(PredicateUtils.truePredicate(), PredicateUtils.falsePredicate()).evaluate(null));
-        assertEquals(true, PredicateUtils.orPredicate(PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()).evaluate(null));
-        assertEquals(false, PredicateUtils.orPredicate(PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()).evaluate(null));
+        assertEquals(true, PredicateUtils.orPredicate(TruePredicate.truePredicate(), TruePredicate.truePredicate()).evaluate(null));
+        assertEquals(true, PredicateUtils.orPredicate(TruePredicate.truePredicate(), FalsePredicate.falsePredicate()).evaluate(null));
+        assertEquals(true, PredicateUtils.orPredicate(FalsePredicate.falsePredicate(), TruePredicate.truePredicate()).evaluate(null));
+        assertEquals(false, PredicateUtils.orPredicate(FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate()).evaluate(null));
     }
-    
+
     @Test public void testOrPredicateEx() {
         try {
             PredicateUtils.orPredicate(null, null);
@@ -277,51 +282,53 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
     // anyPredicate
     //------------------------------------------------------------------
 
+    @SuppressWarnings("unchecked")
     @Test public void testAnyPredicate() {
-        assertFalse(PredicateUtils.anyPredicate(
-            new Predicate[] {}), null);
+        assertFalse(PredicateUtils.anyPredicate(new Predicate[] {}), null);
+
         assertEquals(true, PredicateUtils.anyPredicate(new Predicate[] {
-            PredicateUtils.truePredicate(), PredicateUtils.truePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
+                TruePredicate.truePredicate(), TruePredicate.truePredicate(), TruePredicate.truePredicate()}).evaluate(null));
         assertEquals(true, PredicateUtils.anyPredicate(new Predicate[] {
-            PredicateUtils.truePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
+                TruePredicate.truePredicate(), FalsePredicate.falsePredicate(), TruePredicate.truePredicate()}).evaluate(null));
         assertEquals(true, PredicateUtils.anyPredicate(new Predicate[] {
-            PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
+                FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate(), TruePredicate.truePredicate()}).evaluate(null));
         assertEquals(false, PredicateUtils.anyPredicate(new Predicate[] {
-            PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()}).evaluate(null));
+                FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate()}).evaluate(null));
         Collection coll = new ArrayList();
-        coll.add(PredicateUtils.truePredicate());
-        coll.add(PredicateUtils.truePredicate());
-        coll.add(PredicateUtils.truePredicate());
+        coll.add(TruePredicate.truePredicate());
+        coll.add(TruePredicate.truePredicate());
+        coll.add(TruePredicate.truePredicate());
         assertEquals(true, PredicateUtils.anyPredicate(coll).evaluate(null));
         coll.clear();
-        coll.add(PredicateUtils.truePredicate());
-        coll.add(PredicateUtils.falsePredicate());
-        coll.add(PredicateUtils.truePredicate());
+        coll.add(TruePredicate.truePredicate());
+        coll.add(FalsePredicate.falsePredicate());
+        coll.add(TruePredicate.truePredicate());
         assertEquals(true, PredicateUtils.anyPredicate(coll).evaluate(null));
         coll.clear();
-        coll.add(PredicateUtils.falsePredicate());
-        coll.add(PredicateUtils.falsePredicate());
-        coll.add(PredicateUtils.truePredicate());
+        coll.add(FalsePredicate.falsePredicate());
+        coll.add(FalsePredicate.falsePredicate());
+        coll.add(TruePredicate.truePredicate());
         assertEquals(true, PredicateUtils.anyPredicate(coll).evaluate(null));
         coll.clear();
-        coll.add(PredicateUtils.falsePredicate());
-        coll.add(PredicateUtils.falsePredicate());
-        coll.add(PredicateUtils.falsePredicate());
+        coll.add(FalsePredicate.falsePredicate());
+        coll.add(FalsePredicate.falsePredicate());
+        coll.add(FalsePredicate.falsePredicate());
         assertEquals(false, PredicateUtils.anyPredicate(coll).evaluate(null));
         coll.clear();
-        coll.add(PredicateUtils.falsePredicate());
+        coll.add(FalsePredicate.falsePredicate());
         assertFalse(PredicateUtils.anyPredicate(coll), null);
         coll.clear();
-        coll.add(PredicateUtils.truePredicate());
+        coll.add(TruePredicate.truePredicate());
         assertTrue(PredicateUtils.anyPredicate(coll), null);
         coll.clear();
         assertFalse(PredicateUtils.anyPredicate(coll), null);
     }
 
+    @SuppressWarnings("unchecked")
     @Test public void testAnyPredicateEx1() {
         try {
             PredicateUtils.anyPredicate((Predicate[]) null);
@@ -330,7 +337,8 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
+    @SuppressWarnings("unchecked")
     @Test public void testAnyPredicateEx2() {
         try {
             PredicateUtils.anyPredicate(new Predicate[] {null});
@@ -339,7 +347,8 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
+    @SuppressWarnings("unchecked")
     @Test public void testAnyPredicateEx3() {
         try {
             PredicateUtils.anyPredicate(new Predicate[] {null, null});
@@ -348,23 +357,23 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
     @Test public void testAnyPredicateEx4() {
         try {
-            PredicateUtils.anyPredicate((Collection) null);
+            PredicateUtils.anyPredicate((Collection<Predicate<Object>>) null);
         } catch (IllegalArgumentException ex) {
             return;
         }
         fail();
     }
-    
+
     @Test public void testAnyPredicateEx5() {
-        PredicateUtils.anyPredicate(Collections.EMPTY_LIST);
+        PredicateUtils.anyPredicate(Collections.<Predicate<Object>>emptyList());
     }
-    
+
     @Test public void testAnyPredicateEx6() {
         try {
-            Collection coll = new ArrayList();
+            Collection<Predicate<Object>> coll = new ArrayList<Predicate<Object>>();
             coll.add(null);
             coll.add(null);
             PredicateUtils.anyPredicate(coll);
@@ -373,15 +382,15 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
     // eitherPredicate
     //------------------------------------------------------------------
 
     @Test public void testEitherPredicate() {
-        assertEquals(false, PredicateUtils.eitherPredicate(PredicateUtils.truePredicate(), PredicateUtils.truePredicate()).evaluate(null));
-        assertEquals(true, PredicateUtils.eitherPredicate(PredicateUtils.truePredicate(), PredicateUtils.falsePredicate()).evaluate(null));
-        assertEquals(true, PredicateUtils.eitherPredicate(PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()).evaluate(null));
-        assertEquals(false, PredicateUtils.eitherPredicate(PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()).evaluate(null));
+        assertEquals(false, PredicateUtils.eitherPredicate(TruePredicate.truePredicate(), TruePredicate.truePredicate()).evaluate(null));
+        assertEquals(true, PredicateUtils.eitherPredicate(TruePredicate.truePredicate(), FalsePredicate.falsePredicate()).evaluate(null));
+        assertEquals(true, PredicateUtils.eitherPredicate(FalsePredicate.falsePredicate(), TruePredicate.truePredicate()).evaluate(null));
+        assertEquals(false, PredicateUtils.eitherPredicate(FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate()).evaluate(null));
     }
 
     @Test public void testEitherPredicateEx() {
@@ -392,54 +401,56 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
     // onePredicate
     //------------------------------------------------------------------
 
+    @SuppressWarnings("unchecked")
     @Test public void testOnePredicate() {
-        assertFalse(PredicateUtils.onePredicate(new Predicate[] {}), null);
+        assertFalse(PredicateUtils.onePredicate((Predicate<Object>[]) new Predicate[] {}), null);
         assertEquals(false, PredicateUtils.onePredicate(new Predicate[] {
-            PredicateUtils.truePredicate(), PredicateUtils.truePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
+            TruePredicate.truePredicate(), TruePredicate.truePredicate(), TruePredicate.truePredicate()}).evaluate(null));
         assertEquals(false, PredicateUtils.onePredicate(new Predicate[] {
-            PredicateUtils.truePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
+                TruePredicate.truePredicate(), FalsePredicate.falsePredicate(), TruePredicate.truePredicate()}).evaluate(null));
         assertEquals(true, PredicateUtils.onePredicate(new Predicate[] {
-            PredicateUtils.truePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()}).evaluate(null));
+                TruePredicate.truePredicate(), FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate()}).evaluate(null));
         assertEquals(true, PredicateUtils.onePredicate(new Predicate[] {
-            PredicateUtils.falsePredicate(), PredicateUtils.truePredicate(), PredicateUtils.falsePredicate()}).evaluate(null));
+                FalsePredicate.falsePredicate(), TruePredicate.truePredicate(), FalsePredicate.falsePredicate()}).evaluate(null));
         assertEquals(true, PredicateUtils.onePredicate(new Predicate[] {
-            PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
+                FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate(), TruePredicate.truePredicate()}).evaluate(null));
         assertEquals(false, PredicateUtils.onePredicate(new Predicate[] {
-            PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()}).evaluate(null));
-        Collection coll = new ArrayList();
-        coll.add(PredicateUtils.truePredicate());
-        coll.add(PredicateUtils.truePredicate());
-        coll.add(PredicateUtils.truePredicate());
+                FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate()}).evaluate(null));
+        Collection<Predicate<Object>> coll = new ArrayList<Predicate<Object>>();
+        coll.add(TruePredicate.truePredicate());
+        coll.add(TruePredicate.truePredicate());
+        coll.add(TruePredicate.truePredicate());
         assertEquals(false, PredicateUtils.onePredicate(coll).evaluate(null));
         coll.clear();
-        coll.add(PredicateUtils.truePredicate());
-        coll.add(PredicateUtils.falsePredicate());
-        coll.add(PredicateUtils.truePredicate());
+        coll.add(TruePredicate.truePredicate());
+        coll.add(FalsePredicate.falsePredicate());
+        coll.add(TruePredicate.truePredicate());
         assertEquals(false, PredicateUtils.onePredicate(coll).evaluate(null));
         coll.clear();
-        coll.add(PredicateUtils.falsePredicate());
-        coll.add(PredicateUtils.falsePredicate());
-        coll.add(PredicateUtils.truePredicate());
+        coll.add(FalsePredicate.falsePredicate());
+        coll.add(FalsePredicate.falsePredicate());
+        coll.add(TruePredicate.truePredicate());
         assertEquals(true, PredicateUtils.onePredicate(coll).evaluate(null));
         coll.clear();
-        coll.add(PredicateUtils.falsePredicate());
-        coll.add(PredicateUtils.falsePredicate());
-        coll.add(PredicateUtils.falsePredicate());
+        coll.add(FalsePredicate.falsePredicate());
+        coll.add(FalsePredicate.falsePredicate());
+        coll.add(FalsePredicate.falsePredicate());
         assertEquals(false, PredicateUtils.onePredicate(coll).evaluate(null));
         coll.clear();
-        coll.add(PredicateUtils.falsePredicate());
+        coll.add(FalsePredicate.falsePredicate());
         assertFalse(PredicateUtils.onePredicate(coll), null);
         coll.clear();
-        coll.add(PredicateUtils.truePredicate());
+        coll.add(TruePredicate.truePredicate());
         assertTrue(PredicateUtils.onePredicate(coll), null);
         coll.clear();
         assertFalse(PredicateUtils.onePredicate(coll), null);
     }
 
+    @SuppressWarnings("unchecked")
     @Test public void testOnePredicateEx1() {
         try {
             PredicateUtils.onePredicate((Predicate[]) null);
@@ -448,7 +459,8 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
+    @SuppressWarnings("unchecked")
     @Test public void testOnePredicateEx2() {
         try {
             PredicateUtils.onePredicate(new Predicate[] {null});
@@ -457,7 +469,8 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
+    @SuppressWarnings("unchecked")
     @Test public void testOnePredicateEx3() {
         try {
             PredicateUtils.onePredicate(new Predicate[] {null, null});
@@ -466,7 +479,8 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
+    @SuppressWarnings("unchecked")
     @Test public void testOnePredicateEx4() {
         try {
             PredicateUtils.onePredicate((Collection) null);
@@ -475,14 +489,15 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
+    @SuppressWarnings("unchecked")
     @Test public void testOnePredicateEx5() {
         PredicateUtils.onePredicate(Collections.EMPTY_LIST);
     }
-    
+
     @Test public void testOnePredicateEx6() {
         try {
-            Collection coll = new ArrayList();
+            Collection<Predicate<Object>> coll = new ArrayList<Predicate<Object>>();
             coll.add(null);
             coll.add(null);
             PredicateUtils.onePredicate(coll);
@@ -491,15 +506,15 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
     // neitherPredicate
     //------------------------------------------------------------------
 
     @Test public void testNeitherPredicate() {
-        assertEquals(false, PredicateUtils.neitherPredicate(PredicateUtils.truePredicate(), PredicateUtils.truePredicate()).evaluate(null));
-        assertEquals(false, PredicateUtils.neitherPredicate(PredicateUtils.truePredicate(), PredicateUtils.falsePredicate()).evaluate(null));
-        assertEquals(false, PredicateUtils.neitherPredicate(PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()).evaluate(null));
-        assertEquals(true, PredicateUtils.neitherPredicate(PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()).evaluate(null));
+        assertEquals(false, PredicateUtils.neitherPredicate(TruePredicate.truePredicate(), TruePredicate.truePredicate()).evaluate(null));
+        assertEquals(false, PredicateUtils.neitherPredicate(TruePredicate.truePredicate(), FalsePredicate.falsePredicate()).evaluate(null));
+        assertEquals(false, PredicateUtils.neitherPredicate(FalsePredicate.falsePredicate(), TruePredicate.truePredicate()).evaluate(null));
+        assertEquals(true, PredicateUtils.neitherPredicate(FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate()).evaluate(null));
     }
 
     @Test public void testNeitherPredicateEx() {
@@ -510,50 +525,52 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
     // nonePredicate
     //------------------------------------------------------------------
 
+    @SuppressWarnings("unchecked")
     @Test public void testNonePredicate() {
         assertTrue(PredicateUtils.nonePredicate(new Predicate[] {}), null);
         assertEquals(false, PredicateUtils.nonePredicate(new Predicate[] {
-            PredicateUtils.truePredicate(), PredicateUtils.truePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
+                TruePredicate.truePredicate(), TruePredicate.truePredicate(), TruePredicate.truePredicate() }).evaluate(null));
         assertEquals(false, PredicateUtils.nonePredicate(new Predicate[] {
-            PredicateUtils.truePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
+                TruePredicate.truePredicate(), FalsePredicate.falsePredicate(), TruePredicate.truePredicate() }).evaluate(null));
         assertEquals(false, PredicateUtils.nonePredicate(new Predicate[] {
-            PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
+                FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate(), TruePredicate.truePredicate() }).evaluate(null));
         assertEquals(true, PredicateUtils.nonePredicate(new Predicate[] {
-            PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()}).evaluate(null));
-        Collection coll = new ArrayList();
-        coll.add(PredicateUtils.truePredicate());
-        coll.add(PredicateUtils.truePredicate());
-        coll.add(PredicateUtils.truePredicate());
+                FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate() }).evaluate(null));
+        Collection<Predicate<Object>> coll = new ArrayList<Predicate<Object>>();
+        coll.add(TruePredicate.truePredicate());
+        coll.add(TruePredicate.truePredicate());
+        coll.add(TruePredicate.truePredicate());
         assertEquals(false, PredicateUtils.nonePredicate(coll).evaluate(null));
         coll.clear();
-        coll.add(PredicateUtils.truePredicate());
-        coll.add(PredicateUtils.falsePredicate());
-        coll.add(PredicateUtils.truePredicate());
+        coll.add(TruePredicate.truePredicate());
+        coll.add(FalsePredicate.falsePredicate());
+        coll.add(TruePredicate.truePredicate());
         assertEquals(false, PredicateUtils.nonePredicate(coll).evaluate(null));
         coll.clear();
-        coll.add(PredicateUtils.falsePredicate());
-        coll.add(PredicateUtils.falsePredicate());
-        coll.add(PredicateUtils.truePredicate());
+        coll.add(FalsePredicate.falsePredicate());
+        coll.add(FalsePredicate.falsePredicate());
+        coll.add(TruePredicate.truePredicate());
         assertEquals(false, PredicateUtils.nonePredicate(coll).evaluate(null));
         coll.clear();
-        coll.add(PredicateUtils.falsePredicate());
-        coll.add(PredicateUtils.falsePredicate());
-        coll.add(PredicateUtils.falsePredicate());
+        coll.add(FalsePredicate.falsePredicate());
+        coll.add(FalsePredicate.falsePredicate());
+        coll.add(FalsePredicate.falsePredicate());
         assertEquals(true, PredicateUtils.nonePredicate(coll).evaluate(null));
         coll.clear();
-        coll.add(PredicateUtils.falsePredicate());
+        coll.add(FalsePredicate.falsePredicate());
         assertTrue(PredicateUtils.nonePredicate(coll), null);
         coll.clear();
-        coll.add(PredicateUtils.truePredicate());
+        coll.add(TruePredicate.truePredicate());
         assertFalse(PredicateUtils.nonePredicate(coll), null);
         coll.clear();
         assertTrue(PredicateUtils.nonePredicate(coll), null);
     }
 
+    @SuppressWarnings("unchecked")
     @Test public void testNonePredicateEx1() {
         try {
             PredicateUtils.nonePredicate((Predicate[]) null);
@@ -562,7 +579,8 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
+    @SuppressWarnings("unchecked")
     @Test public void testNonePredicateEx2() {
         try {
             PredicateUtils.nonePredicate(new Predicate[] {null});
@@ -571,7 +589,8 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
+    @SuppressWarnings("unchecked")
     @Test public void testNonePredicateEx3() {
         try {
             PredicateUtils.nonePredicate(new Predicate[] {null, null});
@@ -580,23 +599,23 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
     @Test public void testNonePredicateEx4() {
         try {
-            PredicateUtils.nonePredicate((Collection) null);
+            PredicateUtils.nonePredicate((Collection<Predicate<Object>>) null);
         } catch (IllegalArgumentException ex) {
             return;
         }
         fail();
     }
-    
+
     @Test public void testNonePredicateEx5() {
-        PredicateUtils.nonePredicate(Collections.EMPTY_LIST);
+        PredicateUtils.nonePredicate(Collections.<Predicate<Object>>emptyList());
     }
-    
+
     @Test public void testNonePredicateEx6() {
         try {
-            Collection coll = new ArrayList();
+            Collection<Predicate<Object>> coll = new ArrayList<Predicate<Object>>();
             coll.add(null);
             coll.add(null);
             PredicateUtils.nonePredicate(coll);
@@ -605,7 +624,7 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
     // instanceofPredicate
     //------------------------------------------------------------------
 
@@ -621,7 +640,7 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
     //------------------------------------------------------------------
 
     @Test public void testUniquePredicate() {
-        Predicate p = PredicateUtils.uniquePredicate();
+        Predicate<Object> p = PredicateUtils.uniquePredicate();
         assertEquals(true, p.evaluate(new Object()));
         assertEquals(true, p.evaluate(new Object()));
         assertEquals(true, p.evaluate(new Object()));
@@ -629,13 +648,13 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         assertEquals(false, p.evaluate(cString));
         assertEquals(false, p.evaluate(cString));
     }
-    
+
     // asPredicate(Transformer)
     //------------------------------------------------------------------
 
     @Test public void testAsPredicateTransformer() {
-        assertEquals(false, PredicateUtils.asPredicate(TransformerUtils.nopTransformer()).evaluate(Boolean.FALSE));
-        assertEquals(true, PredicateUtils.asPredicate(TransformerUtils.nopTransformer()).evaluate(Boolean.TRUE));
+        assertEquals(false, PredicateUtils.asPredicate(TransformerUtils.<Boolean>nopTransformer()).evaluate(false));
+        assertEquals(true, PredicateUtils.asPredicate(TransformerUtils.<Boolean>nopTransformer()).evaluate(true));
     }
 
     @Test public void testAsPredicateTransformerEx1() {
@@ -646,21 +665,21 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
     @Test public void testAsPredicateTransformerEx2() {
         try {
-            PredicateUtils.asPredicate(TransformerUtils.nopTransformer()).evaluate(null);
+            PredicateUtils.asPredicate(TransformerUtils.<Boolean>nopTransformer()).evaluate(null);
         } catch (FunctorException ex) {
             return;
         }
         fail();
     }
-    
+
     // invokerPredicate
     //------------------------------------------------------------------
 
     @Test public void testInvokerPredicate() {
-        List list = new ArrayList();
+        List<Object> list = new ArrayList<Object>();
         assertEquals(true, PredicateUtils.invokerPredicate("isEmpty").evaluate(list));
         list.add(new Object());
         assertEquals(false, PredicateUtils.invokerPredicate("isEmpty").evaluate(list));
@@ -674,7 +693,7 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
     @Test public void testInvokerPredicateEx2() {
         try {
             PredicateUtils.invokerPredicate("isEmpty").evaluate(null);
@@ -683,7 +702,7 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
     @Test public void testInvokerPredicateEx3() {
         try {
             PredicateUtils.invokerPredicate("noSuchMethod").evaluate(new Object());
@@ -692,12 +711,12 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
     // invokerPredicate2
     //------------------------------------------------------------------
 
     @Test public void testInvokerPredicate2() {
-        List list = new ArrayList();
+        List<String> list = new ArrayList<String>();
         assertEquals(false, PredicateUtils.invokerPredicate(
             "contains", new Class[] {Object.class}, new Object[] {cString}).evaluate(list));
         list.add(cString);
@@ -713,7 +732,7 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
     @Test public void testInvokerPredicate2Ex2() {
         try {
             PredicateUtils.invokerPredicate("contains", new Class[] {Object.class}, new Object[] {cString}).evaluate(null);
@@ -722,7 +741,7 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
     @Test public void testInvokerPredicate2Ex3() {
         try {
             PredicateUtils.invokerPredicate(
@@ -732,14 +751,14 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
     // nullIsException
     //------------------------------------------------------------------
 
     @Test public void testNullIsExceptionPredicate() {
-        assertEquals(true, PredicateUtils.nullIsExceptionPredicate(PredicateUtils.truePredicate()).evaluate(new Object()));
+        assertEquals(true, PredicateUtils.nullIsExceptionPredicate(TruePredicate.truePredicate()).evaluate(new Object()));
         try {
-            PredicateUtils.nullIsExceptionPredicate(PredicateUtils.truePredicate()).evaluate(null);
+            PredicateUtils.nullIsExceptionPredicate(TruePredicate.truePredicate()).evaluate(null);
         } catch (FunctorException ex) {
             return;
         }
@@ -754,14 +773,14 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
     // nullIsTrue
     //------------------------------------------------------------------
 
     @Test public void testNullIsTruePredicate() {
-        assertEquals(true, PredicateUtils.nullIsTruePredicate(PredicateUtils.truePredicate()).evaluate(null));
-        assertEquals(true, PredicateUtils.nullIsTruePredicate(PredicateUtils.truePredicate()).evaluate(new Object()));
-        assertEquals(false, PredicateUtils.nullIsTruePredicate(PredicateUtils.falsePredicate()).evaluate(new Object()));
+        assertEquals(true, PredicateUtils.nullIsTruePredicate(TruePredicate.truePredicate()).evaluate(null));
+        assertEquals(true, PredicateUtils.nullIsTruePredicate(TruePredicate.truePredicate()).evaluate(new Object()));
+        assertEquals(false, PredicateUtils.nullIsTruePredicate(FalsePredicate.falsePredicate()).evaluate(new Object()));
     }
 
     @Test public void testNullIsTruePredicateEx1() {
@@ -772,14 +791,14 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
     // nullIsFalse
     //------------------------------------------------------------------
 
     @Test public void testNullIsFalsePredicate() {
-        assertEquals(false, PredicateUtils.nullIsFalsePredicate(PredicateUtils.truePredicate()).evaluate(null));
-        assertEquals(true, PredicateUtils.nullIsFalsePredicate(PredicateUtils.truePredicate()).evaluate(new Object()));
-        assertEquals(false, PredicateUtils.nullIsFalsePredicate(PredicateUtils.falsePredicate()).evaluate(new Object()));
+        assertEquals(false, PredicateUtils.nullIsFalsePredicate(TruePredicate.truePredicate()).evaluate(null));
+        assertEquals(true, PredicateUtils.nullIsFalsePredicate(TruePredicate.truePredicate()).evaluate(new Object()));
+        assertEquals(false, PredicateUtils.nullIsFalsePredicate(FalsePredicate.falsePredicate()).evaluate(new Object()));
     }
 
     @Test public void testNullIsFalsePredicateEx1() {
@@ -790,19 +809,19 @@ public class TestPredicateUtils extends BasicPredicateTestBase {
         }
         fail();
     }
-    
+
     // transformed
     //------------------------------------------------------------------
 
     @Test public void testTransformedPredicate() {
         assertEquals(true, PredicateUtils.transformedPredicate(
                 TransformerUtils.nopTransformer(),
-                PredicateUtils.truePredicate()).evaluate(new Object()));
-                
-        Map map = new HashMap();
+                TruePredicate.truePredicate()).evaluate(new Object()));
+
+        Map<Object, Object> map = new HashMap<Object, Object>();
         map.put(Boolean.TRUE, "Hello");
-        Transformer t = TransformerUtils.mapTransformer(map);
-        Predicate p = EqualPredicate.equalPredicate("Hello");
+        Transformer<Object, Object> t = TransformerUtils.mapTransformer(map);
+        Predicate<Object> p = EqualPredicate.<Object>equalPredicate("Hello");
         assertEquals(false, PredicateUtils.transformedPredicate(t, p).evaluate(null));
         assertEquals(true, PredicateUtils.transformedPredicate(t, p).evaluate(Boolean.TRUE));
         try {

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/TestSetUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestSetUtils.java b/src/test/org/apache/commons/collections/TestSetUtils.java
index 42d5f13..2b2fdaa 100644
--- a/src/test/org/apache/commons/collections/TestSetUtils.java
+++ b/src/test/org/apache/commons/collections/TestSetUtils.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.
@@ -27,9 +27,9 @@ import org.apache.commons.collections.set.PredicatedSet;
 
 /**
  * Tests for SetUtils.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Neil O'Toole
  * @author Matthew Hawthorne
@@ -46,18 +46,17 @@ public class TestSetUtils extends BulkTest {
 
     public void testNothing() {
     }
-    
+
     public void testpredicatedSet() {
-        Predicate predicate = new Predicate() {
+        Predicate<Object> predicate = new Predicate<Object>() {
             public boolean evaluate(Object o) {
                 return o instanceof String;
             }
         };
-        Set set = SetUtils.predicatedSet(new HashSet(), predicate);
-        assertTrue("returned object should be a PredicatedSet",
-            set instanceof PredicatedSet);
+        Set<Object> set = SetUtils.predicatedSet(new HashSet<Object>(), predicate);
+        assertTrue("returned object should be a PredicatedSet", set instanceof PredicatedSet);
         try {
-            set = SetUtils.predicatedSet(new HashSet(), null);
+            set = SetUtils.predicatedSet(new HashSet<Object>(), null);
             fail("Expecting IllegalArgumentException for null predicate.");
         } catch (IllegalArgumentException ex) {
             // expected
@@ -71,11 +70,11 @@ public class TestSetUtils extends BulkTest {
     }
 
     public void testEquals() {
-        Collection data = Arrays.asList( new String[] { "a", "b", "c" });
-        
-        Set a = new HashSet( data );
-        Set b = new HashSet( data );
-        
+        Collection<String> data = Arrays.asList( new String[] { "a", "b", "c" });
+
+        Set<String> a = new HashSet<String>(data);
+        Set<String> b = new HashSet<String>(data);
+
         assertEquals(true, a.equals(b));
         assertEquals(true, SetUtils.isEqualSet(a, b));
         a.clear();
@@ -84,13 +83,13 @@ public class TestSetUtils extends BulkTest {
         assertEquals(false, SetUtils.isEqualSet(null, b));
         assertEquals(true, SetUtils.isEqualSet(null, null));
     }
-    
+
     public void testHashCode() {
-        Collection data = Arrays.asList( new String[] { "a", "b", "c" });
-            
-        Set a = new HashSet( data );
-        Set b = new HashSet( data );
-        
+        Collection<String> data = Arrays.asList( new String[] { "a", "b", "c" });
+
+        Set<String> a = new HashSet<String>(data);
+        Set<String> b = new HashSet<String>(data);
+
         assertEquals(true, a.hashCode() == b.hashCode());
         assertEquals(true, a.hashCode() == SetUtils.hashCodeForSet(a));
         assertEquals(true, b.hashCode() == SetUtils.hashCodeForSet(b));
@@ -98,6 +97,6 @@ public class TestSetUtils extends BulkTest {
         a.clear();
         assertEquals(false, SetUtils.hashCodeForSet(a) == SetUtils.hashCodeForSet(b));
         assertEquals(0, SetUtils.hashCodeForSet(null));
-    }   
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/TestTransformerUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestTransformerUtils.java b/src/test/org/apache/commons/collections/TestTransformerUtils.java
index 75f12ed..0bc2e37 100644
--- a/src/test/org/apache/commons/collections/TestTransformerUtils.java
+++ b/src/test/org/apache/commons/collections/TestTransformerUtils.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,11 +30,13 @@ import junit.textui.TestRunner;
 
 import org.apache.commons.collections.functors.ConstantTransformer;
 import org.apache.commons.collections.functors.EqualPredicate;
+import org.apache.commons.collections.functors.FalsePredicate;
 import org.apache.commons.collections.functors.NOPTransformer;
+import org.apache.commons.collections.functors.TruePredicate;
 
 /**
  * Tests the org.apache.commons.collections.TransformerUtils class.
- * 
+ *
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
@@ -57,7 +59,7 @@ public class TestTransformerUtils extends junit.framework.TestCase {
     /**
      * Main.
      * @param args
-     */    
+     */
     public static void main(String[] args) {
         TestRunner.run(suite());
     }
@@ -98,7 +100,7 @@ public class TestTransformerUtils extends junit.framework.TestCase {
         }
         fail();
     }
-    
+
     // nullTransformer
     //------------------------------------------------------------------
 
@@ -153,10 +155,10 @@ public class TestTransformerUtils extends junit.framework.TestCase {
     //------------------------------------------------------------------
 
     public void testMapTransformer() {
-        Map map = new HashMap();
-        map.put(null, new Integer(0));
-        map.put(cObject, new Integer(1));
-        map.put(cString, new Integer(2));
+        Map<Object, Integer> map = new HashMap<Object, Integer>();
+        map.put(null, 0);
+        map.put(cObject, 1);
+        map.put(cString, 2);
         assertEquals(new Integer(0), TransformerUtils.mapTransformer(map).transform(null));
         assertEquals(new Integer(1), TransformerUtils.mapTransformer(map).transform(cObject));
         assertEquals(new Integer(2), TransformerUtils.mapTransformer(map).transform(cString));
@@ -173,7 +175,7 @@ public class TestTransformerUtils extends junit.framework.TestCase {
         assertEquals(cString, TransformerUtils.asTransformer(ClosureUtils.nopClosure()).transform(cString));
         assertEquals(cInteger, TransformerUtils.asTransformer(ClosureUtils.nopClosure()).transform(cInteger));
         try {
-            TransformerUtils.asTransformer((Closure) null);
+            TransformerUtils.asTransformer((Closure<Object>) null);
         } catch (IllegalArgumentException ex) {
             return;
         }
@@ -184,12 +186,12 @@ public class TestTransformerUtils extends junit.framework.TestCase {
     //------------------------------------------------------------------
 
     public void testPredicateTransformer() {
-        assertEquals(Boolean.TRUE, TransformerUtils.asTransformer(PredicateUtils.truePredicate()).transform(null));
-        assertEquals(Boolean.TRUE, TransformerUtils.asTransformer(PredicateUtils.truePredicate()).transform(cObject));
-        assertEquals(Boolean.TRUE, TransformerUtils.asTransformer(PredicateUtils.truePredicate()).transform(cString));
-        assertEquals(Boolean.TRUE, TransformerUtils.asTransformer(PredicateUtils.truePredicate()).transform(cInteger));
+        assertEquals(Boolean.TRUE, TransformerUtils.asTransformer(TruePredicate.truePredicate()).transform(null));
+        assertEquals(Boolean.TRUE, TransformerUtils.asTransformer(TruePredicate.truePredicate()).transform(cObject));
+        assertEquals(Boolean.TRUE, TransformerUtils.asTransformer(TruePredicate.truePredicate()).transform(cString));
+        assertEquals(Boolean.TRUE, TransformerUtils.asTransformer(TruePredicate.truePredicate()).transform(cInteger));
         try {
-            TransformerUtils.asTransformer((Predicate) null);
+            TransformerUtils.asTransformer((Predicate<Object>) null);
         } catch (IllegalArgumentException ex) {
             return;
         }
@@ -205,7 +207,7 @@ public class TestTransformerUtils extends junit.framework.TestCase {
         assertEquals(null, TransformerUtils.asTransformer(FactoryUtils.nullFactory()).transform(cString));
         assertEquals(null, TransformerUtils.asTransformer(FactoryUtils.nullFactory()).transform(cInteger));
         try {
-            TransformerUtils.asTransformer((Factory) null);
+            TransformerUtils.asTransformer((Factory<Object>) null);
         } catch (IllegalArgumentException ex) {
             return;
         }
@@ -215,21 +217,22 @@ public class TestTransformerUtils extends junit.framework.TestCase {
     // chainedTransformer
     //------------------------------------------------------------------
 
+    @SuppressWarnings("unchecked")
     public void testChainedTransformer() {
-        Transformer a = TransformerUtils.constantTransformer("A");
-        Transformer b = TransformerUtils.constantTransformer("B");
-        
+        Transformer<Object, Object> a = TransformerUtils.<Object, Object>constantTransformer("A");
+        Transformer<Object, Object> b = TransformerUtils.constantTransformer((Object) "B");
+
         assertEquals("A", TransformerUtils.chainedTransformer(b, a).transform(null));
         assertEquals("B", TransformerUtils.chainedTransformer(a, b).transform(null));
-        assertEquals("A", TransformerUtils.chainedTransformer(new Transformer[] {b, a}).transform(null));
-        Collection coll = new ArrayList();
+        assertEquals("A", TransformerUtils.chainedTransformer(new Transformer[] { b, a }).transform(null));
+        Collection<Transformer<Object, Object>> coll = new ArrayList<Transformer<Object, Object>>();
         coll.add(b);
         coll.add(a);
         assertEquals("A", TransformerUtils.chainedTransformer(coll).transform(null));
 
         assertSame(NOPTransformer.INSTANCE, TransformerUtils.chainedTransformer(new Transformer[0]));
-        assertSame(NOPTransformer.INSTANCE, TransformerUtils.chainedTransformer(Collections.EMPTY_LIST));
-        
+        assertSame(NOPTransformer.INSTANCE, TransformerUtils.chainedTransformer(Collections.<Transformer<Object, Object>>emptyList()));
+
         try {
             TransformerUtils.chainedTransformer(null, null);
             fail();
@@ -239,7 +242,7 @@ public class TestTransformerUtils extends junit.framework.TestCase {
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            TransformerUtils.chainedTransformer((Collection) null);
+            TransformerUtils.chainedTransformer((Collection<Transformer<Object, Object>>) null);
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
@@ -247,40 +250,41 @@ public class TestTransformerUtils extends junit.framework.TestCase {
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            coll = new ArrayList();
+            coll = new ArrayList<Transformer<Object, Object>>();
             coll.add(null);
             coll.add(null);
             TransformerUtils.chainedTransformer(coll);
             fail();
         } catch (IllegalArgumentException ex) {}
     }
-    
+
     // switchTransformer
     //------------------------------------------------------------------
 
+    @SuppressWarnings("unchecked")
     public void testSwitchTransformer() {
-        Transformer a = TransformerUtils.constantTransformer("A");
-        Transformer b = TransformerUtils.constantTransformer("B");
-        Transformer c = TransformerUtils.constantTransformer("C");
-        
-        assertEquals("A", TransformerUtils.switchTransformer(PredicateUtils.truePredicate(), a, b).transform(null));
-        assertEquals("B", TransformerUtils.switchTransformer(PredicateUtils.falsePredicate(), a, b).transform(null));
-        
-        assertEquals(null, TransformerUtils.switchTransformer(
-            new Predicate[] {EqualPredicate.equalPredicate("HELLO"), EqualPredicate.equalPredicate("THERE")}, 
-            new Transformer[] {a, b}).transform("WELL"));
+        Transformer<String, String> a = TransformerUtils.constantTransformer("A");
+        Transformer<String, String> b = TransformerUtils.constantTransformer("B");
+        Transformer<String, String> c = TransformerUtils.constantTransformer("C");
+
+        assertEquals("A", TransformerUtils.switchTransformer(TruePredicate.truePredicate(), a, b).transform(null));
+        assertEquals("B", TransformerUtils.switchTransformer(FalsePredicate.falsePredicate(), a, b).transform(null));
+
+        assertEquals(null, TransformerUtils.<Object, String>switchTransformer(
+            new Predicate[] { EqualPredicate.equalPredicate("HELLO"), EqualPredicate.equalPredicate("THERE") },
+            new Transformer[] { a, b }).transform("WELL"));
         assertEquals("A", TransformerUtils.switchTransformer(
-            new Predicate[] {EqualPredicate.equalPredicate("HELLO"), EqualPredicate.equalPredicate("THERE")}, 
-            new Transformer[] {a, b}).transform("HELLO"));
+            new Predicate[] { EqualPredicate.equalPredicate("HELLO"), EqualPredicate.equalPredicate("THERE") },
+            new Transformer[] { a, b }).transform("HELLO"));
         assertEquals("B", TransformerUtils.switchTransformer(
-            new Predicate[] {EqualPredicate.equalPredicate("HELLO"), EqualPredicate.equalPredicate("THERE")}, 
-            new Transformer[] {a, b}).transform("THERE"));
-            
+            new Predicate[] { EqualPredicate.equalPredicate("HELLO"), EqualPredicate.equalPredicate("THERE") },
+            new Transformer[] { a, b }).transform("THERE"));
+
         assertEquals("C", TransformerUtils.switchTransformer(
-            new Predicate[] {EqualPredicate.equalPredicate("HELLO"), EqualPredicate.equalPredicate("THERE")}, 
-            new Transformer[] {a, b}, c).transform("WELL"));
-            
-        Map map = new HashMap();
+            new Predicate[] { EqualPredicate.equalPredicate("HELLO"), EqualPredicate.equalPredicate("THERE") },
+            new Transformer[] { a, b }, c).transform("WELL"));
+
+        Map<Predicate<String>, Transformer<String, String>> map = new HashMap<Predicate<String>, Transformer<String,String>>();
         map.put(EqualPredicate.equalPredicate("HELLO"), a);
         map.put(EqualPredicate.equalPredicate("THERE"), b);
         assertEquals(null, TransformerUtils.switchTransformer(map).transform("WELL"));
@@ -289,12 +293,12 @@ public class TestTransformerUtils extends junit.framework.TestCase {
         map.put(null, c);
         assertEquals("C", TransformerUtils.switchTransformer(map).transform("WELL"));
 
-        assertSame(ConstantTransformer.NULL_INSTANCE, TransformerUtils.switchTransformer(new Predicate[0], new Transformer[0]));
-        assertSame(ConstantTransformer.NULL_INSTANCE, TransformerUtils.switchTransformer(new HashMap()));
-        map = new HashMap();
+        assertEquals(ConstantTransformer.NULL_INSTANCE, TransformerUtils.switchTransformer(new Predicate[0], new Transformer[0]));
+        assertEquals(ConstantTransformer.NULL_INSTANCE, TransformerUtils.switchTransformer(new HashMap<Predicate<Object>, Transformer<Object, Object>>()));
+        map = new HashMap<Predicate<String>, Transformer<String, String>>();
         map.put(null, null);
-        assertSame(ConstantTransformer.NULL_INSTANCE, TransformerUtils.switchTransformer(map));
-            
+        assertEquals(ConstantTransformer.NULL_INSTANCE, TransformerUtils.switchTransformer(map));
+
         try {
             TransformerUtils.switchTransformer(null, null);
             fail();
@@ -304,7 +308,7 @@ public class TestTransformerUtils extends junit.framework.TestCase {
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            TransformerUtils.switchTransformer((Map) null);
+            TransformerUtils.switchTransformer((Map<Predicate<Object>, Transformer<Object, Object>>) null);
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
@@ -313,21 +317,21 @@ public class TestTransformerUtils extends junit.framework.TestCase {
         } catch (IllegalArgumentException ex) {}
         try {
             TransformerUtils.switchTransformer(
-                    new Predicate[] {PredicateUtils.truePredicate()},
-                    new Transformer[] {a,b});
+                    new Predicate[] { TruePredicate.truePredicate() },
+                    new Transformer[] { a, b });
             fail();
         } catch (IllegalArgumentException ex) {}
     }
-    
+
     // switchMapTransformer
     //------------------------------------------------------------------
 
     public void testSwitchMapTransformer() {
-        Transformer a = TransformerUtils.constantTransformer("A");
-        Transformer b = TransformerUtils.constantTransformer("B");
-        Transformer c = TransformerUtils.constantTransformer("C");
-        
-        Map map = new HashMap();
+        Transformer<String, String> a = TransformerUtils.constantTransformer("A");
+        Transformer<String, String> b = TransformerUtils.constantTransformer("B");
+        Transformer<String, String> c = TransformerUtils.constantTransformer("C");
+
+        Map<String, Transformer<String, String>> map = new HashMap<String, Transformer<String,String>>();
         map.put("HELLO", a);
         map.put("THERE", b);
         assertEquals(null, TransformerUtils.switchMapTransformer(map).transform("WELL"));
@@ -336,22 +340,22 @@ public class TestTransformerUtils extends junit.framework.TestCase {
         map.put(null, c);
         assertEquals("C", TransformerUtils.switchMapTransformer(map).transform("WELL"));
 
-        assertSame(ConstantTransformer.NULL_INSTANCE, TransformerUtils.switchMapTransformer(new HashMap()));
-        map = new HashMap();
+        assertSame(ConstantTransformer.NULL_INSTANCE, TransformerUtils.switchMapTransformer(new HashMap<Object, Transformer<Object, Object>>()));
+        map = new HashMap<String, Transformer<String, String>>();
         map.put(null, null);
         assertSame(ConstantTransformer.NULL_INSTANCE, TransformerUtils.switchMapTransformer(map));
-        
+
         try {
             TransformerUtils.switchMapTransformer(null);
             fail();
         } catch (IllegalArgumentException ex) {}
     }
-    
+
     // invokerTransformer
     //------------------------------------------------------------------
 
     public void testInvokerTransformer() {
-        List list = new ArrayList();
+        List<Object> list = new ArrayList<Object>();
         assertEquals(new Integer(0), TransformerUtils.invokerTransformer("size").transform(list));
         list.add(new Object());
         assertEquals(new Integer(1), TransformerUtils.invokerTransformer("size").transform(list));
@@ -366,27 +370,27 @@ public class TestTransformerUtils extends junit.framework.TestCase {
             fail();
         } catch (FunctorException ex) {}
     }
-    
+
     // invokerTransformer2
     //------------------------------------------------------------------
 
     public void testInvokerTransformer2() {
-        List list = new ArrayList();
-        assertEquals(Boolean.FALSE, TransformerUtils.invokerTransformer(
-            "contains", new Class[] {Object.class}, new Object[] {cString}).transform(list));
+        List<Object> list = new ArrayList<Object>();
+        assertEquals(Boolean.FALSE, TransformerUtils.invokerTransformer("contains",
+                new Class[] { Object.class }, new Object[] { cString }).transform(list));
         list.add(cString);
-        assertEquals(Boolean.TRUE, TransformerUtils.invokerTransformer(
-            "contains", new Class[] {Object.class}, new Object[] {cString}).transform(list));
-        assertEquals(null, TransformerUtils.invokerTransformer(
-            "contains", new Class[] {Object.class}, new Object[] {cString}).transform(null));
+        assertEquals(Boolean.TRUE, TransformerUtils.invokerTransformer("contains",
+                new Class[] { Object.class }, new Object[] { cString }).transform(list));
+        assertEquals(null, TransformerUtils.invokerTransformer("contains",
+                new Class[] { Object.class }, new Object[] { cString }).transform(null));
 
         try {
             TransformerUtils.invokerTransformer(null, null, null);
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            TransformerUtils.invokerTransformer(
-                "noSuchMethod", new Class[] {Object.class}, new Object[] {cString}).transform(new Object());
+            TransformerUtils.invokerTransformer("noSuchMethod", new Class[] { Object.class },
+                    new Object[] { cString }).transform(new Object());
             fail();
         } catch (FunctorException ex) {}
         try {
@@ -394,7 +398,7 @@ public class TestTransformerUtils extends junit.framework.TestCase {
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            TransformerUtils.invokerTransformer("badArgs", new Class[] {Object.class}, null);
+            TransformerUtils.invokerTransformer("badArgs", new Class[] { Object.class }, null);
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
@@ -402,10 +406,10 @@ public class TestTransformerUtils extends junit.framework.TestCase {
             fail();
         } catch (IllegalArgumentException ex) {}
     }
-    
+
     // stringValueTransformer
     //------------------------------------------------------------------
-    
+
     public void testStringValueTransformer() {
         assertNotNull( "StringValueTransformer should NEVER return a null value.",
            TransformerUtils.stringValueTransformer().transform(null));
@@ -414,30 +418,30 @@ public class TestTransformerUtils extends junit.framework.TestCase {
         assertEquals( "StringValueTransformer should return toString value", "6",
             TransformerUtils.stringValueTransformer().transform(new Integer(6)));
     }
-    
+
     // instantiateFactory
     //------------------------------------------------------------------
-    
+
     public void testInstantiateTransformerNull() {
         try {
-            Transformer trans = TransformerUtils.instantiateTransformer(null, new Object[] {"str"});
+            TransformerUtils.instantiateTransformer(null, new Object[] { "str" });
             fail();
         } catch (IllegalArgumentException ex) {}
         try {
-            Transformer trans = TransformerUtils.instantiateTransformer(new Class[] {}, new Object[] {"str"});
+            TransformerUtils.instantiateTransformer(new Class[] {}, new Object[] { "str" });
             fail();
         } catch (IllegalArgumentException ex) {}
-        
-        Transformer trans = TransformerUtils.instantiateTransformer(new Class[] {Long.class}, new Object[] {null});
+
+        Transformer<Class<?>, Object> trans = TransformerUtils.instantiateTransformer(new Class[] { Long.class }, new Object[] { null });
         try {
             trans.transform(String.class);
             fail();
         } catch (FunctorException ex) {}
-        
+
         trans = TransformerUtils.instantiateTransformer();
         assertEquals("", trans.transform(String.class));
-        
-        trans = TransformerUtils.instantiateTransformer(new Class[] {Long.TYPE}, new Object[] {new Long(1000L)});
+
+        trans = TransformerUtils.instantiateTransformer(new Class[] { Long.TYPE }, new Object[] { new Long(1000L) });
         assertEquals(new Date(1000L), trans.transform(Date.class));
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/TestTreeMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestTreeMap.java b/src/test/org/apache/commons/collections/TestTreeMap.java
index 100921b..4e512a4 100644
--- a/src/test/org/apache/commons/collections/TestTreeMap.java
+++ b/src/test/org/apache/commons/collections/TestTreeMap.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.
@@ -22,13 +22,13 @@ import org.apache.commons.collections.map.AbstractTestMap;
 
 /**
  * Tests TreeMap.
- * 
+ *
  * @version $Revision$ $Date$
- * 
+ *
  * @author Jason van Zyl
  */
-public abstract class TestTreeMap extends AbstractTestMap {
-    
+public abstract class TestTreeMap<K, V> extends AbstractTestMap<K, V> {
+
     public TestTreeMap(String testName) {
         super(testName);
     }
@@ -42,21 +42,25 @@ public abstract class TestTreeMap extends AbstractTestMap {
         return false;
     }
 
-    protected TreeMap map = null;
-
-    public void setUp() {
-        map = (TreeMap) makeEmptyMap();
-    }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public abstract TreeMap<K, V> makeObject();
 
     public void testNewMap() {
+        TreeMap<K, V> map = makeObject();
         assertTrue("New map is empty", map.isEmpty());
         assertEquals("New map has size zero", map.size(), 0);
     }
 
+    @SuppressWarnings("unchecked")
     public void testSearch() {
-        map.put("first", "First Item");
-        map.put("second", "Second Item");
+        TreeMap<K, V> map = makeObject();
+        map.put((K) "first", (V) "First Item");
+        map.put((K) "second", (V) "Second Item");
         assertEquals("Top item is 'Second Item'", map.get("first"), "First Item");
         assertEquals("Next Item is 'First Item'", map.get("second"), "Second Item");
     }
+
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/884baf0d/src/test/org/apache/commons/collections/TestTypedCollection.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestTypedCollection.java b/src/test/org/apache/commons/collections/TestTypedCollection.java
index 1648893..cd7f96c 100644
--- a/src/test/org/apache/commons/collections/TestTypedCollection.java
+++ b/src/test/org/apache/commons/collections/TestTypedCollection.java
@@ -27,25 +27,25 @@ import java.util.List;
  * 
  * @author Stephen Colebourne
  */
-public abstract class TestTypedCollection extends BulkTest {
+public abstract class TestTypedCollection<T> extends BulkTest {
 
     public TestTypedCollection(String name) {
         super(name);
     }
 
+    protected abstract Collection<T> typedCollection();
 
-    protected abstract Collection typedCollection();
-
-    protected Class getType() {
-        return String.class;
+    @SuppressWarnings("unchecked")
+    protected Class<T> getType() {
+        return (Class<T>) String.class;
     }
 
-
+    @SuppressWarnings("unchecked")
     public void testIllegalAdd() {
-        Collection c = typedCollection();
+        Collection<T> c = typedCollection();
         Integer i = new Integer(3);
         try {
-            c.add(i);
+            c.add((T) i);
             fail("Integer should fail string predicate.");
         } catch (IllegalArgumentException e) {
             // expected
@@ -55,15 +55,16 @@ public abstract class TestTypedCollection extends BulkTest {
     }
 
 
+    @SuppressWarnings("unchecked")
     public void testIllegalAddAll() {
-        Collection c = typedCollection();
-        List elements = new ArrayList();
+        Collection<T> c = typedCollection();
+        List<Object> elements = new ArrayList<Object>();
         elements.add("one");
         elements.add("two");
         elements.add(new Integer(3));
         elements.add("four");
         try {
-            c.addAll(elements);
+            c.addAll((Collection<? extends T>) elements);
             fail("Integer should fail string predicate.");
         } catch (IllegalArgumentException e) {
             // expected


[44/77] [abbrv] commons-collections git commit: add iterable(Iterator)

Posted by ch...@apache.org.
add iterable(Iterator)

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@751850 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/afd5d3f1
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/afd5d3f1
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/afd5d3f1

Branch: refs/heads/collections_jdk5_branch
Commit: afd5d3f1c5ce22ef248f9d312a8a3ba8f44c4198
Parents: 28228c8
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Mon Mar 9 21:34:44 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Mon Mar 9 21:34:44 2009 +0000

----------------------------------------------------------------------
 .../commons/collections/IteratorUtils.java      | 86 ++++++++++++--------
 .../commons/collections/TestIteratorUtils.java  | 14 ++++
 2 files changed, 65 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/afd5d3f1/src/java/org/apache/commons/collections/IteratorUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/IteratorUtils.java b/src/java/org/apache/commons/collections/IteratorUtils.java
index eba8e37..3d066c2 100644
--- a/src/java/org/apache/commons/collections/IteratorUtils.java
+++ b/src/java/org/apache/commons/collections/IteratorUtils.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.
@@ -55,7 +55,7 @@ import org.apache.commons.collections.iterators.UnmodifiableListIterator;
 import org.apache.commons.collections.iterators.UnmodifiableMapIterator;
 
 /**
- * Provides static utility methods and decorators for {@link Iterator} 
+ * Provides static utility methods and decorators for {@link Iterator}
  * instances. The implementations are provided in the iterators subpackage.
  * <p>
  * WARNING: Due to human error certain binary incompatabilities were introduced
@@ -67,7 +67,7 @@ import org.apache.commons.collections.iterators.UnmodifiableMapIterator;
  *
  * @since Commons Collections 2.1
  * @version $Revision$ $Date$
- * 
+ *
  * @author Stephen Colebourne
  * @author Phil Steitz
  */
@@ -93,17 +93,17 @@ public class IteratorUtils {
 
     /**
      * An ordered iterator over no elements.
-     */    
+     */
     public static final OrderedIterator<Object> EMPTY_ORDERED_ITERATOR = EmptyOrderedIterator.INSTANCE;
 
     /**
      * A map iterator over no elements.
-     */    
+     */
     public static final MapIterator<Object, Object> EMPTY_MAP_ITERATOR = EmptyMapIterator.INSTANCE;
 
     /**
      * An ordered map iterator over no elements.
-     */    
+     */
     public static final OrderedMapIterator<Object, Object> EMPTY_ORDERED_MAP_ITERATOR = EmptyOrderedMapIterator.INSTANCE;
 
     /**
@@ -132,7 +132,7 @@ public class IteratorUtils {
     /**
      * Gets an empty list iterator.
      * <p>
-     * This iterator is a valid list iterator object that will iterate 
+     * This iterator is a valid list iterator object that will iterate
      * over nothing.
      * <p>
      * WARNING: This method is binary incompatible with Commons Collections 2.1 and 2.1.1.
@@ -147,7 +147,7 @@ public class IteratorUtils {
     /**
      * Gets an empty ordered iterator.
      * <p>
-     * This iterator is a valid iterator object that will iterate 
+     * This iterator is a valid iterator object that will iterate
      * over nothing.
      *
      * @return  an ordered iterator over nothing
@@ -159,7 +159,7 @@ public class IteratorUtils {
     /**
      * Gets an empty map iterator.
      * <p>
-     * This iterator is a valid map iterator object that will iterate 
+     * This iterator is a valid map iterator object that will iterate
      * over nothing.
      *
      * @return  a map iterator over nothing
@@ -171,7 +171,7 @@ public class IteratorUtils {
     /**
      * Gets an empty ordered map iterator.
      * <p>
-     * This iterator is a valid map iterator object that will iterate 
+     * This iterator is a valid map iterator object that will iterate
      * over nothing.
      *
      * @return  a map iterator over nothing
@@ -385,7 +385,7 @@ public class IteratorUtils {
     public static <E> ResettableListIterator<E> arrayListIterator(E[] array, int start, int end) {
         return new ObjectArrayListIterator<E>(array, start, end);
     }
-    
+
     /**
      * Gets a list iterator over part of an object or primitive array.
      * <p>
@@ -404,7 +404,7 @@ public class IteratorUtils {
     public static <E> ResettableListIterator<E> arrayListIterator(Object array, int start, int end) {
         return new ArrayListIterator<E>(array, start, end);
     }
-    
+
     // Unmodifiable
     //-----------------------------------------------------------------------
     /**
@@ -418,7 +418,7 @@ public class IteratorUtils {
     public static <E> Iterator<E> unmodifiableIterator(Iterator<E> iterator) {
         return UnmodifiableIterator.decorate(iterator);
     }
-    
+
     /**
      * Gets an immutable version of a {@link ListIterator}. The returned object
      * will always throw an {@link UnsupportedOperationException} for
@@ -447,7 +447,7 @@ public class IteratorUtils {
     // Chained
     //-----------------------------------------------------------------------
     /**
-     * Gets an iterator that iterates through two {@link Iterator}s 
+     * Gets an iterator that iterates through two {@link Iterator}s
      * one after another.
      *
      * @param iterator1  the first iterators to use, not null
@@ -460,7 +460,7 @@ public class IteratorUtils {
     }
 
     /**
-     * Gets an iterator that iterates through an array of {@link Iterator}s 
+     * Gets an iterator that iterates through an array of {@link Iterator}s
      * one after another.
      *
      * @param iterators  the iterators to use, not null or empty or contain nulls
@@ -472,7 +472,7 @@ public class IteratorUtils {
     }
 
     /**
-     * Gets an iterator that iterates through a collections of {@link Iterator}s 
+     * Gets an iterator that iterates through a collections of {@link Iterator}s
      * one after another.
      *
      * @param iterators  the iterators to use, not null or empty or contain nulls
@@ -491,7 +491,7 @@ public class IteratorUtils {
      * contained in a collection of ordered {@link Iterator}s.
      * <p>
      * Given two ordered {@link Iterator}s <code>A</code> and <code>B</code>,
-     * the {@link Iterator#next()} method will return the lesser of 
+     * the {@link Iterator#next()} method will return the lesser of
      * <code>A.next()</code> and <code>B.next()</code>.
      * <p>
      * The comparator is optional. If null is specified then natural order is used.
@@ -511,7 +511,7 @@ public class IteratorUtils {
      * contained in an array of {@link Iterator}s.
      * <p>
      * Given two ordered {@link Iterator}s <code>A</code> and <code>B</code>,
-     * the {@link Iterator#next()} method will return the lesser of 
+     * the {@link Iterator#next()} method will return the lesser of
      * <code>A.next()</code> and <code>B.next()</code> and so on.
      * <p>
      * The comparator is optional. If null is specified then natural order is used.
@@ -530,7 +530,7 @@ public class IteratorUtils {
      * contained in a collection of {@link Iterator}s.
      * <p>
      * Given two ordered {@link Iterator}s <code>A</code> and <code>B</code>,
-     * the {@link Iterator#next()} method will return the lesser of 
+     * the {@link Iterator#next()} method will return the lesser of
      * <code>A.next()</code> and <code>B.next()</code> and so on.
      * <p>
      * The comparator is optional. If null is specified then natural order is used.
@@ -545,7 +545,7 @@ public class IteratorUtils {
             Collection<Iterator<? extends E>> iterators) {
         return new CollatingIterator<E>(comparator, iterators);
     }
-    
+
     // Object Graph
     //-----------------------------------------------------------------------
     /**
@@ -595,7 +595,7 @@ public class IteratorUtils {
      * <p>
      * Under many circumstances, linking Iterators together in this manner is
      * more efficient (and convenient) than using nested for loops to extract a list.
-     * 
+     *
      * @param root  the root object to start iterating from, null results in an empty iterator
      * @param transformer  the transformer to use, see above, null uses no effect transformer
      * @return a new object graph iterator
@@ -604,7 +604,7 @@ public class IteratorUtils {
     public static <E> Iterator<E> objectGraphIterator(E root, Transformer<? super E, ? extends E> transformer) {
         return new ObjectGraphIterator<E>(root, transformer);
     }
-    
+
     // Transformed
     //-----------------------------------------------------------------------
     /**
@@ -627,7 +627,7 @@ public class IteratorUtils {
         }
         return new TransformIterator<I, O>(iterator, transform);
     }
-    
+
     // Filtered
     //-----------------------------------------------------------------------
     /**
@@ -650,7 +650,7 @@ public class IteratorUtils {
         }
         return new FilterIterator<E>(iterator, predicate);
     }
-    
+
     /**
      * Gets a list iterator that filters another list iterator.
      * <p>
@@ -671,7 +671,7 @@ public class IteratorUtils {
         }
         return new FilterListIterator<E>(listIterator, predicate);
     }
-    
+
     // Looping
     //-----------------------------------------------------------------------
     /**
@@ -691,7 +691,7 @@ public class IteratorUtils {
         }
         return new LoopingIterator<E>(coll);
     }
-    
+
     /**
      * Gets an iterator that loops continuously over the supplied list.
      * <p>
@@ -726,7 +726,7 @@ public class IteratorUtils {
     }
 
     /**
-     * Gets an iterator that provides an iterator view of the given enumeration 
+     * Gets an iterator that provides an iterator view of the given enumeration
      * that will remove elements from the specified collection.
      *
      * @param enumeration  the enumeration to use
@@ -742,7 +742,7 @@ public class IteratorUtils {
         }
         return new EnumerationIterator<E>(enumeration, removeCollection);
     }
-    
+
     /**
      * Gets an enumeration that wraps an iterator.
      *
@@ -756,7 +756,7 @@ public class IteratorUtils {
         }
         return new IteratorEnumeration<E>(iterator);
     }
-    
+
     /**
      * Gets a list iterator based on a simple iterator.
      * <p>
@@ -773,7 +773,7 @@ public class IteratorUtils {
         }
         return new ListIteratorWrapper<E>(iterator);
     }
-    
+
     /**
      * Gets an array based on an iterator.
      * <p>
@@ -816,7 +816,7 @@ public class IteratorUtils {
         List<E> list = toList(iterator, 100);
         return list.toArray((E[]) Array.newInstance(arrayClass, list.size()));
     }
-    
+
     /**
      * Gets a list based on an iterator.
      * <p>
@@ -856,8 +856,8 @@ public class IteratorUtils {
         }
         return list;
     }
-    
-    /** 
+
+    /**
      * Gets a suitable Iterator for the given object.
      * <p>
      * This method can handle objects as follows
@@ -872,7 +872,7 @@ public class IteratorUtils {
      * <li>object with iterator() public method accessed by reflection
      * <li>object - singleton iterator
      * </ul>
-     * 
+     *
      * @param obj  the object to convert to an iterator
      * @return a suitable iterator, never null
      */
@@ -916,4 +916,20 @@ public class IteratorUtils {
         return singletonIterator(obj);
     }
 
+    /**
+     * Return an {@link Iterable} so that any {@link Iterator} can be used
+     * with the "foreach" statement.
+     * @param <T> element type
+     * @param iterator to wrap
+     * @return Iterable<T>
+     * @since Commons Collections 5
+     * @TODO fix version
+     */
+    public static <T> Iterable<T> iterable(final Iterator<T> iterator) {
+        return new Iterable<T>() {
+            public Iterator<T> iterator() {
+                return iterator;
+            }
+        };
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/afd5d3f1/src/test/org/apache/commons/collections/TestIteratorUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestIteratorUtils.java b/src/test/org/apache/commons/collections/TestIteratorUtils.java
index b729306..6bb142c 100644
--- a/src/test/org/apache/commons/collections/TestIteratorUtils.java
+++ b/src/test/org/apache/commons/collections/TestIteratorUtils.java
@@ -724,4 +724,18 @@ public class TestIteratorUtils extends BulkTest {
             // This is correct; ignore the exception.
         }
     }
+
+    public void testIterable() throws Exception {
+        Integer[] array = new Integer[10];
+        for (int i = 0; i < array.length; i++) {
+            array[i] = i;
+        }
+        Iterator<Integer> it = Arrays.asList(array).iterator();
+        int i = 0;
+        for (Integer o : IteratorUtils.iterable(it)) {
+            assertEquals(i, o.intValue());
+            i++;
+        }
+        assertEquals(i, array.length);
+    }
 }


[60/77] [abbrv] commons-collections git commit: Re-Fix DOAP tags

Posted by ch...@apache.org.
Re-Fix DOAP tags

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@779536 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/a68a9322
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/a68a9322
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/a68a9322

Branch: refs/heads/collections_jdk5_branch
Commit: a68a9322bca2b7dffb6ae8bfdba0aaa5beb414a3
Parents: 4da4d2f
Author: Sebastian Bazley <se...@apache.org>
Authored: Thu May 28 10:20:32 2009 +0000
Committer: Sebastian Bazley <se...@apache.org>
Committed: Thu May 28 10:20:32 2009 +0000

----------------------------------------------------------------------
 doap_collections.rdf | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/a68a9322/doap_collections.rdf
----------------------------------------------------------------------
diff --git a/doap_collections.rdf b/doap_collections.rdf
index f02a3a0..c1e9fa9 100644
--- a/doap_collections.rdf
+++ b/doap_collections.rdf
@@ -37,17 +37,17 @@ limitations under the License.
       <Version>
         <name>commons-collections</name>
         <created>2006-05-14</created>
-        <revision>3.2</version>
+        <revision>3.2</revision>
       </Version>
       <Version>
         <name>commons-collections</name>
         <created>2004-06-23</created>
-        <revision>3.1</version>
+        <revision>3.1</revision>
       </Version>
       <Version>
         <name>commons-collections</name>
         <created>2004-06-23</created>
-        <revision>2.1.1</version>
+        <revision>2.1.1</revision>
       </Version>
     </release>
     <mailing-list rdf:resource="http://commons.apache.org/mail-lists.html"/>


[37/77] [abbrv] commons-collections git commit: parameterize junit haltonfailure

Posted by ch...@apache.org.
parameterize junit haltonfailure

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@740148 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/bba9e0ca
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/bba9e0ca
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/bba9e0ca

Branch: refs/heads/collections_jdk5_branch
Commit: bba9e0ca5a09f7b7f2451ac77428cc7d6432a1b2
Parents: 0b64e12
Author: Matthew Jason Benson <mb...@apache.org>
Authored: Mon Feb 2 23:18:16 2009 +0000
Committer: Matthew Jason Benson <mb...@apache.org>
Committed: Mon Feb 2 23:18:16 2009 +0000

----------------------------------------------------------------------
 build.xml | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bba9e0ca/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 7dbada3..bf07f92 100644
--- a/build.xml
+++ b/build.xml
@@ -113,6 +113,7 @@ limitations under the License.
   <!-- JUnit -->
   <property name="test.failonerror"        value="true"/>
   <property name="test.fork"               value="true"/>
+  <property name="test.haltonfailure"      value="true"/>
 
   <!-- Maven -->
   <property name="maven.repo"  value="${user.home}/.maven/repository" />
@@ -327,7 +328,7 @@ limitations under the License.
   <target name="-test-all" depends="instrument" unless="testcase">
 	<mkdir dir="${build.reports.test}" />
 
-    <junit printsummary="yes" haltonfailure="yes" showoutput="yes">
+    <junit printsummary="yes" haltonfailure="${test.haltonfailure}" showoutput="yes">
       <classpath>
         <pathelement location="${build.instrumented}"/>
         <pathelement location="${build.classes}"/>
@@ -366,7 +367,7 @@ limitations under the License.
 
   <!-- Runs a single test -->
   <target name="-test-single" depends="compile.tests" if="testcase">
-    <junit printsummary="yes" haltonfailure="yes" showoutput="yes">
+    <junit printsummary="yes" haltonfailure="${test.haltonfailure}" showoutput="yes">
       <formatter type="brief" />
       <classpath>
         <pathelement location="${build.classes}"/>
@@ -398,7 +399,7 @@ limitations under the License.
   <target name="testjar"  depends="compile.tests,jar"
           description="Run all unit test cases">
     <echo message="Running collections tests against built jar ..."/>
-    <junit printsummary="yes" haltonfailure="yes" dir="${basedir}">
+    <junit printsummary="yes" haltonfailure="${test.haltonfailure}" dir="${basedir}">
       <classpath>
         <pathelement location="${build.jar.name}"/>
         <pathelement location="${build.tests}"/>