Here you can find the source of createMap(String[] list1, String[] list2)
Parameter | Description |
---|---|
list1 | a parameter |
list2 | a parameter |
public static Map<String, String> createMap(String[] list1, String[] list2)
//package com.java2s; /*-/* w ww . j a v a 2 s . com*/ * Copyright ? 2009 Diamond Light Source Ltd. * * This file is part of GDA. * * GDA is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License version 3 as published by the Free * Software Foundation. * * GDA is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with GDA. If not, see <http://www.gnu.org/licenses/>. */ import java.util.HashMap; import java.util.Map; public class Main { /** * Create a map from the two list of strings. * @param list1 * @param list2 * @return Map */ public static Map<String, String> createMap(String[] list1, String[] list2) { final Map<String, String> ret = new HashMap<String, String>(list1.length); for (int i = 0; i < list1.length; i++) { ret.put(list1[i].trim(), list2[i].trim()); } return ret; } }