Java tutorial
//package com.java2s; import java.util.HashMap; public class Main { public static HashMap<String, String> getMap(String... strings) { if (strings.length % 2 != 0) { return null; } HashMap<String, String> params = new HashMap<String, String>(); for (int i = 0; i < strings.length - 1; i += 2) { params.put(strings[i], strings[i + 1]); } return params; } }