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

ListcreateDoubleList(double[] values)
create Double List
List<Double> list = new ArrayList<>();
for (double v : values) {
    list.add(v);
return list;
ListcreateDriverSheetNames(List driverBeans)
create Driver Sheet Names
List sheetNames = new ArrayList();
for (int i = 0; i < driverBeans.size(); i++) {
    Map map = (Map) driverBeans.get(i);
    String bizid = String.valueOf(map.get("BIZ_ID"));
    String name = String.valueOf(map.get("OWNERNAME"));
    sheetNames.add(name + bizid);
return sheetNames;
...
List>createEmptyAdjacencyList(int n)
Creates an empty graph represented as an adjacency list of size n
if (n < 0)
    throw new IllegalArgumentException("n cannot be negative; received: " + n);
List<List<Integer>> graph = new ArrayList<>(n);
for (int i = 0; i < n; i++)
    graph.add(new ArrayList<>());
return graph;
ListcreateEmptyList(Class type)
create Empty List
return new ArrayList<T>();
List[]createEmptyListArray(int size)
create Empty List Array
List<?>[] array = new ArrayList<?>[size];
for (int i = 0; i < size; i++)
    array[i] = new ArrayList<T>();
return array;
ListcreateEmptyListOfType(List original, boolean sameSize)
create Empty List Of Type
if (original instanceof ArrayList) {
    return sameSize ? new ArrayList<T>(original.size()) : new ArrayList<T>();
try {
    return original.getClass().newInstance();
} catch (Exception e) {
    return sameSize ? new ArrayList<T>(original.size()) : new ArrayList<T>();
StringcreateEntireInStatement(List values)
create Entire In Statement
StringBuilder builder = new StringBuilder(" IN (");
for (String value : values) {
    builder.append("'" + value + "',");
return builder.subSequence(0, builder.length() - 1).toString() + ")";
StringcreateErrorStringFromList(List errorList)
create Error String From List
String errorString = "";
if (errorList != null && errorList.size() > 0) {
    if (errorList.size() == 1) {
        errorString = errorList.get(0).toString();
    } else {
        for (int i = 0; i < errorList.size(); i++) {
            String str = errorList.get(i).toString() + "<br/>";
            errorString += str;
...
StringcreateGrantScript(List objectsToGrant, String grantee)
create Grant Script
StringBuilder result = new StringBuilder();
for (String currentObject : objectsToGrant) {
    result.append("GRANT select ON SYS." + currentObject.replace("v$", "v_$") + " TO " + grantee + ";\n");
return result.toString();
StringcreateHTMLList(String list, String link, boolean APPEND, String title)
Convert a line separated list into an HTML list of links.
String buffer = "";
Scanner scanner = new Scanner(list);
String line, endpoint;
int tmpi;
if (title != null) {
    buffer += "<h1>" + title + "</h1>\n";
buffer += "<ul>\n";
...