I would like to implicitly convert it (using scala.collection.JavaConversions or scala.collection.JavaConverters) to a java.util.List<java.util.Map<String, Object>> to be passed the a Java method that expects the latter.

Is this possible?

I have already created the following method that does it, but was wondering if it can be done automatically by the compiler?

2 Answers
2

That makes sense, but I was hoping that Scala would do it automatically so I could save 4 lines of code :-).
–
RalphDec 20 '10 at 14:16

2

This is a quite special case, so I think these 4 lines are okay. Generally over-the-top use of implicit conversion can lead to surprising results, so it's only sensible that the Scala library uses them with caution.
–
LandeiDec 20 '10 at 14:24

@Esko: I've started using the import aliasing to rename java.* classes: import java.lang.{Integer => JInteger} for those rare cases where I have to force autoboxing: (x: JInteger).
–
RalphDec 21 '10 at 12:40