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

wangdan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git


The following commit(s) were added to refs/heads/master by this push:
     new a6965acd5 refactor(java-client): optimize the code style for checking 
if the list is empty (#2122)
a6965acd5 is described below

commit a6965acd5c5dbcf329d1ec83929b4ed27b2bc364
Author: Dan Wang <[email protected]>
AuthorDate: Mon Sep 23 11:38:35 2024 +0800

    refactor(java-client): optimize the code style for checking if the list is 
empty (#2122)
---
 .../java/org/apache/pegasus/client/PegasusTable.java | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git 
a/java-client/src/main/java/org/apache/pegasus/client/PegasusTable.java 
b/java-client/src/main/java/org/apache/pegasus/client/PegasusTable.java
index ef27a706c..a64e3e115 100644
--- a/java-client/src/main/java/org/apache/pegasus/client/PegasusTable.java
+++ b/java-client/src/main/java/org/apache/pegasus/client/PegasusTable.java
@@ -260,7 +260,7 @@ public class PegasusTable implements PegasusTableInterface {
     List<blob> sortKeyBlobs = new ArrayList<blob>();
     Map<ByteBuffer, byte[]> setKeyMap = null;
 
-    if (sortKeys != null && sortKeys.size() > 0) {
+    if (sortKeys != null && !sortKeys.isEmpty()) {
       setKeyMap = new TreeMap<ByteBuffer, byte[]>();
       for (int i = 0; i < sortKeys.size(); i++) {
         byte[] sortKey = sortKeys.get(i);
@@ -552,7 +552,7 @@ public class PegasusTable implements PegasusTableInterface {
           new PException("Invalid parameter: hashKey length should be less 
than UINT16_MAX"));
       return promise;
     }
-    if (values == null || values.size() == 0) {
+    if (values == null || values.isEmpty()) {
       promise.setFailure(new PException("Invalid parameter: values should not 
be null or empty"));
       return promise;
     }
@@ -1147,7 +1147,7 @@ public class PegasusTable implements 
PegasusTableInterface {
   @Override
   public void batchGet(List<Pair<byte[], byte[]>> keys, List<byte[]> values, 
int timeout)
       throws PException {
-    if (keys == null || keys.size() == 0) {
+    if (keys == null || keys.isEmpty()) {
       throw new PException("Invalid parameter: keys should not be null or 
empty");
     }
     if (values == null) {
@@ -1175,7 +1175,7 @@ public class PegasusTable implements 
PegasusTableInterface {
   public int batchGetByPartitions(
       List<Pair<byte[], byte[]>> keys, List<Pair<PException, byte[]>> results, 
int timeout)
       throws PException {
-    if (keys == null || keys.size() == 0) {
+    if (keys == null || keys.isEmpty()) {
       throw new PException("Invalid parameter: keys should not be null or 
empty");
     }
     if (results == null) {
@@ -1265,7 +1265,7 @@ public class PegasusTable implements 
PegasusTableInterface {
   public int batchGet2(
       List<Pair<byte[], byte[]>> keys, List<Pair<PException, byte[]>> results, 
int timeout)
       throws PException {
-    if (keys == null || keys.size() == 0) {
+    if (keys == null || keys.isEmpty()) {
       throw new PException("Invalid parameter: keys should not be null or 
empty");
     }
     if (results == null) {
@@ -1392,7 +1392,7 @@ public class PegasusTable implements 
PegasusTableInterface {
   public void batchMultiGet(
       List<Pair<byte[], List<byte[]>>> keys, List<HashKeyData> values, int 
timeout)
       throws PException {
-    if (keys == null || keys.size() == 0) {
+    if (keys == null || keys.isEmpty()) {
       throw new PException("Invalid parameter: keys should not be null or 
empty");
     }
     if (values == null) {
@@ -1426,7 +1426,7 @@ public class PegasusTable implements 
PegasusTableInterface {
       List<Pair<PException, HashKeyData>> results,
       int timeout)
       throws PException {
-    if (keys == null || keys.size() == 0) {
+    if (keys == null || keys.isEmpty()) {
       throw new PException("Invalid parameter: keys should not be null or 
empty");
     }
     if (results == null) {
@@ -1610,7 +1610,7 @@ public class PegasusTable implements 
PegasusTableInterface {
   @Override
   public void batchMultiSet(List<HashKeyData> items, int ttlSeconds, int 
timeout)
       throws PException {
-    if (items == null || items.size() == 0) {
+    if (items == null || items.isEmpty()) {
       throw new PException("Invalid parameter: items should not be null or 
empty");
     }
     if (ttlSeconds < 0) {
@@ -1683,7 +1683,7 @@ public class PegasusTable implements 
PegasusTableInterface {
 
   @Override
   public void batchDel(List<Pair<byte[], byte[]>> keys, int timeout) throws 
PException {
-    if (keys == null || keys.size() == 0) {
+    if (keys == null || keys.isEmpty()) {
       throw new PException("Invalid parameter: keys should not be null or 
empty");
     }
     List<Future<Void>> futures = new ArrayList<Future<Void>>();
@@ -1850,7 +1850,7 @@ public class PegasusTable implements 
PegasusTableInterface {
 
   @Override
   public void batchMultiDel(List<Pair<byte[], List<byte[]>>> keys, int 
timeout) throws PException {
-    if (keys == null || keys.size() == 0) {
+    if (keys == null || keys.isEmpty()) {
       throw new PException("Invalid parameter: keys should not be null or 
empty");
     }
     List<Future<Void>> futures = new ArrayList<Future<Void>>();


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to