public static String mergeIntoCommaSeparatedList(String currentString, Set<String> toMergeIn,
			Wrapper<Boolean> modified, String lineDelimiter) {
		String string = currentString == null ? "" : currentString;
		String[] split = splitQuoteAware(string);
		Map<String, String> name2parameters = new LinkedHashMap<String, String>();
		for (int i = 0; i < split.length; i++) {
			String value = split[i].trim();
			if (!value.equals("")) {
				Pair<String, String> nameParameter = getSplitEntry(value);
				name2parameters.put(nameParameter.getFirst(), nameParameter.getSecond());
			}
		}

		for (String value : toMergeIn) {
			if (!value.trim().equals("")) {
				Pair<String, String> nameParameter = getSplitEntry(value.trim());
				String existingParameter = name2parameters.get(nameParameter.getFirst());
				if (existingParameter != null) {
					continue;
				}
				boolean newModified = modified.get();
				newModified |= name2parameters.put(nameParameter.getFirst(), nameParameter.getSecond()) != null;
				modified.set(newModified);
			}
		}

		StringBuffer buff = new StringBuffer(string.length());
		Iterator<Map.Entry<String, String>> iterator = name2parameters.entrySet().iterator();
		while (iterator.hasNext()) {
			Entry<String, String> entry = iterator.next();
			buff.append(entry.getKey());
			if (entry.getValue() != null) {
				buff.append(";").append(entry.getValue());
			}
			if (iterator.hasNext())
				buff.append("," + lineDelimiter + " ");
		}
		String result = buff.toString();
		return result;
	}
public static String mergeIntoCommaSeparatedList ( String currentString , Set < String > toMergeIn , Wrapper < Boolean > modified , String lineDelimiter ) { String string = currentString == null ? "" : currentString ; String [ ] split = splitQuoteAware ( string ) ; Map < String , String > name2parameters = new LinkedHashMap < String , String > ( ) ; for ( int i = 0 ; i < split . length ; i ++ ) { String value = split [ i ] . trim ( ) ; if ( ! value . equals ( "" ) ) { Pair < String , String > nameParameter = getSplitEntry ( value ) ; name2parameters . put ( nameParameter . getFirst ( ) , nameParameter . getSecond ( ) ) ; } } for ( String value : toMergeIn ) { if ( ! value . trim ( ) . equals ( "" ) ) { Pair < String , String > nameParameter = getSplitEntry ( value . trim ( ) ) ; String existingParameter = name2parameters . get ( nameParameter . getFirst ( ) ) ; if ( existingParameter != null ) { continue ; } boolean newModified = modified . get ( ) ; newModified |= name2parameters . put ( nameParameter . getFirst ( ) , nameParameter . getSecond ( ) ) != null ; modified . set ( newModified ) ; } } StringBuffer buff = new StringBuffer ( string . length ( ) ) ; Iterator < Map . Entry < String , String > > iterator = name2parameters . entrySet ( ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { Entry < String , String > entry = iterator . next ( ) ; buff . append ( entry . getKey ( ) ) ; if ( entry . getValue ( ) != null ) { buff . append ( ";" ) . append ( entry . getValue ( ) ) ; } if ( iterator . hasNext ( ) ) buff . append ( "," + lineDelimiter + " " ) ; } String result = buff . toString ( ) ; return result ; }
@since 2.11