如何循环并获取存储在Vector中的单个项目

时间:2016-02-02 11:29:14

标签: java vector

拥有Vector" data1 "有这样的价值......

DefaultTableModel model1 = (DefaultTableModel)itemsTableSD.getModel();
Vector data1 = model1.getDataVector();
System.out.println(data1.toString());

结果1:

[[row-0-col-0, row-0-col-1, row-0-col-2, row-0-col-3, row-0-col-4, row-0-col-5], [row-1-col-0, row-1-col-1, row-1-col-2, row-1-col-3, row-1-col-4, row-1-col-5]]

如果循环通过Vector

for(int i=0; i<dataMG.size(); i++){
    System.out.println("data1: "+ "Row-" + i + "->" +dataMG.get(i));
    System.out.println("\n");
}

我只获得行......

data1: Row-0->[row-0-col-0, row-0-col-1, row-0-col-2, row-0-col-3, row-0-col-4, row-0-col-5]

data1: Row-1->[row-1-col-0, row-1-col-1, row-1-col-2, row-1-col-3, row-1-col-4, row-1-col-5]

问题:

如何从每一行获取单个项目......

像...

row-0-col-0
row-0-col-1
row-0-col-2

...

row-1-col-3
row-1-col-4
row-1-col-5

请指点我,谢谢

0 个答案:

没有答案