Java Utililty Methods List Value Add All

List of utility methods to do List Value Add All

Description

The list of methods to do List Value Add All are organized into topic(s).

Method

ListaddAllUniqueId(List aList, List theObjects)
Adds all object from second list to first list (creates first list if missing).
if (aList == null)
    aList = new ArrayList();
for (T object : theObjects)
    if (!containsId(aList, object))
        aList.add(object);
return aList;
ListaddAllUniqueToList(List objects, List objectsToAdd)
add All Unique To List
if (objectsToAdd == null) {
    return objects;
int size = objectsToAdd.size();
for (int index = 0; index < size; index++) {
    Object element = objectsToAdd.get(index);
    if (!objects.contains(element)) {
        objects.add(element);
...
voidaddAllWords(String text, List result)
add All Words
int start = 0;
while (start < text.length()) {
    int next = nextWord(text, start);
    result.add(text.substring(start, next));
    start = next;
voidaddArrayToList(List list, String as[])
add Array To List
if (as != null) {
    for (int i = 0; i < as.length; i++)
        list.add(as[i]);
ListaddArrayToList(List list, double[] array)
Add the contents of the array to the list
List<Double> copiedList = new ArrayList<>(list);
if (array == null) {
    copiedList.add(null);
    copiedList.add(null);
} else {
    for (int i = 0; i < array.length; i++) {
        copiedList.add(array[i]);
return copiedList;
voidaddArrayToList(List list, T[] array)
add Array To List
if (isEmpty(list)) {
    return;
for (T t : array) {
    list.add(t);
voidaddArrayToList(String[] array, List list)
add Array To List
for (int i = 0; i < array.length; i++) {
    list.add(array[i]);
ListaddArrayToList(T[] array, List list)
add Array To List
if (list == null || array == null)
    return null;
for (T object : array) {
    list.add(object);
return list;
voidaddToList(List list, Object obj)
add To List
list.add(obj); 
voidaddToList(List list, I item)
Convenience method to add an item to a list.
if (item != null) {
    list.add(item);