From dfee8f750c41495c4ec4e91295472fc1c9c65b8f Mon Sep 17 00:00:00 2001 From: Tomoe0364010 <276068026@qq.com> Date: Sat, 7 Jul 2018 12:05:20 +0800 Subject: [PATCH] tiny things Use ` !isEmpty()` replace `size() > 0` --- .../main/java/com/netflix/loadbalancer/BaseLoadBalancer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/BaseLoadBalancer.java b/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/BaseLoadBalancer.java index 3f6655a3..5cf8b626 100644 --- a/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/BaseLoadBalancer.java +++ b/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/BaseLoadBalancer.java @@ -441,7 +441,7 @@ public void addServer(Server newServer) { */ @Override public void addServers(List newServers) { - if (newServers != null && newServers.size() > 0) { + if (newServers != null && !newServers.isEmpty()) { try { ArrayList newList = new ArrayList(); newList.addAll(allServerList); @@ -516,7 +516,7 @@ public void setServersList(List lsrv) { boolean listChanged = false; if (!allServerList.equals(allServers)) { listChanged = true; - if (changeListeners != null && changeListeners.size() > 0) { + if (changeListeners != null && !changeListeners.isEmpty()) { List oldList = ImmutableList.copyOf(allServerList); List newList = ImmutableList.copyOf(allServers); for (ServerListChangeListener l: changeListeners) {