commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r815067 - /commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/SynchronizedList.java
Date Tue, 15 Sep 2009 05:55:45 GMT
Author: bayard
Date: Tue Sep 15 05:55:45 2009
New Revision: 815067

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

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/SynchronizedList.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/SynchronizedList.java?rev=815067&r1=815066&r2=815067&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/SynchronizedList.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/SynchronizedList.java
Tue Sep 15 05:55:45 2009
@@ -35,7 +35,7 @@
  *
  * @author Stephen Colebourne
  */
-public class SynchronizedList extends SynchronizedCollection implements List {
+public class SynchronizedList<E> extends SynchronizedCollection<E> implements
List<E> {
 
     /** Serialization version */
      private static final long serialVersionUID = -1403835447328619437L;
@@ -46,8 +46,8 @@
      * @param list  the list to decorate, must not be null
      * @throws IllegalArgumentException if list is null
      */
-    public static List decorate(List list) {
-        return new SynchronizedList(list);
+    public static <T> List<T> decorate(List<T> list) {
+        return new SynchronizedList<T>(list);
     }
     
     //-----------------------------------------------------------------------
@@ -57,7 +57,7 @@
      * @param list  the list to decorate, must not be null
      * @throws IllegalArgumentException if list is null
      */
-    protected SynchronizedList(List list) {
+    protected SynchronizedList(List<E> list) {
         super(list);
     }
 
@@ -68,7 +68,7 @@
      * @param lock  the lock to use, must not be null
      * @throws IllegalArgumentException if list is null
      */
-    protected SynchronizedList(List list, Object lock) {
+    protected SynchronizedList(List<E> list, Object lock) {
         super(list, lock);
     }
 
@@ -77,24 +77,24 @@
      * 
      * @return the decorated list
      */
-    protected List getList() {
-        return (List) collection;
+    protected List<E> getList() {
+        return (List<E>) collection;
     }
 
     //-----------------------------------------------------------------------
-    public void add(int index, Object object) {
+    public void add(int index, E object) {
         synchronized (lock) {
             getList().add(index, object);
         }
     }
 
-    public boolean addAll(int index, Collection coll) {
+    public boolean addAll(int index, Collection<? extends E> coll) {
         synchronized (lock) {
             return getList().addAll(index, coll);
         }
     }
 
-    public Object get(int index) {
+    public E get(int index) {
         synchronized (lock) {
             return getList().get(index);
         }
@@ -122,7 +122,7 @@
      * 
      * @return an iterator that must be manually synchronized on the collection
      */
-    public ListIterator listIterator() {
+    public ListIterator<E> listIterator() {
         return getList().listIterator();
     }
 
@@ -136,28 +136,28 @@
      * 
      * @return an iterator that must be manually synchronized on the collection
      */
-    public ListIterator listIterator(int index) {
+    public ListIterator<E> listIterator(int index) {
         return getList().listIterator(index);
     }
 
-    public Object remove(int index) {
+    public E remove(int index) {
         synchronized (lock) {
             return getList().remove(index);
         }
     }
 
-    public Object set(int index, Object object) {
+    public E set(int index, E object) {
         synchronized (lock) {
             return getList().set(index, object);
         }
     }
 
-    public List subList(int fromIndex, int toIndex) {
+    public List<E> subList(int fromIndex, int toIndex) {
         synchronized (lock) {
-            List list = getList().subList(fromIndex, toIndex);
+            List<E> list = getList().subList(fromIndex, toIndex);
             // the lock is passed into the constructor here to ensure that the sublist is
             // synchronized on the same lock as the parent list
-            return new SynchronizedList(list, lock);
+            return new SynchronizedList<E>(list, lock);
         }
     }
 



Mime
View raw message