You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/04/02 12:15:45 UTC

[GitHub] [rocketmq] dugenkui03 opened a new issue #4103: Join string list in `Message`

dugenkui03 opened a new issue #4103:
URL: https://github.com/apache/rocketmq/issues/4103


   Replace the implementions of `Message#setKeys` with `String.join`, and we can simply optimized the join operation(cpu or gc) depending on jvm/jdk.
   
   ```java
       public void setKeys(Collection<String> keys) {
           StringBuilder sb = new StringBuilder();
           for (String k : keys) {
               sb.append(k);
               sb.append(MessageConst.KEY_SEPARATOR);
           }
   
           this.setKeys(sb.toString().trim());
       }
   ```
   
   
   ```java
   this.setKeys(String.join(MessageConst.KEY_SEPARATOR, keys));
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org