I have the following code:
private lazy val keys: List[String] = obj.getKeys().asScala.toList
obj.getKeys
returns a java.uti
Note that starting Scala 2.13
, package scala.jdk.CollectionConverters replaces deprecated packages scala.collection.JavaConverters/JavaConversions
when it comes to implicit conversions between Java and Scala collections:
import scala.jdk.CollectionConverters._
// val javaIterator: java.util.Iterator[String] = java.util.Arrays.asList("a", "b").iterator
javaIterator.asScala
// Iterator[String] =