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

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

Description

to Map

License

Open Source License

Declaration

@SuppressWarnings({ "rawtypes", "unchecked" })
    public static Map toMap(Object... objects) 

Method Source Code

//package com.java2s;

import java.util.HashMap;

import java.util.Map;

public class Main {
    @SuppressWarnings({ "rawtypes", "unchecked" })
    public static Map toMap(Object... objects) {
        Map map = new HashMap();
        for (int i = 0; i < objects.length; i += 2) {
            map.put(objects[i], objects[i + 1]);
        }/* w  ww.ja v a 2 s  . co m*/
        return map;
    }
}

Related

  1. map(String... vals)
  2. map(T... input)
  3. toMap(Object... args)
  4. toMap(Object... args)
  5. toMap(Object... data)
  6. toMap(Object... objects)
  7. toMap(Object... pairs)
  8. toMap(Object... pairs)
  9. toMap(Object[] array)