map - Scala - diverging implicit expansion when using toMap -


i have following definition of enum:

object graphtype extends enumeration {   type type = value   val message, request, errors = value } 

now trying map each of type corresponding, new timeseries follows:

val datasets = ( graphtype.values map (graphtype => graphtype -> new timeseries(graphtype)) ).tomap 

the type system lists datasets map[graphtype.value, timeseries] precisely want. however, compilation fails error message:

error: diverging implicit expansion type scala.collection.generic.canbuildfrom[ird.replay.gui.graphtype.valueset,(ird.replay.gui.graphtype.value, org.jfree.data.time.timeseries),that] starting method newcanbuildfrom in object sortedset val datasets = graphtype.values map (graphtype => graphtype -> new timeseries(graphtype)) tomap 

could provide explanation this, rather cryptic, error message? thanks

try converting set of values enum list first so:

val datasets = (graphtype.values.tolist.map(gt => (gt, new timeseries(gt)))).tomap 

something being set did not agree how attempting convert map, seems work fine list


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -