I have a class Line that contains an internal ArrayList<Double>. In my program, I have an ArrayList<Line> that contains many Line objects.
In my program, I want to be able to create a new ArrayList<Double> that contains the content of the ArrayList<Double> from all the Lines in my ArrayList<Line>. Is there an easy way to do this?
Here is my code…
class Line {
ArrayList<Double> values;
line() {
values = new ArrayList<Double>();
}
public class Calucating{
ArrayList<Line> lineY = new ArrayList<Line>();
// Adding lines in here...
// Now I want to add the contents of each Line into a single ArrayList<Double>
ArrayList<Double> lineNewY=new ArrayList<Double>;
}
How can I easily join the content of all my Lines into a single ArrayList<Double>?
So you have an array of lines, each line containing an array of doubles, and you want to get one large array of doubles that contains all the doubles in all the arrays in the lines.