You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/02/18 09:54:49 UTC

[GitHub] [shardingsphere] strongduanmu commented on a change in pull request #15498: Replace high frequency stream with loop

strongduanmu commented on a change in pull request #15498:
URL: https://github.com/apache/shardingsphere/pull/15498#discussion_r809842031



##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
##########
@@ -314,7 +314,13 @@ public boolean isAllBindingTables(final ShardingSphereSchema schema, final SQLSt
     }
     
     private Optional<BindingTableRule> findBindingTableRule(final Collection<String> logicTableNames) {
-        return logicTableNames.stream().map(this::findBindingTableRule).filter(Optional::isPresent).findFirst().orElse(Optional.empty());
+        for (String logicTableName : logicTableNames) {

Review comment:
       Please rename logicTableName with each.

##########
File path: shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/statement/dml/DeleteStatementContext.java
##########
@@ -56,8 +55,12 @@ public DeleteStatementContext(final DeleteStatement sqlStatement) {
     }
     
     private Collection<SimpleTableSegment> filterAliasDeleteTable(final Collection<SimpleTableSegment> tableSegments) {
-        Map<String, SimpleTableSegment> aliasTableSegmentMap = tableSegments.stream().filter(each 
-            -> each.getAlias().isPresent()).collect(Collectors.toMap(each -> each.getAlias().get(), Function.identity(), (oldValue, currentValue) -> oldValue));
+        Map<String, SimpleTableSegment> aliasTableSegmentMap = new HashMap<>(tableSegments.size(), 1f);
+        for (SimpleTableSegment tableSegment : tableSegments) {

Review comment:
       Rename tableSegment with each.




-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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