You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by yu...@apache.org on 2022/04/15 03:11:08 UTC

[rocketmq] branch develop updated: [ISSUE #4103] Simplify string-list-join in `Message` (#4104)

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

yuzhou pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new aa908ce82 [ISSUE #4103] Simplify string-list-join in `Message` (#4104)
aa908ce82 is described below

commit aa908ce825e5e20bcc0d7b81c8c1e241a81664fe
Author: dugenkui <du...@foxmail.com>
AuthorDate: Fri Apr 15 11:10:53 2022 +0800

    [ISSUE #4103] Simplify string-list-join in `Message` (#4104)
    
    [ISSUE #4103] Simplify string-list-join in `Message`
---
 .../main/java/org/apache/rocketmq/common/message/Message.java  | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/common/src/main/java/org/apache/rocketmq/common/message/Message.java b/common/src/main/java/org/apache/rocketmq/common/message/Message.java
index 48e1f45a7..bafc15c31 100644
--- a/common/src/main/java/org/apache/rocketmq/common/message/Message.java
+++ b/common/src/main/java/org/apache/rocketmq/common/message/Message.java
@@ -128,14 +128,10 @@ public class Message implements Serializable {
         return this.getProperty(MessageConst.PROPERTY_KEYS);
     }
 
-    public void setKeys(Collection<String> keys) {
-        StringBuilder sb = new StringBuilder();
-        for (String k : keys) {
-            sb.append(k);
-            sb.append(MessageConst.KEY_SEPARATOR);
-        }
+    public void setKeys(Collection<String> keyCollection) {
+        String keys = String.join(MessageConst.KEY_SEPARATOR, keyCollection);
 
-        this.setKeys(sb.toString().trim());
+        this.setKeys(keys);
     }
 
     public int getDelayTimeLevel() {