ofbiz-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doo...@apache.org
Subject svn commit: r1417212 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java
Date Tue, 04 Dec 2012 21:54:43 GMT
Author: doogie
Date: Tue Dec  4 21:54:42 2012
New Revision: 1417212

URL: http://svn.apache.org/viewvc?rev=1417212&view=rev
Log:
OPTIMIZE: Remove the use of numRetrieved as a check to see how much has
been fetched.  Either list.size() could be used, or, even better, just
decrement the number wanted, and continue until everything is fetched.

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

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java?rev=1417212&r1=1417211&r2=1417212&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java Tue Dec
 4 21:54:42 2012
@@ -485,13 +485,11 @@ public class EntityListIterator implemen
             list.add(this.currentGenericValue());
 
             GenericValue nextValue = null;
-            // init numRetrieved to one since we have already grabbed the initial one
-            int numRetrieved = 1;
 
-            //number > numRetrieved comparison goes first to avoid the unwanted call to
next
-            while (number > numRetrieved && (nextValue = this.next()) != null)
{
+            //number > 1 comparison goes first to avoid the unwanted call to next
+            while (number > 1 && (nextValue = this.next()) != null) {
                 list.add(nextValue);
-                numRetrieved++;
+                number--;
             }
             return list;
         } catch (SQLException e) {



Mime
View raw message