Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Java-Scala interoperability - April 2016

sullis
April 19, 2016

Java-Scala interoperability - April 2016

Java-Scala interoperability
Portland Java User Group
April 19, 2016

sullis

April 19, 2016
Tweet

More Decks by sullis

Other Decks in Programming

Transcript

  1. • software engineer • 20 years Java • 5 years

    at Gilt • back office systems @ Gilt About me
  2. • convert java.util.List to Scala collection • convert java.util.Set to

    Scala collection • convert java.util.Map to Scala collection • convert Scala List to java.util.List Common scenarios
  3. import java.util.{ArrayList => JArrayList}
 import scala.collection.JavaConverters._
 
 val jArrayList =

    new JArrayList[String]
 jArrayList.add("a")
 jArrayList.add("b")
 jArrayList.add("c")
 
 val scalaList = jArrayList.asScala
 
 scalaList should be (List("a", "b", "c"))