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

ListcreateList(E initialElement)
create List
List<E> res = new ArrayList<>();
res.add(initialElement);
return res;
ListcreateList(final T object)
Creates a list with one object.
final List<T> result = new ArrayList<T>(1);
result.add(object);
return result;
ListcreateList(final T... elements)
Creates a list of the given type for the given elements.
if (elements == null) {
    return new ArrayList<T>();
} else {
    return new ArrayList<T>(Arrays.asList(elements));
ListcreateList(List list)
create List
if (list == null) {
    return null;
List<T> result = new ArrayList<T>();
for (int i = 0; i < list.size(); i++) {
    T t = list.get(i);
    result.add(t);
return result;
ListcreateList(Object... entries)
create a list and fill it with this entries
List list = new ArrayList();
for (Object entry : entries)
    list.add(entry);
return list;
ListcreateList(Object... objs)
create List
return createList(new ArrayList(), objs);
ListcreateList(Object[] values)
create List
List answer = new ArrayList(values.length);
answer.addAll(Arrays.asList(values));
return answer;
ListcreateList(String s)
Creates a new List of String and adds s to it
List<String> result = new ArrayList<String>();
result.add(s);
return result;
ListcreateList(T value, int n)
Creates a mutable list containing n copies of value.
List<T> result = new ArrayList<>(n);
for (int i = 0; i < n; i++)
    result.add(value);
return result;
ListcreateList(T... _entries)
Creates a list from a varargs parameter array.
List<T> l = new ArrayList<>();
if (_entries != null) {
    l.addAll(Arrays.asList(_entries));
return l;