I am working on a lab where I have to add two existing arrayLists to ArrayList double[] object.
// first two arrayLists
ArrayList<Double> list = new ArrayList <>();
ArrayList<Double> list2 = new ArrayList <>();
// masterList - need to add list and list2.
ArrayList<double[]> masterList = new ArrayList<>();
I then need to pass the masterList to a collection:
Collection<double[]> c = masterList;
Edit: How I've tried to add the lists to the masterList
masterList.add(list);
masterList.add(list2);
error: The method add(double[]) in the type ArrayList<double[]>
is not applicable for the arguments (ArrayList<Double>)
masterList[0] = list;
masterList[1] = list2;
error: The type of the expression must be an array type but it
resolved to ArrayList<double[]>
I'm having trouble adding list and list2 to MasterList. I can't seem to use add or addAll methods.
Any ideas?
Thanks