Java Map Add arrayToMap(Map destMap, Object[]... oaaArray)

Here you can find the source of arrayToMap(Map destMap, Object[]... oaaArray)

Description

Converts the given array or key/value arrays to a map.

License

Open Source License

Parameter

Parameter Description
destMap Keys and values are put into this map.
oaaArray Array of arrays containing the keys and values.

Declaration

@SuppressWarnings({ "unchecked", "rawtypes" })
public static void arrayToMap(Map destMap, Object[]... oaaArray) 

Method Source Code

//package com.java2s;
/**/*w  w  w .java 2  s .c o  m*/
 * (c) 2006 Cordys R&D B.V. All rights reserved. The computer program(s) is the
 * proprietary information of Cordys B.V. and provided under the relevant
 * License Agreement containing restrictions on use and disclosure. Use is
 * subject to the License Agreement.
 */

import java.util.Map;

public class Main {
    /**
     * Converts the given array or key/value arrays to a map.
     *
     * <p>This version takes the destination map instead of creating a new one.</p>
     *
     * @param  destMap   Keys and values are put into this map.
     * @param  oaaArray  Array of arrays containing the keys and values.
     */
    @SuppressWarnings({ "unchecked", "rawtypes" })
    public static void arrayToMap(Map destMap, Object[]... oaaArray) {
        for (Object[] oaMapping : oaaArray) {
            destMap.put(oaMapping[0], oaMapping[1]);
        }
    }
}

Related

  1. addToMapMap(Map> map, K1 key1, K2 key2, V value)
  2. addToMapMap(Map> map, T key, V val)
  3. addToMapOfLists(Map> map, S key, T value)
  4. arrayAsMap(Object... t)
  5. arrayToMap(int[] array)
  6. ArrayToMap(Object[] a)
  7. arrayToMap(Object[] array)
  8. arrayToMap(Object[] array, Object value)
  9. ArrayToMap(T[] list)