You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by mi...@apache.org on 2022/10/13 02:43:14 UTC

[incubator-eventmesh] branch master updated: [1535][Brindha] Replace. integer based for loop with foreach

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 0cc43c7e [1535][Brindha] Replace. integer based for loop with foreach
     new a2dd6003 Merge pull request #1551 from BrindhaEaswaramurthy/Issue-1535
0cc43c7e is described below

commit 0cc43c7e605f064a8bffe390389e6376d3dfdbb1
Author: @brindha.e <br...@thoughtworkworks.com>
AuthorDate: Wed Oct 12 22:22:35 2022 +0530

    [1535][Brindha] Replace. integer based for loop with foreach
---
 .../protocol/catalog/protos/QueryOperationsResponse.java     |  8 ++++----
 .../eventmesh/common/protocol/grpc/protos/BatchMessage.java  | 12 ++----------
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/catalog/protos/QueryOperationsResponse.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/catalog/protos/QueryOperationsResponse.java
index a0642465..541d38da 100644
--- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/catalog/protos/QueryOperationsResponse.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/catalog/protos/QueryOperationsResponse.java
@@ -180,8 +180,8 @@ public final class QueryOperationsResponse extends
     @Override
     public void writeTo(com.google.protobuf.CodedOutputStream output)
         throws java.io.IOException {
-        for (int i = 0; i < operations_.size(); i++) {
-            output.writeMessage(1, operations_.get(i));
+        for (Operation operation : operations_) {
+            output.writeMessage(1, operation);
         }
         unknownFields.writeTo(output);
     }
@@ -194,9 +194,9 @@ public final class QueryOperationsResponse extends
         }
 
         size = 0;
-        for (int i = 0; i < operations_.size(); i++) {
+        for (Operation operation : operations_) {
             size += com.google.protobuf.CodedOutputStream
-                .computeMessageSize(1, operations_.get(i));
+                .computeMessageSize(1, operation);
         }
         size += unknownFields.getSerializedSize();
         memoizedSize = size;
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/protos/BatchMessage.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/protos/BatchMessage.java
index b526d064..9b638fc5 100644
--- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/protos/BatchMessage.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/protos/BatchMessage.java
@@ -578,11 +578,7 @@ private static final long serialVersionUID = 0L;
       if (key == null) { throw new NullPointerException(); }
       java.util.Map<String, String> map =
           internalGetProperties().getMap();
-      String value = map.get(key);
-      if(value != null)
-        return  map.get(key);
-      else
-        return defaultValue;
+      return map.containsKey(key) ? map.get(key) : defaultValue;
     }
     /**
      * <code>map&lt;string, string&gt; properties = 6;</code>
@@ -1407,11 +1403,7 @@ private static final long serialVersionUID = 0L;
         if (key == null) { throw new NullPointerException(); }
         java.util.Map<String, String> map =
             internalGetProperties().getMap();
-        String value = map.get(key);
-        if(value != null)
-          return  map.get(key);
-        else
-          return defaultValue;
+        return map.containsKey(key) ? map.get(key) : defaultValue;
       }
       /**
        * <code>map&lt;string, string&gt; properties = 6;</code>


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org