You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ba...@apache.org on 2009/09/15 07:54:04 UTC

svn commit: r815016 - /commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java

Author: bayard
Date: Tue Sep 15 05:54:04 2009
New Revision: 815016

URL: http://svn.apache.org/viewvc?rev=815016&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
    ------------------------------------------------------------------------

Modified:
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java?rev=815016&r1=815015&r2=815016&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java (original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java Tue Sep 15 05:54:04 2009
@@ -35,8 +35,8 @@
  *
  * @author Stephen Colebourne
  */
-public class SynchronizedSortedBag
-        extends SynchronizedBag implements SortedBag {
+public class SynchronizedSortedBag<E>
+        extends SynchronizedBag<E> implements SortedBag<E> {
 
     /** Serialization version */
     private static final long serialVersionUID = 722374056718497858L;
@@ -48,8 +48,8 @@
      * @return a new synchronized SortedBag
      * @throws IllegalArgumentException if bag is null
      */
-    public static SortedBag decorate(SortedBag bag) {
-        return new SynchronizedSortedBag(bag);
+    public static <E> SortedBag<E> decorate(SortedBag<E> bag) {
+        return new SynchronizedSortedBag<E>(bag);
     }
     
     //-----------------------------------------------------------------------
@@ -59,7 +59,7 @@
      * @param bag  the bag to decorate, must not be null
      * @throws IllegalArgumentException if bag is null
      */
-    protected SynchronizedSortedBag(SortedBag bag) {
+    protected SynchronizedSortedBag(SortedBag<E> bag) {
         super(bag);
     }
 
@@ -70,7 +70,7 @@
      * @param lock  the lock to use, must not be null
      * @throws IllegalArgumentException if bag is null
      */
-    protected SynchronizedSortedBag(Bag bag, Object lock) {
+    protected SynchronizedSortedBag(Bag<E> bag, Object lock) {
         super(bag, lock);
     }
 
@@ -79,24 +79,24 @@
      * 
      * @return the decorated bag
      */
-    protected SortedBag getSortedBag() {
-        return (SortedBag) collection;
+    protected SortedBag<E> getSortedBag() {
+        return (SortedBag<E>) collection;
     }
     
     //-----------------------------------------------------------------------
-    public synchronized Object first() {
+    public synchronized E first() {
         synchronized (lock) {
             return getSortedBag().first();
         }
     }
 
-    public synchronized Object last() {
+    public synchronized E last() {
         synchronized (lock) {
             return getSortedBag().last();
         }
     }
 
-    public synchronized Comparator comparator() {
+    public synchronized Comparator<? super E> comparator() {
         synchronized (lock) {
             return getSortedBag().comparator();
         }