Author: bayard
Date: Tue Sep 15 05:56:41 2009
New Revision: 815098

URL: http://svn.apache.org/viewvc?rev=815098&view=rev
Log:
Merging from -r468106:814127 of collections_jdk5_branch - namely where this 
code was generified; mostly in r738956.

Also see the following revisions:

    ------------------------------------------------------------------------
    r555925 | skestle | 2007-07-13 03:39:24 -0700 (Fri, 13 Jul 2007) | 2 lines
    
    Added Edwin Tellman's patch for COLLECTIONS-243.  
    It all seems pretty reasonable, and it should all be checked again as the 
project is worked through
    ------------------------------------------------------------------------
    r471202 | scolebourne | 2006-11-04 06:21:44 -0800 (Sat, 04 Nov 2006) | 1 
line
    
    Remove getCollection() - use covariant decorated()
    ------------------------------------------------------------------------

Modified:
    
commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/PredicatedSet.java

Modified: 
commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/PredicatedSet.java
URL: 
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/PredicatedSet.java?rev=815098&r1=815097&r2=815098&view=diff
==============================================================================
--- 
commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/PredicatedSet.java
 (original)
+++ 
commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/PredicatedSet.java
 Tue Sep 15 05:56:41 2009
@@ -40,7 +40,7 @@
  * @author Stephen Colebourne
  * @author Paul Jack
  */
-public class PredicatedSet extends PredicatedCollection implements Set {
+public class PredicatedSet<E> extends PredicatedCollection<E> implements 
Set<E> {
 
     /** Serialization version */
     private static final long serialVersionUID = -684521469108685117L;
@@ -53,11 +53,12 @@
      * 
      * @param set  the set to decorate, must not be null
      * @param predicate  the predicate to use for validation, must not be null
+     * @return a decorated set
      * @throws IllegalArgumentException if set or predicate is null
      * @throws IllegalArgumentException if the set contains invalid elements
      */
-    public static Set decorate(Set set, Predicate predicate) {
-        return new PredicatedSet(set, predicate);
+    public static <T> Set<T> decorate(Set<T> set, Predicate<? super T> 
predicate) {
+        return new PredicatedSet<T>(set, predicate);
     }
 
     //-----------------------------------------------------------------------
@@ -72,7 +73,7 @@
      * @throws IllegalArgumentException if set or predicate is null
      * @throws IllegalArgumentException if the set contains invalid elements
      */
-    protected PredicatedSet(Set set, Predicate predicate) {
+    protected PredicatedSet(Set<E> set, Predicate<? super E> predicate) {
         super(set, predicate);
     }
 
@@ -81,8 +82,8 @@
      * 
      * @return the decorated set
      */
-    protected Set getSet() {
-        return (Set) getCollection();
+    protected Set<E> decorated() {
+        return (Set<E>) super.decorated();
     }
 
 }


Reply via email to