svn commit: r926856 - /ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r926856 - /ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java

lektran
Author: lektran
Date: Tue Mar 23 23:39:13 2010
New Revision: 926856

URL: http://svn.apache.org/viewvc?rev=926856&view=rev
Log:
Simplify some list manipulation

Modified:
    ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java?rev=926856&r1=926855&r2=926856&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java Tue Mar 23 23:39:13 2010
@@ -271,12 +271,7 @@ public class CategoryWorker {
                 // if cur category is in crumb, remove everything after it and return
                 int cindex = trail.lastIndexOf(currentCategoryId);
 
-                if (cindex < (trail.size() - 1)) {
-                    for (int i = trail.size() - 1; i > cindex; i--) {
-                        trail.remove(i);
-                        //if (Debug.infoOn()) Debug.logInfo("[CategoryWorker.setTrail] Removed after current category index: " + i + " catname: " + deadCat, module);
-                    }
-                }
+                trail = trail.subList(0, cindex);
                 return trail;
             } else {
                 // current category is not in the list, and no previous category was specified, go back to the beginning
@@ -300,13 +295,7 @@ public class CategoryWorker {
         } else {
             // remove all categories after the previous category, preparing for adding the current category
             int index = trail.indexOf(previousCategoryId);
-
-            if (index < (trail.size() - 1)) {
-                for (int i = trail.size() - 1; i > index; i--) {
-                    trail.remove(i);
-                    //if (Debug.infoOn()) Debug.logInfo("[CategoryWorker.setTrail] Removed after previous category index: " + i + " catname: " + deadCat, module);
-                }
-            }
+            trail = trail.subList(0, index);
         }
 
         // add the current category to the end of the list