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

ListcreateAndInitializeList(int size, int begin)
Creates a mutable list containing size incrementing integer values beginning with begin.
List<Integer> result = new ArrayList<>(size);
for (int i = begin; i < size + begin; i++)
    result.add(i);
return result;
StringcreateArgumentList(List args)
create Argument List
if (args == null) {
    return null;
StringBuilder buffer = new StringBuilder();
boolean first = true;
for (String arg : args) {
    if (first) {
        first = false;
...
StringcreateArrayFromUsers(List userList)
create Array From Users
StringBuilder builder = new StringBuilder();
builder.append(",");
for (String user : userList) {
    builder.append(user);
    builder.append(",");
return builder.toString();
ListcreateArrayList()
Returns a typed array list
return new ArrayList<T>();
StringcreateBarrier(List text)
Create a barrier to use to distinguish the header from the rest of the output.
int barrierWidth = 0;
for (String headerLine : text)
    barrierWidth = Math.max(headerLine.length(), barrierWidth);
return String.format("%0" + barrierWidth + "d", 0).replace('0', '-');
MapcreateBlankSet(String date, List titleList)
create Blank Set
Map result = new HashMap();
try {
    for (int i = 0; i < titleList.size(); i++) {
        String index = (String) titleList.get(i);
        if ("01_SUMDATE".equals(index)) {
            result.put(index, date);
        } else {
            result.put(index, "0");
...
ListcreateBVQueryParametersList()
create BV Query Parameters List
List<String> queryParameterList = new ArrayList<String>(4);
queryParameterList.add("bvrrp");
queryParameterList.add("bvsyp");
queryParameterList.add("bvqap");
queryParameterList.add("bvpage");
return queryParameterList;
StringcreateCategoryName(List names)
Simple helper method that concatenates the names of a row of categories.
StringBuilder sb = new StringBuilder();
if (names.size() == 0)
    return "";
sb.append(names.get(0));
for (int i = 1; i < names.size(); i++) {
    sb.append(CATEGORY_SEPARATOR + names.get(i));
return sb.toString();
...
ListcreateChancePrefixList(List chances)
Creates a list with cumulative values the specified chances creating a list of ranges.
Sample:
Item A has 10% chance
Item B has 50% chance
Item C has 40% chance
Result should be a list with values 10, 60, 100.
Generating a random number between 1 and 100 can be used to find which item has been randomly selected.
It's allowed for chances can have sum greater than 100.
List<Integer> result = new ArrayList<Integer>();
Integer range = 0;
for (Integer chance : chances) {
    range = range + chance;
    result.add(range);
return result;
ArrayListcreateClassList(List objects)
create Class List
ArrayList<Class> classList = new ArrayList<Class>();
for (Object ob : objects) {
    classList.add(ob.getClass());
return classList;