Calling Scala Monads from Java #map

Viewed 1070

I have an instance of a scala.collection.immutable.List and I want to call the map method on it, BUT from Java.

I need to supply a CanBuildFrom.

I noticed that a lot of the scala collections companion objects contain implicit CanBuildFrom instances, but I cannot work out which one I need to use.

Here is my Java code:

    Function1<WeatherData, BigDecimal> mapper = new AbstractFunction1<WeatherData, BigDecimal>(){
        @Override
        public BigDecimal apply(WeatherData data) {
            return data.getTemps().reduce(adder).divide(new BigDecimal(data.getTemps().size()));
        }
    };

    scala.collection.immutable.List<WeatherData> data = ...

    data.map(mapper, ???);

What should I pass as a CanBuildFrom (the second parameter?)

PS Using Scala 2.10-M5

2 Answers
Related