java scala interoperability -


let have scala lib needs used java programs not in future.

when comes collection , every goodies may have in scala. rather create methods specific java in class, or in line single responsibility principle, create bunch of static object provide method convert object in there scala version using explicit conversion, asjava.

if there way convert asjava within java way easier, don't know if package of explicit conversion can used within java. doubt feel use type class augment functionality.

is there java help.

what best practice here.

many in advance.

calling scala code java trickier other way around. can use asjava java if reference scala standard library. type classes, implicits compiler substitutes automatically. in java there no implicits, obviously, need pass right instance (which cumbersome doable). here's example of (it's converting java map scala 1 should work other way around): convert java.util.hashmap scala.collection.immutable.map in java.

personally should introduce thin wrappers on bits want expose java, don't use fancy scala features implicits, function objects (you can substitute java 8 constructs) , such.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -