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

org.openstack4j.openstack.common.functions.HeaderNameValuesToHeaderMap Maven / Gradle / Ivy

There is a newer version: 3.2.0
Show newest version
package org.openstack4j.openstack.common.functions;

import java.util.List;
import java.util.Map;

import org.openstack4j.model.common.header.HeaderNameValue;

import com.google.common.base.Function;
import com.google.common.collect.Maps;

/**
 * Transforms a List of HeaderNameValue objects into a Header compatible Map
 * 
 * @author Jeremy Unruh
 */
public class HeaderNameValuesToHeaderMap implements Function, Map> {

    public static HeaderNameValuesToHeaderMap INSTANCE = new HeaderNameValuesToHeaderMap();
    
    @Override
    public Map apply(List input) {
        Map result = Maps.newHashMap();
        
        for (HeaderNameValue nv : input) {
            result.put(nv.getName(), nv.getValue());
        }
        return result;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy