Ich habe eine Arraylist wie folgt aus:Wie ArrayList <Double> in 2D-Array konvertieren? Ich werde eine Matrix wollen
[2.0, 3.0, 5.0, ...., 9.0] // has 30 value inside
ich die Ausgabe von diesem Code bekam
ArrayList<Double> data = new ArrayList<Double>();
for (Document matrix : matrices) {
Double column1 = matrix.getDouble("column1");
data.add(column1);
Double column2 = matrix.getDouble("column2");
data.add(column2);
Double column3 = matrix.getDouble("column3");
data.add(column3);
Double column4 = matrix.getDouble("column4");
data.add(column4);
Double column5 = matrix.getDouble("column5");
data.add(column5);
}
System.out.println("Current array list is:"+data);
So kann ich die Array-Liste = data [30] konvertieren zu 2d Array = Daten [6] [5]? Vielleicht wie diese Ausgabe
data[6][5] :
2.0 3.0 5.0 ... ...
.
.
.
.
... ... ... ... 9.0
Oder ich habe 6 verschiedene Initiationsarraylist machen Matrix zu bekommen?
Haben Sie wirklich eine 2D-Matrix wollen, so dass Sie Matrix Mathematik auf sie oder etwas tun kann oder tun einfach Sie wollen Formatieren Sie die Ausgabe? – ajb
ja Option 1: Ich möchte die Zuordnung zu dieser Matrix selbst organisieren – newcomers