devdaily home | apple | java | perl | unix | directory | blog

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

package tests;

import java.util.HashMap;
import java.util.Map;

public class PolicyHelper
{
	public static Map makeMap(String[] terms)
	{
		Map ret = new HashMap();
		for (int i = 0; i < terms.length; ++i)
		{
			String term = terms[i];
			int pos = term.indexOf("=");
			if (pos > 0)
			{
				String name = term.substring(0,pos);
				String value = term.substring(pos+1);
				ret.put(name, value);
			}
		}

		return ret;
	}
}




Copyright 1998-2008 Alvin Alexander
All Rights Reserved.
 
devdaily.com is based in louisville, kentucky, and this web site is hosted by godaddy.com