Java Utililty Methods List Create

List of utility methods to do List Create

Description

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

Method

ListcreateStringList(String spaceDelimitedString)
create String List
String[] splitValues = spaceDelimitedString.split(" "); 
return Arrays.asList(splitValues);
ListcreateStringListFromStringArr(String[] stringArr)
Creates an list of Integers from an array of Strings
if (stringArr == null) {
    return null;
List<String> stringList = new ArrayList<String>();
for (int i = 0; i < stringArr.length; i++) {
    String part = stringArr[i];
    if (part != null && !"".equals(part)) {
        stringList.add(part);
...
ListcreateSubList(Collection source, Class type)
Create a sub-list by only picking up instances of the specified type.
List<T> r = new ArrayList<T>();
for (Object item : source) {
    if (type.isInstance(item)) {
        r.add(type.cast(item));
return r;
ListcreateSublist(final T[] elements, final Class listImplementation)
create Sublist
List<T> sublist;
final List<T> asList = Arrays.asList(elements);
try {
    sublist = listImplementation.newInstance();
    sublist.addAll(asList);
} catch (final InstantiationException e) {
    sublist = asList;
} catch (final IllegalAccessException e) {
...
StringcreateSymbolNameString_From_Parts(List descTagName_Parts)
create Symbol Name Strin Fro Parts
if (descTagName_Parts == null)
    return null;
StringBuffer descTagBuffer = new StringBuffer();
boolean firstPart = true;
for (String part : descTagName_Parts) {
    if (!firstPart)
        descTagBuffer.append(".");
    else
...
StringcreateTable(List datas, String[] headers, int numColumns, int cellPadding, int border)
create Table
StringBuilder table = new StringBuilder(begin);
if (datas == null) {
    throw new IllegalArgumentException("The data can not be null");
if (datas.size() % numColumns != 0) {
    throw new IllegalArgumentException(
            "The table could not be created becuase the data does not match the column size");
if (border > 0) {
    table.append("border=\"" + border + "\"");
if (cellPadding > 0) {
    table.append("cellpadding=\"" + cellPadding + "\"");
table.append(">");
if (headers != null && headers.length == numColumns) {
    table.append("<tr>");
    for (String header : headers) {
        table.append("<th>" + header + "</th>");
    table.append("</tr>");
int colIndex = 0;
for (String data : datas) {
    if (colIndex == 0) {
        table.append("<tr>");
    table.append("<td>" + data + "</td>");
    colIndex++;
    if (colIndex == numColumns) {
        table.append("</tr>");
        colIndex = 0;
return table.toString();
StringcreateTagList(List tags, String separator)
create Tag List
StringBuilder sb = new StringBuilder();
for (String string : tags) {
    sb.append(string);
    sb.append(separator);
return sb.toString().substring(0, sb.length() - separator.length());
ListcreateTarget(List labels)
create Target
return createTarget(labels, new HashMap<T, Double>());
ListcreateTargetSorted(List labels, Comparator comp)
create Target Sorted
return createTargetSorted(labels, new HashMap<T, Double>(), comp);
voidcreateTuple(List> tuples, List entries, List> lists)
This recursive method is used by the computeCombinations() method.
if (entries.size() == lists.size() - 1) {
    for (T t : lists.get(entries.size())) {
        List<T> tuple = new ArrayList<T>(entries);
        tuple.add(t);
        tuples.add(tuple);
} else {
    for (T t : lists.get(entries.size())) {
...