From c653a2ec1246be4d4bf4a1f0f7a15ac2af027645 Mon Sep 17 00:00:00 2001 From: zhangliang Date: Sun, 24 Sep 2023 23:24:46 +0800 Subject: [PATCH] Rename StorageResourceUtils --- .../database/resource/storage/StorageResourceUtils.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/storage/StorageResourceUtils.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/storage/StorageResourceUtils.java index 5b5a7ea9fa0f0..71974b7a73bbb 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/storage/StorageResourceUtils.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/storage/StorageResourceUtils.java @@ -29,7 +29,7 @@ import java.util.stream.Collectors; /** - * Storage utility class. + * Storage resource utility class. */ @NoArgsConstructor(access = AccessLevel.PRIVATE) public final class StorageResourceUtils { @@ -41,11 +41,8 @@ public final class StorageResourceUtils { * @return storage node data sources */ public static Map getStorageNodeDataSources(final Map dataSources) { - Map result = new LinkedHashMap<>(dataSources.size(), 1F); - for (Entry entry : dataSources.entrySet()) { - result.put(new StorageNode(entry.getKey()), entry.getValue()); - } - return result; + return dataSources.entrySet().stream() + .collect(Collectors.toMap(entry -> new StorageNode(entry.getKey()), Entry::getValue, (oldValue, currentValue) -> currentValue, () -> new LinkedHashMap<>(dataSources.size(), 1F))); } /**