Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Version agnostic way to convert from Java to Scala collections and back

Almost each Scala version changes the way collection conversion happens in a non-backward compatible way. Is there a better solution that is version agnostic and does not depend on Scala distribution?

I don't mind using some 3rd party libraries.

like image 260
Jus12 Avatar asked Nov 24 '25 23:11

Jus12


1 Answers

Just use the scala-collections-compat library and then you can use import scala.jdk.CollectionConverters._ on Scala 2.11, 2.12 & 2.13.

like image 68
Luis Miguel Mejía Suárez Avatar answered Nov 27 '25 15:11

Luis Miguel Mejía Suárez



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!