commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r815101 - /commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/SynchronizedSortedSet.java
Date Tue, 15 Sep 2009 05:56:44 GMT
Author: bayard
Date: Tue Sep 15 05:56:44 2009
New Revision: 815101

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

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/SynchronizedSortedSet.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/SynchronizedSortedSet.java?rev=815101&r1=815100&r2=815101&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/SynchronizedSortedSet.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/SynchronizedSortedSet.java
Tue Sep 15 05:56:44 2009
@@ -34,93 +34,93 @@
  *
  * @author Stephen Colebourne
  */
-public class SynchronizedSortedSet extends SynchronizedCollection implements SortedSet {
+public class SynchronizedSortedSet<E> extends SynchronizedCollection<E> implements
SortedSet<E> {
 
     /** Serialization version */
     private static final long serialVersionUID = 2775582861954500111L;
 
     /**
      * Factory method to create a synchronized set.
-     * 
+     *
      * @param set  the set to decorate, must not be null
      * @throws IllegalArgumentException if set is null
      */
-    public static SortedSet decorate(SortedSet set) {
-        return new SynchronizedSortedSet(set);
+    public static <T> SortedSet<T> decorate(SortedSet<T> set) {
+        return new SynchronizedSortedSet<T>(set);
     }
-    
+
     //-----------------------------------------------------------------------
     /**
      * Constructor that wraps (not copies).
-     * 
+     *
      * @param set  the set to decorate, must not be null
      * @throws IllegalArgumentException if set is null
      */
-    protected SynchronizedSortedSet(SortedSet set) {
+    protected SynchronizedSortedSet(SortedSet<E> set) {
         super(set);
     }
 
     /**
      * Constructor that wraps (not copies).
-     * 
+     *
      * @param set  the set to decorate, must not be null
      * @param lock  the lock object to use, must not be null
      * @throws IllegalArgumentException if set is null
      */
-    protected SynchronizedSortedSet(SortedSet set, Object lock) {
+    protected SynchronizedSortedSet(SortedSet<E> set, Object lock) {
         super(set, lock);
     }
 
     /**
      * Gets the decorated set.
-     * 
+     *
      * @return the decorated set
      */
-    protected SortedSet getSortedSet() {
-        return (SortedSet) collection;
+    protected SortedSet<E> getSortedSet() {
+        return (SortedSet<E>) collection;
     }
 
     //-----------------------------------------------------------------------
-    public SortedSet subSet(Object fromElement, Object toElement) {
+    public SortedSet<E> subSet(E fromElement, E toElement) {
         synchronized (lock) {
-            SortedSet set = getSortedSet().subSet(fromElement, toElement);
+            SortedSet<E> set = getSortedSet().subSet(fromElement, toElement);
             // the lock is passed into the constructor here to ensure that the
             // subset is synchronized on the same lock as the parent
-            return new SynchronizedSortedSet(set, lock);
+            return new SynchronizedSortedSet<E>(set, lock);
         }
     }
 
-    public SortedSet headSet(Object toElement) {
+    public SortedSet<E> headSet(E toElement) {
         synchronized (lock) {
-            SortedSet set = getSortedSet().headSet(toElement);
+            SortedSet<E> set = getSortedSet().headSet(toElement);
             // the lock is passed into the constructor here to ensure that the
             // headset is synchronized on the same lock as the parent
-            return new SynchronizedSortedSet(set, lock);
+            return new SynchronizedSortedSet<E>(set, lock);
         }
     }
 
-    public SortedSet tailSet(Object fromElement) {
+    public SortedSet<E> tailSet(E fromElement) {
         synchronized (lock) {
-            SortedSet set = getSortedSet().tailSet(fromElement);
+            SortedSet<E> set = getSortedSet().tailSet(fromElement);
             // the lock is passed into the constructor here to ensure that the
             // tailset is synchronized on the same lock as the parent
-            return new SynchronizedSortedSet(set, lock);
+            return new SynchronizedSortedSet<E>(set, lock);
         }
     }
 
-    public Object first() {
+    public E first() {
         synchronized (lock) {
             return getSortedSet().first();
         }
     }
 
-    public Object last() {
+    public E last() {
         synchronized (lock) {
             return getSortedSet().last();
         }
     }
 
-    public Comparator comparator() {
+    public Comparator<? super E> comparator() {
         synchronized (lock) {
             return getSortedSet().comparator();
         }



Mime
View raw message