[ofbiz-framework] branch trunk updated: Improved: Replace single method call lambda with method reference(OFBIZ-11835)

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

[ofbiz-framework] branch trunk updated: Improved: Replace single method call lambda with method reference(OFBIZ-11835)

Pawan Verma-2
This is an automated email from the ASF dual-hosted git repository.

pawan pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 18f5dad  Improved: Replace single method call lambda with method reference(OFBIZ-11835)
18f5dad is described below

commit 18f5dadd930f3198d9519180b37466101c221178
Author: Pawan Verma <[hidden email]>
AuthorDate: Mon Jun 22 20:59:44 2020 +0530

    Improved: Replace single method call lambda with method reference(OFBIZ-11835)
   
    Thanks: Jacques for the review.
---
 .../main/java/org/apache/ofbiz/base/container/ComponentContainer.java | 2 +-
 .../ofbiz/base/util/collections/MultivaluedMapContextAdapter.java     | 2 +-
 .../src/main/java/org/apache/ofbiz/entity/GenericDelegator.java       | 4 ++--
 .../entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtil.java | 2 +-
 .../java/org/apache/ofbiz/entityext/data/EntityDataLoadContainer.java | 2 +-
 .../src/main/java/org/apache/ofbiz/testtools/TestRunContainer.java    | 2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/container/ComponentContainer.java b/framework/base/src/main/java/org/apache/ofbiz/base/container/ComponentContainer.java
index 789eea7..29c0125 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/container/ComponentContainer.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/container/ComponentContainer.java
@@ -167,7 +167,7 @@ public class ComponentContainer implements Container {
                     .map(cmpnt -> directoryPath.resolve(cmpnt).toAbsolutePath().normalize())
                     .filter(Files::isDirectory)
                     .filter(dir -> Files.exists(dir.resolve(ComponentConfig.OFBIZ_COMPONENT_XML_FILENAME)))
-                    .forEach(componentDir -> retrieveComponentConfig(componentDir));
+                    .forEach(ComponentContainer::retrieveComponentConfig);
         }
     }
 
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/MultivaluedMapContextAdapter.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/MultivaluedMapContextAdapter.java
index 5eb853d..aefc78c 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/MultivaluedMapContextAdapter.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/MultivaluedMapContextAdapter.java
@@ -97,7 +97,7 @@ public class MultivaluedMapContextAdapter<K, V> implements Map<K, V> {
     @Override
     public Set<Entry<K, V>> entrySet() {
         return adaptee.keySet().stream()
-                .collect(Collectors.toMap(k -> k, k -> get(k)))
+                .collect(Collectors.toMap(k -> k, this::get))
                 .entrySet();
     }
 }
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java
index f1ceb1a..5077f96 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java
@@ -312,7 +312,7 @@ public class GenericDelegator implements Delegator {
             return;
         }
 
-        Callable<EntityEcaHandler<?>> creator = () -> createEntityEcaHandler();
+        Callable<EntityEcaHandler<?>> creator = this::createEntityEcaHandler;
         FutureTask<EntityEcaHandler<?>> futureTask = new FutureTask<>(creator);
         if (this.entityEcaHandler.compareAndSet(null, futureTask)) {
             // This needs to use BATCH, as the service engine might add it's own items into a thread pool.
@@ -2602,7 +2602,7 @@ public class GenericDelegator implements Delegator {
             return;
         }
 
-        Callable<DistributedCacheClear> creator = () -> createDistributedCacheClear();
+        Callable<DistributedCacheClear> creator = this::createDistributedCacheClear;
         FutureTask<DistributedCacheClear> futureTask = new FutureTask<>(creator);
         if (distributedCacheClear.compareAndSet(null, futureTask)) {
             ExecutionPool.GLOBAL_BATCH.submit(futureTask);
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtil.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtil.java
index 3dfab82..bd873f3 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtil.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtil.java
@@ -388,7 +388,7 @@ public final class EntityUtil {
         if (values == null || UtilValidate.isEmpty(condition)) {
             return values;
         }
-        return values.stream().filter(value -> condition.entityMatches(value)).collect(toList());
+        return values.stream().filter(condition::entityMatches).collect(toList());
     }
 
     public static <T extends GenericEntity> List<T> filterOutByCondition(List<T> values, EntityCondition condition) {
diff --git a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataLoadContainer.java b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataLoadContainer.java
index 4d166ba..e21c9e6 100644
--- a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataLoadContainer.java
+++ b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataLoadContainer.java
@@ -91,7 +91,7 @@ public class EntityDataLoadContainer implements Container {
         // get the data-load properties passed by the user in the command line
         Map<String, String> loadDataProps = ofbizCommands.stream()
                 .filter(command -> command.getName().equals(StartupCommandUtil.StartupOption.LOAD_DATA.getName()))
-                .map(command -> command.getProperties())
+                .map(StartupCommand::getProperties)
                 .findFirst().get();
 
         /* disable job scheduler, JMS listener and startup services
diff --git a/framework/testtools/src/main/java/org/apache/ofbiz/testtools/TestRunContainer.java b/framework/testtools/src/main/java/org/apache/ofbiz/testtools/TestRunContainer.java
index 9d7465f..b8a1df3 100644
--- a/framework/testtools/src/main/java/org/apache/ofbiz/testtools/TestRunContainer.java
+++ b/framework/testtools/src/main/java/org/apache/ofbiz/testtools/TestRunContainer.java
@@ -63,7 +63,7 @@ public class TestRunContainer implements Container {
         // get the test properties passed by the user in the command line
         Map<String, String> testProps = ofbizCommands.stream()
                 .filter(command -> command.getName().equals(StartupCommandUtil.StartupOption.TEST.getName()))
-                .map(command -> command.getProperties())
+                .map(StartupCommand::getProperties)
                 .findFirst().get();
 
         // set selected log level if passed by user