struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject svn commit: r1133045 - /struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/MakeIterator.java
Date Tue, 07 Jun 2011 15:24:31 GMT
Author: lukaszlenart
Date: Tue Jun  7 15:24:31 2011
New Revision: 1133045

URL: http://svn.apache.org/viewvc?rev=1133045&view=rev
Log:
WW-3645 - uses  EnumerationIterator to simplify logic

Modified:
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/MakeIterator.java

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/MakeIterator.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/MakeIterator.java?rev=1133045&r1=1133044&r2=1133045&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/MakeIterator.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/MakeIterator.java Tue
Jun  7 15:24:31 2011
@@ -21,18 +21,18 @@
 
 package org.apache.struts2.util;
 
+import org.apache.struts2.util.IteratorFilterSupport.EnumerationIterator;
+
 import java.lang.reflect.Array;
 import java.util.ArrayList;
-import java.util.Collection;
+import java.util.Arrays;
 import java.util.Enumeration;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 
 
 /**
  * MakeIterator.
- *
  */
 public class MakeIterator {
 
@@ -91,18 +91,9 @@ public class MakeIterator {
 
             iterator = list.iterator();
         } else if (value instanceof Enumeration) {
-            Enumeration enumeration = (Enumeration) value;
-            ArrayList list = new ArrayList();
-
-            while (enumeration.hasMoreElements()) {
-                list.add(enumeration.nextElement());
-            }
-
-            iterator = list.iterator();
+            iterator = new EnumerationIterator((Enumeration) value);
         } else {
-            List list = new ArrayList(1);
-            list.add(value);
-            iterator = list.iterator();
+            iterator = Arrays.asList(value).iterator();
         }
 
         return iterator;



Mime
View raw message