Here you can find the source of createMap(String entries)
public static Map<String, String> createMap(String entries)
//package com.java2s; /***************************************************************** OWLBeans is a toolkit to manipulate ontologies. Its main purpose is to extract JavaBeans from OWL documents. Copyright (C) 2004 University of Parma. /*from ww w.j ava 2 s.c om*/ GNU Lesser General Public License This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, version 2.1 of the License. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *****************************************************************/ import java.util.*; public class Main { public static Map<String, String> createMap(String entries) { return fillMap(new HashMap<String, String>(), entries); } public static Map fillMap(Map map, String entries) { if (entries == null) return map; return fillMap(map, parseKVPairs(entries)); } public static Map fillMap(Map map, String[][] kv) { for (int i = 0; i < kv.length; i++) { if (kv[i].length > 1) map.put(kv[i][0], kv[i][1]); } return map; } public static String[][] parseKVPairs(String kv) { // comma-separated list of entries String[] list = kv.split(","); String[][] result = new String[list.length][]; for (int i = 0; i < list.length; i++) { // each entry is a colon-separated key-val pair result[i] = list[i].trim().split(":"); } return result; } }