Here you can find the source of addAll(ArrayList
public static <T> void addAll(ArrayList<T> list, T[] array)
//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]); } } }