[jboss-svn-commits] JBoss Common SVN: r1945 - trunk/src/main/org/jboss/util/collection

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Aug 11 12:39:26 EDT 2006


Author: adrian at jboss.org
Date: 2006-08-11 12:39:21 -0400 (Fri, 11 Aug 2006)
New Revision: 1945

Modified:
   trunk/src/main/org/jboss/util/collection/CollectionsFactory.java
   trunk/src/main/org/jboss/util/collection/LazyList.java
   trunk/src/main/org/jboss/util/collection/LazyMap.java
   trunk/src/main/org/jboss/util/collection/LazySet.java
Log:
Generification - reverted until we have retro build.

Modified: trunk/src/main/org/jboss/util/collection/CollectionsFactory.java
===================================================================
--- trunk/src/main/org/jboss/util/collection/CollectionsFactory.java	2006-08-11 15:41:06 UTC (rev 1944)
+++ trunk/src/main/org/jboss/util/collection/CollectionsFactory.java	2006-08-11 16:39:21 UTC (rev 1945)
@@ -1,37 +1,40 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
 package org.jboss.util.collection;
 
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.CopyOnWriteArraySet;
 
+import org.jboss.util.collection.LazyList;
+import org.jboss.util.collection.LazyMap;
+import org.jboss.util.collection.LazySet;
+
+import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
+import EDU.oswego.cs.dl.util.concurrent.CopyOnWriteArrayList;
+import EDU.oswego.cs.dl.util.concurrent.CopyOnWriteArraySet;
+
 /**
- * TempCollectionsFactory.
- *
- * FIXME: Generise the common version
+ * Collections factory.
  * 
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision$
@@ -41,48 +44,48 @@
    /**
     * Defines the map implementation
     */
-   public static final <K, V> Map<K, V> createLazyMap()
+   public static final Map createLazyMap()
    {
-      return new LazyMap<K, V>();
+      return new LazyMap();
    }
 
    /**
     * Defines the list implementation
     */
-   public static final <T> List <T> createLazyList()
+   public static final List createLazyList()
    {
-      return new LazyList<T>();
+      return new LazyList();
    }
 
    /**
     * Defines the set implementation
     */
-   public static final <T> Set<T> createLazySet()
+   public static final Set createLazySet()
    {
-      return new LazySet<T>();
+      return new LazySet();
    }
 
    /**
     * Defines the concurrent map implementation
     */
-   public static final <K, V> Map<K, V> createConcurrentReaderMap()
+   public static final Map createConcurrentReaderMap()
    {
-      return new ConcurrentHashMap<K, V>();
+      return new ConcurrentReaderHashMap();
    }
 
    /**
     * Defines the concurrent list implementation
     */
-   public static final <T> List<T> createCopyOnWriteList()
+   public static final List createCopyOnWriteList()
    {
-      return new CopyOnWriteArrayList<T>();
+      return new CopyOnWriteArrayList();
    }
 
    /**
     * Defines the concurrent set implementation
     */
-   public static final <T> Set<T> createCopyOnWriteSet()
+   public static final Set createCopyOnWriteSet()
    {
-      return new CopyOnWriteArraySet<T>();
+      return new CopyOnWriteArraySet();
    }
 }

Modified: trunk/src/main/org/jboss/util/collection/LazyList.java
===================================================================
--- trunk/src/main/org/jboss/util/collection/LazyList.java	2006-08-11 15:41:06 UTC (rev 1944)
+++ trunk/src/main/org/jboss/util/collection/LazyList.java	2006-08-11 16:39:21 UTC (rev 1945)
@@ -34,19 +34,19 @@
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision$
  */
-public class LazyList<T> implements List<T>
+public class LazyList implements List
 {
    /** The delegate list */
-   private List<T> delegate = Collections.emptyList(); 
+   private List delegate = Collections.EMPTY_LIST; 
 
-   public void add(int index, T element)
+   public void add(int index, Object element)
    {
       if (delegate instanceof ArrayList == false)
-         delegate = new ArrayList<T>(delegate);
+         delegate = new ArrayList(delegate);
       delegate.add(index, element);
    }
 
-   public boolean add(T o)
+   public boolean add(Object o)
    {
       if (delegate == Collections.EMPTY_LIST)
       {
@@ -56,28 +56,28 @@
       else
       {
          if (delegate instanceof ArrayList == false)
-            delegate = new ArrayList<T>(delegate);
+            delegate = new ArrayList(delegate);
          return delegate.add(o);
       }
    }
 
-   public boolean addAll(Collection<? extends T> c)
+   public boolean addAll(Collection c)
    {
       if (delegate instanceof ArrayList == false)
-         delegate = new ArrayList<T>(delegate);
+         delegate = new ArrayList(delegate);
       return delegate.addAll(c);
    }
 
-   public boolean addAll(int index, Collection<? extends T> c)
+   public boolean addAll(int index, Collection c)
    {
       if (delegate instanceof ArrayList == false)
-         delegate = new ArrayList<T>(delegate);
+         delegate = new ArrayList(delegate);
       return delegate.addAll(index, c);
    }
 
    public void clear()
    {
-      delegate = Collections.emptyList();
+      delegate = Collections.EMPTY_LIST;
    }
 
    public boolean contains(Object o)
@@ -85,12 +85,12 @@
       return delegate.contains(o);
    }
 
-   public boolean containsAll(Collection<?> c)
+   public boolean containsAll(Collection c)
    {
       return delegate.containsAll(c);
    }
 
-   public T get(int index)
+   public Object get(int index)
    {
       return delegate.get(index);
    }
@@ -105,7 +105,7 @@
       return delegate.isEmpty();
    }
 
-   public Iterator<T> iterator()
+   public Iterator iterator()
    {
       return delegate.iterator();
    }
@@ -115,48 +115,48 @@
       return delegate.lastIndexOf(o);
    }
 
-   public ListIterator<T> listIterator()
+   public ListIterator listIterator()
    {
       return delegate.listIterator();
    }
 
-   public ListIterator<T> listIterator(int index)
+   public ListIterator listIterator(int index)
    {
       return delegate.listIterator(index);
    }
 
-   public T remove(int index)
+   public Object remove(int index)
    {
       if (delegate instanceof ArrayList == false)
-         delegate = new ArrayList<T>(delegate);
+         delegate = new ArrayList(delegate);
       return delegate.remove(index);
    }
 
    public boolean remove(Object o)
    {
       if (delegate instanceof ArrayList == false)
-         delegate = new ArrayList<T>(delegate);
+         delegate = new ArrayList(delegate);
       return delegate.remove(o);
    }
 
-   public boolean removeAll(Collection<?> c)
+   public boolean removeAll(Collection c)
    {
       if (delegate instanceof ArrayList == false)
-         delegate = new ArrayList<T>(delegate);
-      return delegate.removeAll(c);
+         delegate = new ArrayList(delegate);
+      return delegate.remove(c);
    }
 
-   public boolean retainAll(Collection<?> c)
+   public boolean retainAll(Collection c)
    {
       if (delegate instanceof ArrayList == false)
-         delegate = new ArrayList<T>(delegate);
+         delegate = new ArrayList(delegate);
       return delegate.retainAll(c);
    }
 
-   public T set(int index, T element)
+   public Object set(int index, Object element)
    {
       if (delegate instanceof ArrayList == false)
-         delegate = new ArrayList<T>(delegate);
+         delegate = new ArrayList(delegate);
       return delegate.set(index, element);
    }
 
@@ -165,7 +165,7 @@
       return delegate.size();
    }
 
-   public List<T> subList(int fromIndex, int toIndex)
+   public List subList(int fromIndex, int toIndex)
    {
       return delegate.subList(fromIndex, toIndex);
    }
@@ -175,7 +175,7 @@
       return delegate.toArray();
    }
 
-   public <T> T[] toArray(T[] a)
+   public Object[] toArray(Object[] a)
    {
       return delegate.toArray(a);
    }

Modified: trunk/src/main/org/jboss/util/collection/LazyMap.java
===================================================================
--- trunk/src/main/org/jboss/util/collection/LazyMap.java	2006-08-11 15:41:06 UTC (rev 1944)
+++ trunk/src/main/org/jboss/util/collection/LazyMap.java	2006-08-11 16:39:21 UTC (rev 1945)
@@ -33,14 +33,14 @@
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision$
  */
-public class LazyMap<K, V> implements Map<K, V>
+public class LazyMap implements Map
 {
    /** The delegate map */
-   private Map<K, V> delegate = Collections.emptyMap();
+   private Map delegate = Collections.EMPTY_MAP;
    
    public void clear()
    {
-      delegate = Collections.emptyMap();
+      delegate = Collections.EMPTY_MAP;
    }
 
    public boolean containsKey(Object key)
@@ -53,12 +53,12 @@
       return delegate.containsValue(value);
    }
 
-   public Set<Map.Entry<K, V>> entrySet()
+   public Set entrySet()
    {
       return delegate.entrySet();
    }
 
-   public V get(Object key)
+   public Object get(Object key)
    {
       return delegate.get(key);
    }
@@ -68,12 +68,12 @@
       return delegate.isEmpty();
    }
 
-   public Set<K> keySet()
+   public Set keySet()
    {
       return delegate.keySet();
    }
 
-   public V put(K key, V value)
+   public Object put(Object key, Object value)
    {
       if (delegate == Collections.EMPTY_MAP)
       {
@@ -83,22 +83,22 @@
       else
       {
          if (delegate instanceof HashMap == false)
-            delegate = new HashMap<K, V>(delegate);
+            delegate = new HashMap(delegate);
          return delegate.put(key, value);
       }
    }
 
-   public void putAll(Map<? extends K, ? extends V> t)
+   public void putAll(Map t)
    {
       if (delegate instanceof HashMap == false)
-         delegate = new HashMap<K, V>(delegate);
+         delegate = new HashMap(delegate);
       delegate.putAll(t);
    }
 
-   public V remove(Object key)
+   public Object remove(Object key)
    {
       if (delegate instanceof HashMap == false)
-         delegate = new HashMap<K, V>(delegate);
+         delegate = new HashMap(delegate);
       return delegate.remove(key);
    }
 
@@ -107,7 +107,7 @@
       return delegate.size();
    }
 
-   public Collection<V> values()
+   public Collection values()
    {
       return delegate.values();
    }

Modified: trunk/src/main/org/jboss/util/collection/LazySet.java
===================================================================
--- trunk/src/main/org/jboss/util/collection/LazySet.java	2006-08-11 15:41:06 UTC (rev 1944)
+++ trunk/src/main/org/jboss/util/collection/LazySet.java	2006-08-11 16:39:21 UTC (rev 1945)
@@ -33,12 +33,12 @@
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision$
  */
-public class LazySet<T> implements Set<T>
+public class LazySet implements Set
 {
    /** The delegate set */
-   private Set<T> delegate = Collections.emptySet();
+   private Set delegate = Collections.EMPTY_SET;
    
-   public boolean add(T o)
+   public boolean add(Object o)
    {
       if (delegate == Collections.EMPTY_SET)
       {
@@ -48,21 +48,21 @@
       else
       {
          if (delegate instanceof HashSet == false)
-            delegate = new HashSet<T>(delegate);
+            delegate = new HashSet(delegate);
          return delegate.add(o);
       }
    }
 
-   public boolean addAll(Collection<? extends T> c)
+   public boolean addAll(Collection c)
    {
       if (delegate instanceof HashSet == false)
-         delegate = new HashSet<T>(delegate);
+         delegate = new HashSet(delegate);
       return delegate.addAll(c);
    }
 
    public void clear()
    {
-      delegate = Collections.emptySet();
+      delegate = Collections.EMPTY_SET;
    }
 
    public boolean contains(Object o)
@@ -70,7 +70,7 @@
       return delegate.contains(o);
    }
 
-   public boolean containsAll(Collection<?> c)
+   public boolean containsAll(Collection c)
    {
       return delegate.containsAll(c);
    }
@@ -80,7 +80,7 @@
       return delegate.isEmpty();
    }
 
-   public Iterator<T> iterator()
+   public Iterator iterator()
    {
       return delegate.iterator();
    }
@@ -88,21 +88,21 @@
    public boolean remove(Object o)
    {
       if (delegate instanceof HashSet == false)
-         delegate = new HashSet<T>(delegate);
+         delegate = new HashSet(delegate);
       return delegate.remove(o);
    }
 
-   public boolean removeAll(Collection<?> c)
+   public boolean removeAll(Collection c)
    {
       if (delegate instanceof HashSet == false)
-         delegate = new HashSet<T>(delegate);
+         delegate = new HashSet(delegate);
       return delegate.removeAll(c);
    }
 
-   public boolean retainAll(Collection<?> c)
+   public boolean retainAll(Collection c)
    {
       if (delegate instanceof HashSet == false)
-         delegate = new HashSet<T>(delegate);
+         delegate = new HashSet(delegate);
       return delegate.retainAll(c);
    }
 
@@ -116,7 +116,7 @@
       return delegate.toArray();
    }
 
-   public <T> T[] toArray(T[] a)
+   public Object[] toArray(Object[] a)
    {
       return delegate.toArray(a);
    }




More information about the jboss-svn-commits mailing list