Scala3-Convert to and from Java collections in Scala code-scala.jdk.CollectionConverters._
Briefly

We will discuss the scala.jdk.CollectionConverters object which deals with converting between Scala and Java collections while writing Scala code. When writing Java code, the programmer should use scala.jdk.javaapi.CollectionConverters to convert between Scala and Java collections.
First we create a mutable Scala set and convert it into a java.util.Set object using .asJava method. This conversion returns an adapter for the Scala set. This means that the Scala collection is only wrapped inside a Java Set object and not actually converted; this can be confirmed when we add 'two' to the javaSet object but it is also added to the mutableScalaSet object (see output).
Read at Medium
[
add
]
[
|
|
]