I have this Scala method with below error. Cannot convert into a Scala list.
def findAllQuestion():List[Question]={
questionDao.getAllQuestions()
}
type mismatch; found : java.util.List[com.aitrich.learnware.model.domain.entity.Question]
required:
scala.collection.immutable.List[com.aitrich.learnware.model.domain.entity.Question]
Import
JavaConverters
, the response of @fynn was missingtoList
You can simply convert the List using Scala's
JavaConverters
:will do implicit conversion for you; e.g.: