Java Utililty Methods List Transform

List of utility methods to do List Transform

Description

The list of methods to do List Transform are organized into topic(s).

Method

ListstringToList(final String stringToTransform)
string To List
List<String> list = new ArrayList<String>();
String transformingString = stringToTransform;
int index;
if (transformingString.indexOf(",") != -1) {
    while ((index = transformingString.indexOf(",")) != -1) {
        list.add(transformingString.substring(0, index).trim());
        transformingString = transformingString.substring(index + 1);
    list.add(transformingString.trim());
} else if (transformingString.length() != 0) {
    list.add(transformingString.trim());
return list;
int[]transform(final List l)
transform
final int[] array = new int[l.size()];
for (int i = 0; i < l.size(); i++)
    array[i] = l.get(i).intValue();
return array;
List>transform(List> values)
transform
int size = values.get(0).size();
List<List<Double>> newList = new ArrayList<List<Double>>(size);
for (int i = 0; i < size; i++) {
    newList.add(new ArrayList<Double>());
for (List<Double> list : values) {
    int index = 0;
    for (Double float1 : list) {
...
ListtransformCollectionTOList(Collection collection)
Transform of Collection to List
List<E> collectionList = new ArrayList<E>();
for (E obj : collection) {
    collectionList.add(obj);
return collectionList;
voidtransformContinuouslyVariablesByThreshold(List> data, int index, int threshold)
transform Continuously Variables By Threshold
for (int i = 1; i < data.size(); i++) {
    List<String> rowData = data.get(i);
    if (Integer.parseInt(rowData.get(index)) <= threshold) {
        rowData.set(index, "<=" + threshold);
    } else {
        rowData.set(index, ">" + threshold);
ListtransformIntoAList(String... elements)
transform Into A List
ArrayList<String> list = new ArrayList<String>(elements.length);
for (String element : elements) {
    list.add(element.trim());
return list;
voidtransformNumberedPropertiesToList(Properties props)
transform Numbered Properties To List
String key = null;
String unnumberedKey = null;
List<String> keyList = null;
List<String> removeKeys = new LinkedList<String>();
Iterator keys = props.keySet().iterator();
Map<String, List<String>> keysLists = new HashMap<String, List<String>>();
while (keys.hasNext()) {
    key = (String) keys.next();
...
StringtransformStringListToString(List fileContentAsList)
transform String List To String
final StringBuilder sb = new StringBuilder();
for (String line : fileContentAsList) {
    sb.append(line);
    sb.append(getSystemLineSeparator());
return sb.toString().trim();
ListtransformStringToListOfStrings(String line)
transform String To List Of Strings
if (line == null || line.trim().length() == 0)
    return (new ArrayList<String>(0));
String[] tokens = line.trim().split("\\s+");
int tokensLength = tokens.length;
List<String> result = new ArrayList<String>(tokensLength);
for (int index = 0; index < tokensLength; index++) {
    result.add(tokens[index]);
return (result);
double[]transformToDoublePrimitiveArray(List values)
Transform to a primitive double array.
final double[] doubles = new double[values.size()];
int i = 0;
for (final Double d : values) {
    doubles[i] = d.doubleValue();
    i++;
return doubles;