Skip to content

Instantly share code, notes, and snippets.

@krishnanraman
Created December 4, 2012 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krishnanraman/4199415 to your computer and use it in GitHub Desktop.
Save krishnanraman/4199415 to your computer and use it in GitHub Desktop.
IPGetter.scala
def ip(host:String)=java.net.InetAddress.getAllByName(host)(0).getHostAddress
var map = Map[String,String]()
val hosts = List("google.com","twitter.com","facebook.com")
hosts.par.map(host => (host,ip(host))).foreach(hostip => map+=(hostip._1->hostip._2))
scala> map
res1: scala.collection.immutable.Map[String,String] = Map(google.com -> 74.125.224.71, twitter.com -> 199.59.150.7, facebook.com -> 69.171.229.16)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment