打印我的数据集的列 JAVA

Print columns of my dataset JAVA

我有一个如下所示的数据框:

id1 1 2 3 4  
id2 2 6 6 0 
id3 3 4 2 2
id4 4 3 3 1
id5 5 6 6 5
id6 6 2 4 6

帧的第一行是第一个数据点。第二个是另一个数据点,等等...

我的数据点Class如下:

public class DataPoint {
    private ArrayList<Integer> values;
    private String id;
}

所以对于 id1,字段将是:id = id1,以及 values = {1, 2, 3, 4},等等。 我要做的是按列打印数据点...

所以对于上面的输入,我的输出应该是:

1 2 3 4 5 6
2 6 4 3 6 2
3 6 2 3 6 4
4 0 2 1 5 6

我无法修改上述 DataPoint 格式,因为我的项目太超前了,我无力更改所有数据结构:/

有什么方法可以在不改变数据结构的情况下转置我的结果吗?

for (int i = 0; i < 4; i++) {
    for (DataPoint dp : dataPoints) {
        System.out.print(dp.values.get(i) + " ");
    }
    System.out.println();
}