I don't know the workings of 'dataTestCtrl.RetriveQuestions();' but I assume it returns a table record as an array of objects. So, having done that assumtion, I guess your loop should be something like this.
Code:
// make variables for the previous iteration
String lagAnsw=null;
int lagQNo=-1;
for (int i=0; i < SList.size() ; i++) {
Object [] record=(Object[])SList.get(i);
int key=((Integer)record[0]).intValue();
int qNo=((Integer)record[1]).intValue();
String answ=(String)record[2];
if (i>0) {
if (lagQNo==qNo) {
System.out.println(key+"|"+lagAnsw+"|"+answ);
}
}
lagAnsw=answ;
lagQNo=qNo;
}
Bookmarks