1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5  * the License. A copy of the License is located at
6  * 
7  * http://aws.amazon.com/apache2.0
8  * 
9  * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10  * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11  * and limitations under the License.
12  */

13
14 package software.amazon.awssdk.services.s3.model;
15
16 import java.util.Collections;
17 import java.util.HashMap;
18 import java.util.Map;
19 import software.amazon.awssdk.annotations.Generated;
20 import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
21 import software.amazon.awssdk.core.util.SdkAutoConstructMap;
22
23 @Generated("software.amazon.awssdk:codegen")
24 final class MetadataCopier {
25     static Map<String, String> copy(Map<String, String> metadataParam) {
26         if (metadataParam == null || metadataParam instanceof SdkAutoConstructMap) {
27             return DefaultSdkAutoConstructMap.getInstance();
28         }
29         Map<String, String> metadataParamCopy = metadataParam.entrySet().stream()
30                 .collect(HashMap::new, (m, e) -> m.put(e.getKey(), e.getValue()), HashMap::putAll);
31         return Collections.unmodifiableMap(metadataParamCopy);
32     }
33 }
34