Java Map from Array map(Object... objects)

Here you can find the source of map(Object... objects)

Description

map

License

LGPL

Declaration

@SuppressWarnings("unchecked")
    public static <K, V> Map<K, V> map(Object... objects) 

Method Source Code

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

import java.util.HashMap;

import java.util.Map;

public class Main {
    @SuppressWarnings("unchecked")
    public static <K, V> Map<K, V> map(Object... objects) {
        HashMap map = new HashMap();
        Object key = null;/*from  ww  w  . j  a v a2s . c om*/
        for (final Object object : objects) {
            if (key == null) {
                key = object;
            } else {
                map.put(key, object);
                key = null;
            }
        }
        return map;
    }
}

Related

  1. map(Object... elements)
  2. map(Object... keyvals)
  3. map(Object... mapValues)
  4. map(Object... objects)
  5. map(Object... objects)
  6. map(Object... objs)
  7. map(Object... objs)
  8. map(Object... oo)
  9. map(Object... params)