如何为两个单独的List数组使用增强型for循环?

时间:2022-09-06 15:36:01
    List <WebElement> statusArr = driver.findElements(By.cssSelector(".icono-exclamationCircle.ng-scope"));
    List <WebElement> flagArr = new ArrayList<WebElement>();

This are my two separate list arrays. I want to iterate them both in parallel manner. How can I do that? They both have same number of elements.

这是我的两个单独的列表数组。我想以并行方式迭代它们。我怎样才能做到这一点?它们都具有相同数量的元素。

2 个解决方案

#1


0  

Give this a try

试一试

for(int i = 0; i < statusArr.size(); i++){
    statusArr.get(i);
    flagArr.get(i);
}

#2


0  

In JavaScript you can't iterate two lists in parallel in the same execution. They can only be iterated sequentially.

在JavaScript中,您无法在同一执行中并行迭代两个列表。它们只能按顺序迭代。

#1


0  

Give this a try

试一试

for(int i = 0; i < statusArr.size(); i++){
    statusArr.get(i);
    flagArr.get(i);
}

#2


0  

In JavaScript you can't iterate two lists in parallel in the same execution. They can only be iterated sequentially.

在JavaScript中,您无法在同一执行中并行迭代两个列表。它们只能按顺序迭代。