I have a Java API that returns a List like:
public List> getByXPath(String xpathExpr)
I am using the below scala code:
There's a handy Scala object just for this - scala.collection.JavaConverters
You can do the import and asScala
afterwards as follows:
import scala.collection.JavaConverters._
val lst = node.getByXPath(xpath).asScala
lst.foreach{ node => .... }
This should give you Scala's Buffer
representation allowing you to accomplish foreach
.