ArrayList in Scala with Gistlabs Mechanize. Unable to use foreach -
i'm trying use gistlabs mechanize web page processing using scala. i've been able figure out quite stuff despite fact there little documentation. thankfully, there source.
snippets work:
val agent= new mechanizeagent() agent.setuseragent(useragent) val response:abstractdocument= form.submit()
so, want read through of cookies, this. but, first let's cookies , class:
val cookiestore = response.getagent().cookies().getall() println(cookiestore.getclass())
and response:
class java.util.arraylist
so, cookiestore arraylist , should able use foreach() it, right?
when try that:
cookiestore.foreach { println }
i error:
value foreach not member of java.util.list[com.gistlabs.mechanize.cookie.cookie]
clearly, i'm doing wrong scala, what?
java.util.list
has not method foreach
. can convert scala list using implicit conversion. add import scala.collection.convert.wrapasscala._
source file.
Comments
Post a Comment