I have three lists: listA, listB, listC.
listA listB
1,a,tf b,true
2,b,tf a,false
3,c,tf c,true
and I would like to have listC to be listA + listB in order of listA (replacing listA's tf with listB's true/false).
listC
1,a,false
2,b,true
3,c,true
Here's my code
Iterator a= listA.iterator();
Iterator b= listB.iterator();
while(a.hasNext()){
while(b.hasNext()){
if(String.valueOf(a.next()).split(",")[1].equals(String.valueOf(b.next()).split(",")[0])){
listC.add(String.valueOf(a.next()).replaceAll("tf", String.valueOf(b.next()).split(",")[1]));
}
}
}
With individual iterator-while for listA and listB being split and indexed, it works fine, but when I run the code above, the program just freezes. Any thoughts?