Java Utililty Methods List Prepend

List of utility methods to do List Prepend

Description

The list of methods to do List Prepend are organized into topic(s).

Method

voidprepend(final List list, final int numElements, final T element)
prepend
for (int i = 0; i < list.size(); i++) {
    list.add(0, element);
Listprepend(final List suffix, final T... values)
Returns a list as such: [values][suffix].
List<T> list = new ArrayList<T>(values.length + suffix.size());
for (T t : values) {
    list.add(t);
list.addAll(suffix);
return list;
Listprepend(final T value, final List list)
prepend
final List<T> values = new ArrayList<T>();
values.add(value);
values.addAll(list);
return values;
Listprepend(List list, E e)
prepend
List<E> newList = new ArrayList<>(list);
newList.add(0, e);
return newList;
Listprepend(List list, int minCapacity, E... items)
Prepends the given items to the front of the given list, shifting the existing items if any to the right.
return prepend(list, minCapacity, false, items);
Listprepend(String clang, List args)
prepend
try {
    args.add(0, clang);
    return args;
} catch (Exception e) {
    ArrayList<String> commands = new ArrayList<String>(args.size() + 1);
    commands.add(clang);
    commands.addAll(args);
    return commands;
...
Listprepend(String prefix, List strings)
prepend
List<String> result = new ArrayList<String>();
for (String string : strings) {
    result.add(prefix + string);
return result;
Listprepend(String start, List suggestions)
prepend
if (start.isEmpty()) {
    return suggestions;
suggestions = new ArrayList<>(suggestions);
for (int i = 0; i < suggestions.size(); i++) {
    suggestions.set(i, start + suggestions.get(i));
return suggestions;
...
ListprependInList(T el, T[] array)
prepend In List
List<T> result = new ArrayList<>(array.length + 1);
result.add(el);
Collections.addAll(result, array);
return result;
ListprependToList(A elem, List list)
Return a new list with element prepended to previous list.
List<A> answer = new ArrayList<A>(list.size() + 1);
answer.add(elem);
answer.addAll(list);
return answer;