You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by hy...@apache.org on 2020/01/08 01:58:10 UTC
[dubbo] branch master updated: optimize collection judgment method
in ConfigParser.java (#5584)
This is an automated email from the ASF dual-hosted git repository.
hyunkun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 9f0a07e optimize collection judgment method in ConfigParser.java (#5584)
9f0a07e is described below
commit 9f0a07e8302f248eb43e218c1cd08085cc081570
Author: withthewind <wi...@aliyun.com>
AuthorDate: Wed Jan 8 09:57:54 2020 +0800
optimize collection judgment method in ConfigParser.java (#5584)
---
.../apache/dubbo/rpc/cluster/configurator/parser/ConfigParser.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/parser/ConfigParser.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/parser/ConfigParser.java
index 6f0b884..44dc350 100644
--- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/parser/ConfigParser.java
+++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/parser/ConfigParser.java
@@ -83,7 +83,7 @@ public class ConfigParser {
urlBuilder.append("&configVersion=").append(config.getConfigVersion());
List<String> apps = item.getApplications();
- if (apps != null && apps.size() > 0) {
+ if (CollectionUtils.isNotEmpty(apps)) {
apps.forEach(app -> urls.add(URL.valueOf(urlBuilder.append("&application=").append(app).toString())));
} else {
urls.add(URL.valueOf(urlBuilder.toString()));
@@ -103,7 +103,7 @@ public class ConfigParser {
if (services == null) {
services = new ArrayList<>();
}
- if (services.size() == 0) {
+ if (services.isEmpty()) {
services.add("*");
}
for (String s : services) {
@@ -195,7 +195,7 @@ public class ConfigParser {
if (addresses == null) {
addresses = new ArrayList<>();
}
- if (addresses.size() == 0) {
+ if (addresses.isEmpty()) {
addresses.add(ANYHOST_VALUE);
}
return addresses;