【发布时间】:2017-02-27 11:51:33
【问题描述】:
我正在尝试打印我的数组列表,但我不知道为什么我的打印没有在 Adjlist 的每个索引中逐行打印 IntegerPair:
private ArrayList<ArrayList<IntegerPair>> AdjList; //outer arraylist
private ArrayList<IntegerPair> storeNeighbour; //inner arraylist
private IntegerPair pair;
这是我的sn-p:
for (ArrayList<IntegerPair> l1 : AdjList) {
for (IntegerPair n : l1) {
System.out.println( n + "# ");
}
}
【问题讨论】:
-
你能把你的预期输出和你目前得到的输出添加到问题中吗?
-
输出是什么?像
IntegerPair@...这样的东西?如果是这样,请阅读Object.toString()的 JavaDoc ;-) -
代码看起来可以工作,这些列表是空的吗???
-
IntegerPair类是什么?是你的吗?