I have a Scala array of strings:
val names:Array[String] = something.map(...)
I need to call an Android(java) method that accepts a Collection
public void addAll (Collection<? extends T> collection)
How do I covert the Array to a Collection?
JavaConversions
is now deprecated.
You should use JavaConverters
instead.
import collection.JavaConverters.asJavaCollection
val collection = asJavaCollection(Array("some value"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With