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:jstrac...@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:joncr...@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;

Reply via email to