I have a two-dimensional ArrayList array that contains double values:
ArrayList<ArrayList<Double>> data = new ArrayList<ArrayList<Double>>();
By analogy with classical arrays, I would like to sort the "cols" of this matrix: I want to take elements with the same index in sub ArrayLists, and then sort them. Like calling Collections.sort () for each column ... By row, I mean that the outer layer and inner layer are columns.
What is the right way to do this? I was thinking of iterating over a matrix to invert it and then sorting each row using Collections.sort ()? but perhaps this is not the best solution, because the matrix is about 400 * 7000.
I cannot use classic arrays since the size of the matrix is unknown.
Thanks for the help.
source
share