Hey I'm new to Java and have been having difficulties with arrays. I'm trying to use either arrays or arrayLists to store a list of values from my test class. But I'm having on how to add set1 and set2 into my arrayList.
I have a test class with
Data set1 = new Data(new double[]{1, 2, 3, 4, 5});
System.out.println("Set1: " + set1);
Data set2 = new Data(new double[]{-5, -4, -3, 1});
System.out.println("Set2: " + set2);
Then my data class
import java.util.ArrayList;
public class Data {
public Data(double[] sets) {
ArrayList<Double> sets = new ArrayList<Double>();
}
}