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

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -