svn commit: r1854432 - /ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/WebAppCache.java

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

svn commit: r1854432 - /ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/WebAppCache.java

mthl
Author: mthl
Date: Tue Feb 26 22:57:50 2019
New Revision: 1854432

URL: http://svn.apache.org/viewvc?rev=1854432&view=rev
Log:
Improved: Inline getAppBarWebInfos(String, Comparator, String) private method (OFBIZ-10606)

The comparator argument of this method was always ‘null’.  Use
‘java.util.TreeMap()’ constructor in the inlined function which is
equivalent to passing ‘null’ to ‘java.util.TreeMap(Comparator)’.


Modified:
    ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/WebAppCache.java

Modified: ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/WebAppCache.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/WebAppCache.java?rev=1854432&r1=1854431&r2=1854432&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/WebAppCache.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/WebAppCache.java Tue Feb 26 22:57:50 2019
@@ -21,7 +21,6 @@ package org.apache.ofbiz.webapp;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Comparator;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.TreeMap;
@@ -71,7 +70,7 @@ public class WebAppCache {
      * @return the corresponding web applications information
      */
     public List<WebappInfo> getAppBarWebInfos(String serverName) {
-        return getAppBarWebInfos(serverName, null, null);
+        return getAppBarWebInfos(serverName, null);
     }
 
     /**
@@ -87,23 +86,6 @@ public class WebAppCache {
      * @throws NullPointerException when {@code serverName} is {@code null}
      */
     public List<WebappInfo> getAppBarWebInfos(String serverName, String menuName) {
-        return getAppBarWebInfos(serverName, null, menuName);
-    }
-
-    /**
-     * Retrieves the web applications information that must be visible inside
-     * the menu {@code menuName} in the context of the server {@code serverName}.
-     * <p>
-     * When an empty string or {@code null} is used for {@code menuName},
-     * all the web application information corresponding to {@code serverName} are matched.
-     *
-     * @param serverName the name of server to match
-     * @param comp the comparator used for ordering the results
-     * @param menuName the name of the menu to match
-     * @return the corresponding web applications information
-     * @throws NullPointerException when {@code serverName} is {@code null}
-     */
-    private List<WebappInfo> getAppBarWebInfos(String serverName, Comparator<? super String> comp, String menuName) {
         String serverWebAppsKey = serverName + menuName;
         List<WebappInfo> webInfos = null;
         synchronized (serverWebApps) {
@@ -121,7 +103,7 @@ public class WebAppCache {
                         }
                     })
                     // Keep only one WebappInfo per title (the last appearing one).
-                    .collect(() -> new TreeMap<>(comp),
+                    .collect(TreeMap::new,
                             (acc, wInfo) -> {
                                 String key = UtilValidate.isNotEmpty(wInfo.position) ? wInfo.position : wInfo.title;
                                 acc.put(key, wInfo);