* @param map The map to which the key-value pairs are added
*/
public Map toMap( String str, String elementSeparator,
String keyValueSeparator, Map map )
{
Map result ;
String elemSep ;
String kvSep ;
String[] assignments ;
String[] nameValue ;
if ( str == null )
return map ;
result = ( map == null ? new Hashtable() : map ) ;
elemSep = ( elementSeparator == null ) ? "," : elementSeparator ;
kvSep = ( keyValueSeparator == null ) ? "=" : keyValueSeparator ;
assignments = this.parts( str, elemSep ) ;
for ( int i = 0 ; i < assignments.length ; i++ )
{
nameValue = this.splitNameValue( assignments[i], kvSep ) ;
nameValue[0] = nameValue[0].trim() ;
nameValue[1] = nameValue[1].trim() ;
if ( nameValue[0].length() > 0 )
result.put( nameValue[0], nameValue[1] ) ;
}
return result ;
} // asMap()