我是Java的初学者。我有 3 个 ArrayList,所有 ArrayList 都包含与特定主题有关的数据,因此长度相同。我想遍历数组并执行一些操作,如下图所示:
public void example(){
ArrayList<Long> ID = new ArrayList<Long>;
ArrayList<Integer> AcNo = new ArrayList<Integer>;
ArrayList<Integer> Vnum = new ArrayList<Integer>;
//get ID and AcNo from user, compare it in the ArrayList, get the corresponding Vnum
// for the Vnum from previous step, compare it with the next Vnum and get corresponding ID and AcNo until some *condition* is satisfied.
}
我如何在 Java 中做到这一点?我看到了 Iterator 的示例,但我不确定执行此操作的正确方法!请帮忙。