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

com.braintreegateway.util.MapUtils Maven / Gradle / Ivy

The newest version!
package com.braintreegateway.util;

import java.util.HashMap;
import java.util.Map;

public class MapUtils {
    public static Map toMap(Object... args) {
        if (args.length % 2 == 1) {
            throw new RuntimeException("toMap must be called with an even number of parameters");
        }
        HashMap map = new HashMap();
        for (int i = 0; i < args.length; i += 2) {
            String key = String.valueOf(args[i]);
            Object value = args[i + 1];
            map.put(key, value);
        }
        return map;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy