Scala List Conversion and Map application -


i trying on surface should simple. trying convert java list scala list use map method apply function each element return list of new elements.

i have added type info try , confirm whats going on.

class incidents extends aggregatebase {    def toevent(entry: eventstoreentry) = entry.event match {      case  "raised" =>  buildraised(entry)    }    def buildraised(entry: eventstoreentry): incidentseventraised = {      return new incidentseventraised(entry)   } }  def getall(aggregatename: string, aggregateid: string): list[eventinstancebase] = {       val aggregate = new incidents()      val entries:list[eventstoreentry] = accessor.findall(aggregatename, aggregateid).all().asscala.tolist      return entries.map((e:eventstoreentry) => aggregate.toevent(e)).asinstanceof[list[eventinstancebase]] } 

what happens following exception:

java.lang.classcastexception: scala.runtime.boxedunit cannot cast eventinstancebase

can 1 explain going on? thanks

try provide explicit return type this:

def toevent(entry: eventstoreentry) 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -