Android examples for java.util:Map
Create Map from array of key and array of value
//package com.book2s; import java.util.HashMap; import java.util.Map; public class Main { public static <K, V> Map<K, V> toMap(K[] keys, V[] values) { HashMap<K, V> map = new HashMap<K, V>(); if (keys != null) { for (int i = 0; i < keys.length; i++) { map.put(keys[i],/*from w w w . j a v a2 s . c om*/ values != null ? (i < values.length ? values[i] : null) : null); } } return map; } }