Top "Scala-java-interop" questions

This pertains to calling Scala code from Java or vice-versa.

Convert from scala.collection.Seq<String> to java.util.List<String> in Java code

I'm calling a Scala method, from Java. And I need to make the conversion from Seq to List. I can't …

java scala type-conversion scala-java-interop
Using Scala from Java: passing functions as parameters

Consider the following Scala code: package scala_java object MyScala { def setFunc(func: Int => String) { func(10) } } Now in Java, …

java scala scala-java-interop
Create an immutable list from a java.lang.Iterator

I'm using a library (JXPath) to query a graph of beans in order to extract matching elements. However, JXPath returns …

scala scala-collections scala-java-interop jxpath
java.util.Iterator to Scala list?

I have the following code: private lazy val keys: List[String] = obj.getKeys().asScala.toList obj.getKeys returns a java.…

scala scala-collections scala-java-interop
How can I convert a Java Iterable to a Scala Iterable?

Is there an easy way to convert a java.lang.Iterable[_] to a Scala.Iterable[_] ?

scala scala-java-interop
Convert Scala Any to Java Object

I've a problem using Java Reflection from Scala. My Code: case class MyClass(id: String, value: Double) def create(values: …

java scala reflection scala-java-interop
Convert Scala Option to Java Optional

I need to convert Scala Option to Java Optional. I managed to wrote this: public <T> Optional<…

java scala scala-java-interop
How can I use a Scala singleton object in Java?

I have a Scala object that I need to use in a Java class. Here's the Scala object object Person { …

java scala scala-java-interop
How to convert a Java Stream to a Scala Stream?

As a part of an effort of converting Java code to Scala code, I need to convert the Java stream …

scala java-8 scala-java-interop
Scala convert List[Int] to a java.util.List[java.lang.Integer]

Is there a way in Scala to convert a List[Int] to java.util.List[java.lang.Integer]? I'm interfacing …

scala scala-java-interop