Author: j16sdiz
Date: 2009-02-13 14:42:43 +0000 (Fri, 13 Feb 2009)
New Revision: 25615

Modified:
   trunk/freenet/src/freenet/support/LRUQueue.java
Log:
generic-related warning fix
more to come after db4o merge

Modified: trunk/freenet/src/freenet/support/LRUQueue.java
===================================================================
--- trunk/freenet/src/freenet/support/LRUQueue.java     2009-02-13 14:42:12 UTC 
(rev 25614)
+++ trunk/freenet/src/freenet/support/LRUQueue.java     2009-02-13 14:42:43 UTC 
(rev 25615)
@@ -34,7 +34,7 @@
                if (obj == null)
                        throw new NullPointerException();
 
-               QItem<T> insert = (QItem<T>) hash.get(obj);
+               QItem<T> insert = hash.get(obj);
         if (insert == null) {
                        insert = new QItem<T>(obj);
             hash.put(obj,insert);
@@ -52,7 +52,7 @@
                if (obj == null)
                        throw new NullPointerException();
 
-               QItem<T> insert = (QItem<T>) hash.get(obj);
+               QItem<T> insert = hash.get(obj);
         if (insert == null) {
                        insert = new QItem<T>(obj);
             hash.put(obj,insert);
@@ -68,7 +68,7 @@
      */
        public final synchronized T pop() {
         if ( list.size() > 0 ) {
-                       return (T) ((QItem<T>) hash.remove(((QItem<T>) 
list.pop()).obj)).obj;
+                       return (hash.remove(((QItem<T>) list.pop()).obj)).obj;
         } else {
             return null;
         }
@@ -105,6 +105,7 @@
     }
 
        private class ItemEnumeration implements Enumeration<T> {
+
                private Enumeration<QItem<T>> source = list.reverseElements();
        
         public boolean hasMoreElements() {
@@ -112,7 +113,7 @@
         }
 
                public T nextElement() {
-                       return ((QItem<T>) source.nextElement()).obj;
+                       return source.nextElement().obj;
         }
     }
 
@@ -146,11 +147,12 @@
         * recently used object is in <tt>[0]</tt>, the <strong>most</strong>
         * recently used object is in <tt>[array.length-1]</tt>.
         */
+
        public synchronized Object[] toArrayOrdered() {
                Object[] array = new Object[list.size()];
                int x = 0;
-               for (Enumeration<T> e = list.reverseElements(); 
e.hasMoreElements();) {
-                       array[x++] = ((QItem<?>) e.nextElement()).obj;
+               for (Enumeration<QItem<T>> e = list.reverseElements(); 
e.hasMoreElements();) {
+                       array[x++] = e.nextElement().obj;
                }
                return array;
        }
@@ -164,14 +166,15 @@
         *            The array to fill in. If it is too small a new array of 
the
         *            same type will be allocated.
         */
+
        public synchronized <E> E[] toArrayOrdered(E[] array) {
                array = toArray(array);
                int listSize = list.size();
                if(array.length != listSize)
                        throw new 
IllegalStateException("array.length="+array.length+" but list.size="+listSize);
                int x = 0;
-               for (Enumeration<T> e = list.reverseElements(); 
e.hasMoreElements();) {
-                       array[x++] = (E) ((QItem<T>) e.nextElement()).obj;
+               for (Enumeration<QItem<T>> e = list.reverseElements(); 
e.hasMoreElements();) {
+                       array[x++] = (E) e.nextElement().obj;
                }
                return array;
        }

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to