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

StringcreateOrderedQuery(String attributeName, List ids)
Step 1 in Collaborative Filtering using SOLR.
StringBuilder queryBuilder = new StringBuilder();
if (ids != null) {
    queryBuilder.append(attributeName + ":(");
    int productCounter = 0;
    int weight = ids.size();
    for (String product : ids) {
        if (productCounter >= MAX_SAME_PRODUCT_COUNT) {
            break;
...
ListcreateOrgAttributeList()
create Org Attribute List
List<String> attributeList = new ArrayList<>();
attributeList.add("name");
attributeList.add("displayName");
attributeList.add("orgType");
attributeList.add("locality");
attributeList.add("parentOrgUnits");
attributeList.add("governors");
attributeList.add("resourceInducements");
...
ListcreateOrGrow(List list, int minCapacity)
Grows the given list to the given capacity, or creates a new list if the given list is null.
if (list == null) {
    list = create(minCapacity);
} else if (list instanceof ArrayList) {
    ((ArrayList) list).ensureCapacity(minCapacity);
return list;
ListcreateOutputTuple(List> tuples)
create Output Tuple
final List<String> outputTuple = new ArrayList<String>();
for (List<String> tpI : tuples) {
    for (String coulumnJ : tpI) {
        outputTuple.add(coulumnJ);
return outputTuple;
StringcreatePostBody(final List required)
create Post Body
final StringBuilder body = new StringBuilder("{ name: ");
body.append("'test");
body.append(++count);
body.append("'");
if (required != null) {
    for (final String key : required) {
        body.append(", ");
        if (key.startsWith("i:")) {
...
ListcreatePrimaryKeyList(String primaryKeyStr)
create Primary Key List
return new ArrayList<>(Arrays.asList(primaryKeyStr.trim().split("\\s*,\\s*")));
StringcreatePrimaryKeysQuery(String tableName, List primaryKeys)
create Primary Keys Query
StringBuilder query = new StringBuilder("ALTER TABLE ");
query.append(tableName);
query.append(" ADD PRIMARY KEY (");
for (String key : primaryKeys) {
    query.append(key);
    query.append(",");
query.setLength(query.length() - 1);
...
StringcreateQueryLogMessage(String query, List parameterValues)
Method to create a human readable log message regarding a generated query.
StringBuilder builder = new StringBuilder();
builder.append("Query: \"");
builder.append(query);
builder.append("\"");
if (parameterValues != null && parameterValues.size() > 0) {
    builder.append(", parameters: { ");
    Iterator<Object> parameterIterator = parameterValues.iterator();
    while (parameterIterator.hasNext()) {
...
StringcreateQueryString(String query, List params)
create Query String
String output = query;
int count = 1;
for (Iterator i = params.iterator(); i.hasNext();) {
    output = output.replaceAll("%" + count++, i.next().toString());
return output;
voidcreateRegion(String string, List regionList, int startIndex, int endIndex)
create Region
if (endIndex > startIndex) {
    regionList.add(string.substring(startIndex, endIndex));
} else if (endIndex != startIndex) {
    throw new IllegalArgumentException("Bad substring range");