replace hashset addAll method to constructure (#3879)

Co-authored-by: 席朝东 <xichaodong@xichaodongdeMacBook-Pro.local>
This commit is contained in:
Tristeza
2022-05-08 14:41:33 +08:00
committed by GitHub
co-authored by 席朝东
parent c046404eed
commit d7e940a29a
2 changed files with 2 additions and 11 deletions
@@ -999,11 +999,7 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner {
@Override
public Set<SubscriptionData> subscriptions() {
Set<SubscriptionData> subSet = new HashSet<SubscriptionData>();
subSet.addAll(this.rebalanceImpl.getSubscriptionInner().values());
return subSet;
return new HashSet<SubscriptionData>(this.rebalanceImpl.getSubscriptionInner().values());
}
@Override
@@ -273,12 +273,7 @@ public class DefaultMQProducerImpl implements MQProducerInner {
@Override
public Set<String> getPublishTopicList() {
Set<String> topicList = new HashSet<String>();
for (String key : this.topicPublishInfoTable.keySet()) {
topicList.add(key);
}
return topicList;
return new HashSet<String>(this.topicPublishInfoTable.keySet());
}
@Override