Author: bayard Date: Tue Sep 15 05:54:02 2009 New Revision: 815014 URL: http://svn.apache.org/viewvc?rev=815014&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 ------------------------------------------------------------------------ r471201 | scolebourne | 2006-11-04 06:17:26 -0800 (Sat, 04 Nov 2006) | 1 line Remove getBag() - use covariant decorated() ------------------------------------------------------------------------ Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/PredicatedSortedBag.java Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/PredicatedSortedBag.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/PredicatedSortedBag.java?rev=815014&r1=815013&r2=815014&view=diff ============================================================================== --- commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/PredicatedSortedBag.java (original) +++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/PredicatedSortedBag.java Tue Sep 15 05:54:02 2009 @@ -40,8 +40,8 @@ * @author Stephen Colebourne * @author Paul Jack */ -public class PredicatedSortedBag - extends PredicatedBag implements SortedBag { +public class PredicatedSortedBag<E> + extends PredicatedBag<E> implements SortedBag<E> { /** Serialization version */ private static final long serialVersionUID = 3448581314086406616L; @@ -58,8 +58,8 @@ * @throws IllegalArgumentException if bag or predicate is null * @throws IllegalArgumentException if the bag contains invalid elements */ - public static SortedBag decorate(SortedBag bag, Predicate predicate) { - return new PredicatedSortedBag(bag, predicate); + public static <T> SortedBag<T> decorate(SortedBag<T> bag, Predicate<? super T> predicate) { + return new PredicatedSortedBag<T>(bag, predicate); } //----------------------------------------------------------------------- @@ -74,7 +74,7 @@ * @throws IllegalArgumentException if bag or predicate is null * @throws IllegalArgumentException if the bag contains invalid elements */ - protected PredicatedSortedBag(SortedBag bag, Predicate predicate) { + protected PredicatedSortedBag(SortedBag<E> bag, Predicate<? super E> predicate) { super(bag, predicate); } @@ -83,21 +83,21 @@ * * @return the decorated bag */ - protected SortedBag getSortedBag() { - return (SortedBag) getCollection(); + protected SortedBag<E> decorated() { + return (SortedBag<E>) super.decorated(); } //----------------------------------------------------------------------- - public Object first() { - return getSortedBag().first(); + public E first() { + return decorated().first(); } - public Object last() { - return getSortedBag().last(); + public E last() { + return decorated().last(); } - public Comparator comparator() { - return getSortedBag().comparator(); + public Comparator<? super E> comparator() { + return decorated().comparator(); } }