Java Map from Array map(String... args)

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

Description

map

License

Open Source License

Declaration

static Map<String, String> map(String... args) 

Method Source Code

//package com.java2s;

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

public class Main {
    static Map<String, String> map(String... args) {
        if (args == null || args.length == 0) {
            return Collections.emptyMap();
        }/*from w w  w .  j a va  2  s .c  o m*/
        Map<String, String> map = new HashMap<String, String>();
        for (int i = 0; i < args.length;) {
            map.put(args[i++], args[i++]);
        }

        return map;
    }
}

Related

  1. map(Object... oo)
  2. map(Object... params)
  3. map(String k, Object v)
  4. map(String key, String val)
  5. map(String... args)
  6. map(String... keysAndValues)
  7. map(String... keyValues)
  8. map(String... strings)
  9. map(String... vals)