public static String createArgsString(List<String> args){
  if (args == null) {
    return "";
  }
  StringBuilder argsSb=new StringBuilder();
  for (  String arg : args) {
    if ((arg.contains(" ") || arg.contains("${")) && !StringUtilities.isQuoted(arg)) {
      argsSb.append(StringUtilities.quote(arg));
    }
 else {
      argsSb.append(arg);
    }
    argsSb.append(' ');
  }
  if (argsSb.length() > 0) {
    argsSb.setLength(argsSb.length() - 1);
  }
  return argsSb.toString();
}

public static String createArgsString ( List < String > args ) { if ( args == null ) { return "" ; } StringBuilder argsSb = new StringBuilder ( ) ; for ( String arg : args ) { if ( ( arg . contains ( " " ) || arg . contains ( "${" ) ) && ! StringUtilities . isQuoted ( arg ) ) { argsSb . append ( StringUtilities . quote ( arg ) ) ; } else { argsSb . append ( arg ) ; } argsSb . append ( ' ' ) ; } if ( argsSb . length ( ) > 0 ) { argsSb . setLength ( argsSb . length ( ) - 1 ) ; } return argsSb . toString ( ) ; }
creates an argument string from the given list of arguments . this takes care of ensuring each argument is enclosed in quotes if required .
