Java List Value Add All addAll(ArrayList list, T[] array)

Here you can find the source of addAll(ArrayList list, T[] array)

Description

add All

License

Apache License

Declaration

public static <T> void addAll(ArrayList<T> list, T[] array) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.ArrayList;
import java.util.Arrays;

public class Main {
    public static <T> void addAll(ArrayList<T> list, T[] array) {
        if (array == null) {
            return;
        }/*from w  w  w  .j  av  a2 s  .c  om*/
        list.addAll(Arrays.asList(array));
    }

    public static <T> void addAll(ArrayList<T> list, T[][] array) {
        for (int i = 0; i < array.length; i++) {
            addAll(list, array[i]);
        }
    }

    public static <T> void addAll(ArrayList<T> list, T[][][] array) {
        for (int i = 0; i < array.length; i++) {
            addAll(list, array[i]);
        }
    }

    public static <T> void addAll(ArrayList<T> list, T[][][][] array) {
        for (int i = 0; i < array.length; i++) {
            addAll(list, array[i]);
        }
    }
}

Related

  1. addAll(final List list, final E... values)
  2. addAll(final List firstList, final List secondList)
  3. addAll(final List list, final T... elements)
  4. addAll(int index, List list, T... array)