Java Map Add arrayToMap(Object[] array, Object value)

Here you can find the source of arrayToMap(Object[] array, Object value)

Description

array To Map

License

Open Source License

Declaration

public static Map<?, ?> arrayToMap(Object[] array, Object value) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    public static Map<?, ?> arrayToMap(Object[] array, Object value) {
        if (array == null) {
            return null;
        }/*from w w  w.ja  v a  2  s  .c o m*/
        HashMap<Object, Object> map = new HashMap<Object, Object>();
        for (Object object : array) {
            map.put(object, value);
        }
        return map;
    }
}

Related

  1. arrayAsMap(Object... t)
  2. arrayToMap(int[] array)
  3. arrayToMap(Map destMap, Object[]... oaaArray)
  4. ArrayToMap(Object[] a)
  5. arrayToMap(Object[] array)
  6. ArrayToMap(T[] list)
  7. arrayToMap(X[] objs)