Created
April 4, 2013 13:53
-
-
Save ilguzin/5310536 to your computer and use it in GitHub Desktop.
Calling Scala code from Java with java.util.List when Scala's List is expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Implicit | |
import scala.collection.JavaConverters._ | |
// For method: | |
def doSomething(things: List[Thing]): List[Result] = { ... } | |
// add the same method with another signature: | |
def doSomething(things: java.util.List[Thing]): java.util.List[Result] = | |
doSomething(things.asScala.toList).asJava |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment