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

ListcreateIfNull(List list)
It is common to want to make sure that a collection you receive is not null.
return (list == null) ? new ArrayList<T>() : list;
ListcreateIndicesOrderedList(final Collection order, final Collection values)
Creates a new list with the order of entries equal to the order of entries in the collection 'order', regarding the indices of the collection 'values', and the values copied from the collection 'values'.
List<V> result = new ArrayList<V>(order.size());
if (values instanceof List) {
    List<V> valuesList = (List<V>) values;
    for (Integer orderIndex : order) {
        result.add(valuesList.get(orderIndex));
} else {
    int curIndex = 0;
...
StringcreateInString(List keys)
create In String
StringBuilder sb = new StringBuilder();
if (keys != null && keys.size() > 0) {
    for (Iterator<String> iter = keys.iterator(); iter.hasNext();) {
        String key = iter.next();
        sb.append("'");
        sb.append(key);
        sb.append("'");
        if (iter.hasNext()) {
...
int[]createIntArray(List coll)
Creates an int[] from given coll of Integers.
int[] array = new int[coll.size()];
for (int i = 0; i < coll.size(); i++) {
    array[i] = coll.get(i);
return array;
int[]CreateIntArrayFromIntegerList(List solidsList)
Builds int array from Integer List object
int[] solidPts = new int[solidsList.size()];
for (int j = 0; j < solidsList.size(); j++) {
    solidPts[j] = solidsList.get(j);
return solidPts;
ListcreateIntegerList(int[] array)
create Integer List
List<Integer> list = new ArrayList<Integer>(array.length);
for (int i = 0; i < array.length; i++) {
    list.add(array[i]);
return list;
StringcreateIntegerQueryString(List values)
create Integer Query String
String queryString = "(";
if (values == null || values.size() < 1) {
    return null;
queryString += values.get(0);
for (int i = 1; i < values.size(); i++) {
    queryString += ", " + values.get(i);
return queryString + ")";
ArrayListCreateIntegerSequenceList(int startNumber, int endNumber)
Creates a list of integers starting at one value and ending at another value (increment step is one).
ArrayList<Integer> list = new ArrayList<Integer>();
for (int i = startNumber; i <= endNumber; i++)
    list.add(i);
return list;
SetcreateIntegerSetFromIntegerList(List integerList)
Creates a Set of Integers from an List of integers
Set<Integer> integerSet = new HashSet<Integer>();
if (integerList != null) {
    Iterator<Integer> iterator = integerList.iterator();
    while (iterator.hasNext()) {
        Integer integerValue = iterator.next();
        integerSet.add(integerValue);
return integerSet;
StringcreateInterfaceContent(String typeName, @SuppressWarnings("rawtypes") List superInterfaces, String indentation, String lineSeparator)
create Interface Content
StringBuffer sb = new StringBuffer();
sb.append("interface ");
sb.append(typeName);
@SuppressWarnings("rawtypes")
Iterator i = superInterfaces.iterator();
if (i.hasNext()) {
    sb.append(" extends ");
    sb.append(stripPackage(i.next()));
...