0
- 我已經編寫了圖形連接與否的代碼。我得到這行的編譯錯誤valueInList =(Integer)adjacencyList [i] .next();說方法next()沒有爲ArrayList定義圖形連接
- 如何解決這個問題?
private boolean checkCondition2(ArrayList<Integer> [] adjacencyList,int no_of_vertices){
int i,valueInList;
boolean checkFlag;
tempList = new ArrayList<Integer>();
tempList.add(1);
for(i=0;i<no_of_vertices-1;i++){
checkFlag = false;
Iterator<Integer> itr = adjacencyList[i].iterator();
while(itr.hasNext()){
valueInList = (Integer) adjacencyList[i].next();
if(!tempList.contains(valueInList)){
tempList.add(valueInList);
checkFlag = true;
break;
}
}
if(checkFlag==false)
return false;
}
return true;
}