Java Map Create createMapFor(String... args)

Here you can find the source of createMapFor(String... args)

Description

create Map For

License

Open Source License

Declaration

public static Map<String, String> createMapFor(String... args) 

Method Source Code


//package com.java2s;

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

public class Main {
    public static Map<String, String> createMapFor(String... args) {
        if (args.length % 2 > 0)
            throw new IllegalArgumentException(
                    "The argument count must be event to account for key/value pairs.  You provided " + args.length
                            + " arguments.");
        Map<String, String> argMap = new HashMap<String, String>();
        for (int i = 0; i < args.length; i = i + 2) {
            argMap.put(args[i], args[i + 1]);
        }/*from  www . j  a  va2s . c  om*/
        return argMap;
    }
}

Related

  1. createMap(String[] list1, String[] list2)
  2. createMap(String[] mappings, String sep)
  3. createMap(T... _args)
  4. createMap(U... items)
  5. createMap_pollutantHourly()
  6. createMapFromArgs(Object... args)
  7. createMapFromProperties(Properties stringSubstitutionVariables)
  8. createMapFromWebsiteList(String[] websiteList)
  9. map(final Entry... entries)