Here you can find the source of addArrayToList(List
Parameter | Description |
---|---|
list | a parameter |
array | a parameter |
public static List<Double> addArrayToList(List<Double> list, double[] array)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { /**/* w ww . j a v a 2 s . c o m*/ * Add the contents of the array to the list * * @param list * @param array * @return A copy of the original list, with the array values added to it. */ public static List<Double> addArrayToList(List<Double> list, double[] array) { List<Double> copiedList = new ArrayList<>(list); //if parameter is constrained there is a null instead of an array if (array == null) { copiedList.add(null); copiedList.add(null); } else { for (int i = 0; i < array.length; i++) { copiedList.add(array[i]); } } return copiedList; } }