Author: erwan
Date: Mon Mar 26 11:06:08 2012 New Revision: 1305308 URL: http://svn.apache.org/viewvc?rev=1305308&view=rev Log: Replacement of iterators with for-each loops for product component Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/image/ScaleImage.java ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/image/ScaleImage.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/image/ScaleImage.java?rev=1305308&r1=1305307&r2=1305308&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/image/ScaleImage.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/image/ScaleImage.java Mon Mar 26 11:06:08 2012 @@ -25,7 +25,6 @@ import java.io.File; import java.io.IOException; import java.lang.NullPointerException; import java.lang.SecurityException; -import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; @@ -335,9 +334,7 @@ public class ScaleImage { } /* scale Image for each Size Type */ - Iterator<String> sizeIter = sizeTypeList.iterator(); - while (sizeIter.hasNext()) { - String sizeType = sizeIter.next(); + for(String sizeType : sizeTypeList) { resultScaleImgMap.putAll(ImageTransform.scaleImage(bufImg, imgHeight, imgWidth, imgPropertyMap, sizeType, locale)); if (resultScaleImgMap.containsKey("responseMessage") && resultScaleImgMap.get("responseMessage").equals("success")) { Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java?rev=1305308&r1=1305307&r2=1305308&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java Mon Mar 26 11:06:08 2012 @@ -30,7 +30,6 @@ import java.io.UnsupportedEncodingExcept import java.io.Writer; import java.nio.ByteBuffer; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; @@ -370,10 +369,7 @@ public class ImageManagementServices { } /* scale Image for each Size Type */ - Iterator<String> sizeIter = sizeTypeList.iterator(); - while (sizeIter.hasNext()) { - String sizeType = sizeIter.next(); - + for(String sizeType : sizeTypeList) { resultScaleImgMap.putAll(ImageTransform.scaleImage(bufImg, imgHeight, imgWidth, imgPropertyMap, sizeType, locale)); if (resultScaleImgMap.containsKey("responseMessage") && resultScaleImgMap.get("responseMessage").equals("success")) { Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java?rev=1305308&r1=1305307&r2=1305308&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java Mon Mar 26 11:06:08 2012 @@ -21,12 +21,10 @@ package org.ofbiz.product.price; import java.math.BigDecimal; import java.sql.Timestamp; import java.util.Collection; -import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.TreeSet; -import java.util.Map.Entry; import javolution.util.FastList; import javolution.util.FastMap; @@ -530,9 +528,7 @@ public class PriceServices { if (UtilValidate.isNotEmpty(currencyDefaultUomId) && UtilValidate.isNotEmpty(currencyUomIdTo) && !currencyDefaultUomId.equals(currencyUomIdTo)) { if(UtilValidate.isNotEmpty(result)){ Map<String, Object> convertPriceMap = FastMap.newInstance(); - Iterator<Entry<String, Object>> it= result.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry<String, Object> entry = it.next(); + for(Map.Entry<String, Object> entry : result.entrySet()) { BigDecimal tempPrice = BigDecimal.ZERO; if(entry.getKey() == "basePrice") tempPrice = (BigDecimal) entry.getValue(); |
Free forum by Nabble | Edit this page |