details:   https://code.openbravo.com/erp/devel/pi/rev/4b209651d928
changeset: 33969:4b209651d928
user:      Carlos Aristu <carlos.aristu <at> openbravo.com>
date:      Thu May 17 10:28:43 2018 +0200
summary:   related to issue 38548: minor code improvements

  Using the correct alternative when applies:
    - Use isEmpty() to check whether the collection is empty or not
    - Use diamond operator
    - Iterate over the "entrySet" instead of the "keySet"

diffstat:

 
modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorDefaultFilterActionHandler.java
 |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r d0cc878c5657 -r 4b209651d928 
modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorDefaultFilterActionHandler.java
--- 
a/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorDefaultFilterActionHandler.java
     Thu May 17 10:05:57 2018 +0200
+++ 
b/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorDefaultFilterActionHandler.java
     Thu May 17 10:28:43 2018 +0200
@@ -22,6 +22,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 
 import javax.enterprise.context.ApplicationScoped;
 import javax.servlet.http.HttpSession;
@@ -90,7 +91,7 @@
       
obc.add(Restrictions.isNotNull(SelectorField.PROPERTY_DEFAULTEXPRESSION));
 
       List<SelectorField> selFields = obc.list();
-      if (selFields.size() == 0) {
+      if (selFields.isEmpty()) {
         return result;
       }
 
@@ -192,12 +193,13 @@
   }
 
   private Map<String, String> getParameterMap(Map<String, Object> parameters) {
-    Map<String, String> params = new HashMap<String, String>();
-    for (String key : parameters.keySet()) {
+    Map<String, String> params = new HashMap<>();
+    for (Entry<String, Object> entry : parameters.entrySet()) {
+      String key = entry.getKey();
       if (key.equals(KernelConstants.HTTP_SESSION) || 
key.equals(KernelConstants.HTTP_REQUEST)) {
         continue;
       }
-      params.put(key, (String) parameters.get(key));
+      params.put(key, (String) entry.getValue());
     }
     return params;
   }

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to