Author: bayard
Date: Tue Sep 15 05:56:38 2009
New Revision: 815096

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

    ------------------------------------------------------------------------
    r471186 | scolebourne | 2006-11-04 05:47:51 -0800 (Sat, 04 Nov 2006) | 1 
line
    
    Remove getSet() and getSortedSet() - use decorated()
    ------------------------------------------------------------------------
    r471173 | scolebourne | 2006-11-04 04:07:39 -0800 (Sat, 04 Nov 2006) | 1 
line
    
    Abstract*Decorator - Generify and use covariant return types
    ------------------------------------------------------------------------

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

Modified: 
commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java
URL: 
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java?rev=815096&r1=815095&r2=815096&view=diff
==============================================================================
--- 
commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java
 (original)
+++ 
commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java
 Tue Sep 15 05:56:38 2009
@@ -25,12 +25,18 @@
  * <p>
  * Methods are forwarded directly to the decorated set.
  *
+ * @param <E> the type of the elements in the sorted set
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
  * @author Stephen Colebourne
  */
-public abstract class AbstractSortedSetDecorator extends AbstractSetDecorator 
implements SortedSet {
+public abstract class AbstractSortedSetDecorator<E>
+        extends AbstractSetDecorator<E>
+        implements SortedSet<E> {
+
+    /** Serialization version */
+    private static final long serialVersionUID = -3462240946294214398L;
 
     /**
      * Constructor only used in deserialization, do not use otherwise.
@@ -46,42 +52,42 @@
      * @param set  the set to decorate, must not be null
      * @throws IllegalArgumentException if set is null
      */
-    protected AbstractSortedSetDecorator(Set set) {
+    protected AbstractSortedSetDecorator(Set<E> set) {
         super(set);
     }
 
     /**
-     * Gets the sorted set being decorated.
+     * Gets the set being decorated.
      * 
      * @return the decorated set
      */
-    protected SortedSet getSortedSet() {
-        return (SortedSet) getCollection();
+    protected SortedSet<E> decorated() {
+        return (SortedSet<E>) super.decorated();
     }
-    
+
     //-----------------------------------------------------------------------
-    public SortedSet subSet(Object fromElement, Object toElement) {
-        return getSortedSet().subSet(fromElement, toElement);
+    public SortedSet<E> subSet(E fromElement, E toElement) {
+        return decorated().subSet(fromElement, toElement);
     }
 
-    public SortedSet headSet(Object toElement) {
-        return getSortedSet().headSet(toElement);
+    public SortedSet<E> headSet(E toElement) {
+        return decorated().headSet(toElement);
     }
 
-    public SortedSet tailSet(Object fromElement) {
-        return getSortedSet().tailSet(fromElement);
+    public SortedSet<E> tailSet(E fromElement) {
+        return decorated().tailSet(fromElement);
     }
 
-    public Object first() {
-        return getSortedSet().first();
+    public E first() {
+        return decorated().first();
     }
 
-    public Object last() {
-        return getSortedSet().last();
+    public E last() {
+        return decorated().last();
     }
 
-    public Comparator comparator() {
-        return getSortedSet().comparator();
+    public Comparator<? super E> comparator() {
+        return decorated().comparator();
     }
 
 }


Reply via email to