【发布时间】:2021-11-26 20:32:50
【问题描述】:
目前我使用嵌套的 for-each 循环来实现相同的效果。
List<String> valueListToBeFilter = Arrays.asList("8 digit mobile number", "Please enter mobile number.");
List<String> newfoundValueList = new ArrayList<>();
for (String value : valueListToBeFilter) {
for (WebElement element : _webElementsErrorList) {
if (element.getText().contains(value))
newfoundValueList.add(element.getText());
}
}
newfoundValueList.forEach(System.out::println);
我得到了所需的结果,但是如何使用流来达到同样的效果
【问题讨论】:
标签: java selenium java-stream