All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.newrelic.agent.attributes.AttributesUtils Maven / Gradle / Ivy

The newest version!
/*
 *
 *  * Copyright 2020 New Relic Corporation. All rights reserved.
 *  * SPDX-License-Identifier: Apache-2.0
 *
 */

package com.newrelic.agent.attributes;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

public class AttributesUtils {

    public static Map appendAttributePrefixes(Map> input) {
        if (input == null || input.isEmpty()) {
            return Collections.emptyMap();
        }

        Map toReturn = new HashMap<>();
        String prefix;
        Map attributes;
        for (Entry> current : input.entrySet()) {
            prefix = current.getKey();
            attributes = current.getValue();
            if (attributes != null) {
                for (Entry att : attributes.entrySet()) {
                    toReturn.put(prefix + att.getKey(), att.getValue());
                }
            }
        }
        return toReturn;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy