Java Map from Array map(String k, Object v)

Here you can find the source of map(String k, Object v)

Description

map

License

Apache License

Declaration

public static Map<String, Object> map(String k, Object v) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.HashMap;

import java.util.Map;

public class Main {
    public static Map<String, Object> map(String k, Object v) {
        Map<String, Object> map = new HashMap<String, Object>(1);
        map.put(k, v);//from  ww w.j  a v a2  s.  co  m
        return map;
    }

    public static Map<String, Object> map(String[] keys, Object[] values) {
        Map<String, Object> map = new HashMap<String, Object>(keys.length);
        for (int i = 0; i < keys.length; i++) {
            map.put(keys[i], values[i]);
        }

        return map;
    }
}

Related

  1. map(Object... objects)
  2. map(Object... objs)
  3. map(Object... objs)
  4. map(Object... oo)
  5. map(Object... params)
  6. map(String key, String val)
  7. map(String... args)
  8. map(String... args)
  9. map(String... keysAndValues)