String expand(String arg, List<Variable> vars, Parameters parameters) { StringBuffer expansion = new StringBuffer(); boolean first = true; for (Iterator<Variable> i = vars.iterator(); i.hasNext(); ) { Variable var = i.next(); if (parameters.exists(var.name())) { String[] values = var.values(parameters); for (String value : values) { if (!first) expansion.append(arg); else first = false; expansion.append(var.name()).append('=').append(URICoder.encode(value)); } } } return expansion.toString(); }
String expand(String arg, List<Variable> vars, Parameters parameters) { for (Variable v : vars) { if (parameters.exists(v.name())) return ""; } return arg; }