Convert a collection of String values back into a comma separated list

@param values The collection of strings
193424
public static String getStringFromCollection(Collection<String> values) {
        StringBuilder builder = new StringBuilder();
        if (values != null) {
            for (String value : values) {
                builder.append(value).append(',');
            }
            if (builder.charAt(builder.length() - 1) == ',')
                builder.deleteCharAt(builder.length() - 1);
        }
        return builder.toString();
    }
51097
private static final ArrayList<String> convertStringToArrayList(String value) {
        if (value != null && value.length() > 0) {
            ArrayList<String> result = new ArrayList<String>();
            StringTokenizer st = new StringTokenizer(value, STRING_ATTRIB_DELIM);
            while (st.hasMoreTokens()) {
                String nextString = unescape(st.nextToken());
                if (nextString != null) {
                    result.add(nextString);
                }
            }
            return result;
        }
        return null;
    }
682551
static protected void removeValues(TreeMultimap<Long, Long> mm, Set<Long> values) {
        Iterator<Map.Entry<Long, Long>> itr = mm.entries().iterator();
        while (itr.hasNext()) {
            Map.Entry<Long, Long> e = itr.next();
            if (values.contains(e.getValue())) {
                itr.remove();
            }
        }
    }
1260453
static List<String> stringsWithEq(String name, @Nullable List<String> values) {
    List<String> result = new ArrayList<>();
    if (values != null) {
      for (String value : values) {
        result.addAll(stringWithEq(name, value));
      }
    }
    return result;
  }
162499
public static Long[] wrap(long... values) {
		if (null == values) {
			return null;
		}
		final int length = values.length;
		if (0 == length) {
			return new Long[0];
		}

		final Long[] array = new Long[length];
		for (int i = 0; i < length; i++) {
			array[i] = Long.valueOf(values[i]);
		}
		return array;
	}
790977
public Param value(List<String> values) {
        StringBuilder valuesSb = new StringBuilder();
        for (int i = 0; i < values.size(); i++) {
            valuesSb.append(values.get(i));
            if (i != (values.size() - 1)) {
                valuesSb.append("%7C"); // it represents a pipeline character |
            }
        }
        this.value = valuesSb.toString();
        return this;
    }
614697
public static Character[] wrap(char... values) {
		if (null == values) {
			return null;
		}
		final int length = values.length;
		if (0 == length) {
			return new Character[0];
		}

		final Character[] array = new Character[length];
		for (int i = 0; i < length; i++) {
			array[i] = Character.valueOf(values[i]);
		}
		return array;
	}
1259955
protected static String[] _asList(
                    final String value
                    )
    {
        if (value == null  ||  value.length() == 0) {
            return (new String[0]);
        }

        return (value.contains( LIST_DELIMITER ) ? value.split( LIST_DELIMITER ) : (new String[] { value }));
    }
449002
public static Set<String> parseParameterList(String values) {
		Set<String> result = new TreeSet<String>();
		if (values != null && values.trim().length() > 0) {
			// the spec says the scope is separated by spaces
			String[] tokens = values.split("[\\s+]");
			result.addAll(Arrays.asList(tokens));
		}
		return result;
	}
141735
public static <T> Collection<T> matchToString(Collection<T> values, String name) {
        List<T> result = new ArrayList<>();
        for (T value : values) {
            if (value == null) {
                continue;
            }
            if (startsWithIgnoreCase(value.toString(), name)) {
                result.add(value);
            }
        }
        return result;
    }
1077036
public void setValues(final Set<String> values) {
        getValues().clear();
        if (values == null) {
            return;
        }
        getValues().addAll(values);
    }
1018560
private List<String> toListOfStrings(String headerName, List<Object> values) {
        if (values == null) {
            return null;
        }
        List<String> stringValues = new ArrayList<>(values.size());
        HeaderDelegate<Object> hd = HttpUtils.getHeaderDelegate(values.get(0));
        for (Object value : values) {
            String actualValue = hd == null ? value.toString() : hd.toString(value);
            stringValues.add(actualValue);
        }
        return stringValues;
    }
345403
public void addFieldValues(String fieldName, Collection<String> values) {
        Utils.require(!Utils.isEmpty(fieldName), "fieldName");
        
        if (values != null && values.size() > 0) {
            if (fieldName.charAt(0) == '_') {
                Utils.require(values.size() == 1, "System fields can have only 1 value: " + fieldName);
                setSystemField(fieldName, values.iterator().next());
            } else {
                List<String> currValues = m_valueMap.get(fieldName);
                if (currValues == null) {
                    currValues = new ArrayList<>();
                    m_valueMap.put(fieldName, currValues);
                }
                currValues.addAll(values);
            }
        }
    }
103412
private List<String> tail(List<String> values) {

        List<String> result = new ArrayList<String>();
        boolean first = true;
        for (String value : values) {
            if (!first) {
                result.add(value);
            }
            first = false;
        }
        return result;

    }
1257131
public static <T> List<T> list(T... values) {
        return new ArrayList<T>(Arrays.asList(values));
    }
1354323
private static List<String> parse(String value) {
        List<String> parts = new ArrayList<String>();
        StringBuilder buffer = null; // buffer that accumulates escaped parts
        for (int length = value.length(), start = 0, comma = value.indexOf(',', 0); // split on commas
        start >= 0; // break out of the loop when no parts remain
        start = comma < 0 ? -1 : (comma + 1), comma = comma == length ? -1 : value.indexOf(',', comma + 1)) {

            String part = value.substring(start, comma < 0 ? length : comma);
            if (part.length() > 0 && part.charAt(part.length() - 1) == '\\') {
                if (buffer == null)
                    buffer = new StringBuilder();
                buffer.append(part.substring(0, part.length() - 1)).append(',');
            } else {
                parts.add(buffer == null ? part : buffer.append(part).toString());
                buffer = null;
            }
        }
        if (buffer != null)
            parts.add(buffer.toString());
        return parts;
    }
908415
public List<Writable> transformRawStringsToInputList(List<String> values) {
        List<Writable> ret = new ArrayList<>();
        if (values.size() != initialSchema.numColumns())
            throw new IllegalArgumentException(
                    String.format("Number of values %d does not match the number of input columns %d for schema",
                            values.size(), initialSchema.numColumns()));
        for (int i = 0; i < values.size(); i++) {
            switch (initialSchema.getType(i)) {
                case String:
                    ret.add(new Text(values.get(i)));
                    break;
                case Integer:
                    ret.add(new IntWritable(Integer.parseInt(values.get(i))));
                    break;
                case Double:
                    ret.add(new DoubleWritable(Double.parseDouble(values.get(i))));
                    break;
                case Float:
                    ret.add(new FloatWritable(Float.parseFloat(values.get(i))));
                    break;
                case Categorical:
                    ret.add(new Text(values.get(i)));
                    break;
                case Boolean:
                    ret.add(new BooleanWritable(Boolean.parseBoolean(values.get(i))));
                    break;
                case Time:

                    break;
                case Long:
                    ret.add(new LongWritable(Long.parseLong(values.get(i))));
            }
        }
        return ret;
    }