Author: jonesde
Date: Fri Oct 13 13:32:37 2006
New Revision: 463812

URL: http://svn.apache.org/viewvc?view=rev&rev=463812
Log:
I don't know why we were using .iterator().next(); for this, it's rather 
inefficient to create the iterator object to just get the first element when we 
can call get(0) just fine, especially when we are checking the size in each 
case beforehand; so, this is more efficient

Modified:
    
incubator/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java

Modified: 
incubator/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java
URL: 
http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java?view=diff&rev=463812&r1=463811&r2=463812
==============================================================================
--- 
incubator/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java
 (original)
+++ 
incubator/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java
 Fri Oct 13 13:32:37 2006
@@ -51,7 +51,7 @@
 
     public static GenericValue getFirst(List values) {
         if ((values != null) && (values.size() > 0)) {
-            return (GenericValue) values.iterator().next();
+            return (GenericValue) values.get(0);
         } else {
             return null;
         }
@@ -63,7 +63,7 @@
                 return null;
             }
             if (values.size() == 1) {
-                return (GenericValue) values.iterator().next();
+                return (GenericValue) values.get(0);
             } else {
                 throw new IllegalArgumentException("Passed List had more than 
one value.");
             }


Reply via email to