2D ArrayList
in
Programming Questions
•
2 years ago
Hi everyone, I have a question regarding setting up a 2D ArrayList. I am copying data from an FFT array into an ArrayList like this:
//-------------------------------------------------------//get our spectrum data
myFFT.getSpectrum(myChannel);
//-------------------------------------------------------//write values to our ArrayList
myArrayList.add(myFFT.spectrum[1]);
}
}
Everything is working up to a point, I am adding data from position [1] of myFFT.spectrum and storing it into an ArrayList so that I have a dynamic record of how position [1] changes over time; the problem now is that there are 256 array locations in myFFT.spectrum and I would like to store
all of them into a 2D ArrayList so that I have a record of how they all change over time.
I'll be honest, being fairly new to Processing, I'm really not sure how to do this! Do I have to declare 256 separate ArrayLists?! If not, how would I create an ArrayList with 256 positions to populate?
Many thanks in advance...
1